updated style and example
This commit is contained in:
parent
5ec79a536d
commit
77d197c029
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -1,17 +1,59 @@
|
||||||
|
|
||||||
#import "../src/template.typ": dhbw-template
|
#import "../src/template.typ": dhbw-template
|
||||||
|
|
||||||
#show: dhbw-template
|
#let config = (
|
||||||
|
author: (
|
||||||
|
name: "Sven Vogel",
|
||||||
|
semester: 4,
|
||||||
|
program: "Informationstechnik",
|
||||||
|
course: "TINF22IT2",
|
||||||
|
faculty: "Technik",
|
||||||
|
university: "DHBW Mannheim",
|
||||||
|
company: "ABB AG",
|
||||||
|
supervisor: "Florian Miedniak",
|
||||||
|
matriculation-number: 1191225),
|
||||||
|
thesis: (
|
||||||
|
title: "Konfiguration & Integration von PROFINET",
|
||||||
|
subtitle: "für die AC500 SPS",
|
||||||
|
submission-date: "20. März 2024",
|
||||||
|
timeframe: "1. Januar 2023 - 20. März 2024",
|
||||||
|
kind: "T2000",
|
||||||
|
summary: "",
|
||||||
|
abstract: "",
|
||||||
|
keywods: ( "IT", "PROFINET" ),
|
||||||
|
bibliography: bibliography("refs.yml"),
|
||||||
|
glossary: (
|
||||||
|
(
|
||||||
|
key: "oidc",
|
||||||
|
short: "OIDC",
|
||||||
|
long: "OpenID Connect",
|
||||||
|
desc: [OpenID is an open standard and decentralized authentication protocol promoted by the non-profit #link("https://en.wikipedia.org/wiki/OpenID#OpenID_Foundation")[OpenID Foundation].],
|
||||||
|
group: "Akronyme",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
key: "potato",
|
||||||
|
short: "potato",
|
||||||
|
// "plural" will be used when "short" should be pluralized
|
||||||
|
plural: "potatoes",
|
||||||
|
desc: [#lorem(10)],
|
||||||
|
group: "Begriffe"
|
||||||
|
),
|
||||||
|
)
|
||||||
|
))
|
||||||
|
|
||||||
|
#show: doc => dhbw-template(config: config, doc: doc)
|
||||||
|
|
||||||
= Lorem Ipsum
|
= Lorem Ipsum
|
||||||
|
|
||||||
#lorem(25)
|
#lorem(25)
|
||||||
|
@oidc
|
||||||
|
|
||||||
#lorem(100)
|
#lorem(100)
|
||||||
|
|
||||||
== Lorem Ipsum 2
|
== Lorem Ipsum 2
|
||||||
|
|
||||||
#lorem(200)
|
#lorem(200)
|
||||||
|
@texbook
|
||||||
|
|
||||||
= Lorem Ipsum 3
|
= Lorem Ipsum 3
|
||||||
|
|
||||||
|
@ -31,9 +73,42 @@ $
|
||||||
"Hello", "World"),
|
"Hello", "World"),
|
||||||
caption: [ Some table ])
|
caption: [ Some table ])
|
||||||
|
|
||||||
|
#pagebreak()
|
||||||
|
|
||||||
#figure(
|
#figure(
|
||||||
```rust
|
```rust
|
||||||
fn main() -> {
|
use std::env;
|
||||||
|
use std::fs::OpenOptions;
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
}
|
fn main() {
|
||||||
|
// Get the file path from the environment variable
|
||||||
|
let file_path = match env::var("OUTPUT_FILE") {
|
||||||
|
Ok(path) => path,
|
||||||
|
Err(_) => {
|
||||||
|
eprintln!("Error: OUTPUT_FILE environment variable is not set");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Open the file in append mode, create it if it doesn't exist
|
||||||
|
let mut file = match OpenOptions::new()
|
||||||
|
.append(true)
|
||||||
|
.create(true)
|
||||||
|
.open(&file_path)
|
||||||
|
{
|
||||||
|
Ok(file) => file,
|
||||||
|
Err(e) => {
|
||||||
|
eprintln!("Error opening file {}: {}", file_path, e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Write "Hello, World" to the file
|
||||||
|
if let Err(e) = writeln!(file, "Hello, World") {
|
||||||
|
eprintln!("Error writing to file: {}", e);
|
||||||
|
} else {
|
||||||
|
println!("Successfully appended 'Hello, World' to {}", file_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
```, caption: [Some code])
|
```, caption: [Some code])
|
|
@ -0,0 +1,6 @@
|
||||||
|
texbook:
|
||||||
|
type: book
|
||||||
|
title: The {TeX} Book
|
||||||
|
author: Knuth, Donald E.
|
||||||
|
date: 1986
|
||||||
|
publisher: Addison-Wesley Professional
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
#let new_abstract(thesis) = context [
|
#let new_abstract(config) = context [
|
||||||
|
|
||||||
|
#let thesis = config.thesis
|
||||||
|
|
||||||
#pagebreak(weak: true)
|
#pagebreak(weak: true)
|
||||||
#align(center + horizon)[
|
#align(center + horizon)[
|
||||||
#if text.lang == "de" [
|
#if text.lang == "de" [
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
|
||||||
#let new_confidentiality_statement_page(
|
#let new_confidentiality_statement_page(config) = context [
|
||||||
thesis,
|
|
||||||
author) = context [
|
#let thesis = config.thesis
|
||||||
|
#let author = config.author
|
||||||
|
|
||||||
#v(2em)
|
#v(2em)
|
||||||
#if text.lang == "de" [
|
#if text.lang == "de" [
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
|
||||||
#let new_declaration_of_authorship(thesis, author) = context [
|
#let new_declaration_of_authorship(config) = context [
|
||||||
|
|
||||||
|
#let thesis = config.thesis
|
||||||
|
#let author = config.author
|
||||||
|
|
||||||
#v(2em)
|
#v(2em)
|
||||||
#if text.lang == "de" [
|
#if text.lang == "de" [
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
|
|
||||||
#let new-glossar(glossary) = {
|
|
||||||
import "@preview/glossarium:0.4.1": make-glossary, print-glossary, gls, glspl
|
|
||||||
show: make-glossary
|
|
||||||
|
|
||||||
print-glossary(glossary)
|
|
||||||
}
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
|
||||||
#let new_prerelease_note(thesis, author) = context [
|
#let new_prerelease_note(config) = context [
|
||||||
|
|
||||||
|
#let thesis = config.thesis
|
||||||
|
#let author = config.author
|
||||||
|
|
||||||
#v(2em)
|
#v(2em)
|
||||||
#if text.lang == "de" [
|
#if text.lang == "de" [
|
||||||
|
|
|
@ -1,22 +1,11 @@
|
||||||
|
|
||||||
#let new_title_page(
|
#let new_title_page(config) = context [
|
||||||
thesis,
|
|
||||||
author) = context [
|
|
||||||
|
|
||||||
#let LogoHeight = 1.5cm
|
#let thesis = config.thesis
|
||||||
|
#let author = config.author
|
||||||
|
|
||||||
#set align(center)
|
#set align(center)
|
||||||
|
|
||||||
// logo of ABB and DHBW
|
|
||||||
#grid(
|
|
||||||
// set width of columns
|
|
||||||
// we need two, so make both half the page width
|
|
||||||
columns: (50%, 50%),
|
|
||||||
// left align logo of ABB
|
|
||||||
align(left, image("res/ABB.svg", height: LogoHeight)),
|
|
||||||
// right align logo of DHBW
|
|
||||||
align(right, image("res/DHBW.svg", height: LogoHeight)))
|
|
||||||
|
|
||||||
// title
|
// title
|
||||||
#v(2cm)
|
#v(2cm)
|
||||||
#text(size: 2em, weight: "semibold", thesis.title)
|
#text(size: 2em, weight: "semibold", thesis.title)
|
||||||
|
@ -130,5 +119,5 @@
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
#counter(page).update(1)
|
#counter(page).update(0)
|
||||||
]
|
]
|
||||||
|
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
File diff suppressed because it is too large
Load Diff
136
src/style.typ
136
src/style.typ
|
@ -7,8 +7,14 @@
|
||||||
// Edited: 27.06.2024
|
// Edited: 27.06.2024
|
||||||
// License: MIT
|
// License: MIT
|
||||||
|
|
||||||
|
#let HeaderPaddingBottom = 1.5em
|
||||||
|
#let LogoHeight = 3em
|
||||||
|
#let HeaderUnderlinePaddingTop = 0pt
|
||||||
|
|
||||||
// global style of document
|
// global style of document
|
||||||
#let global_styled_doc(doc: content) = context [
|
#let global_styled_doc(config: dictionary, body: content) = context [
|
||||||
|
#let thesis = config.thesis
|
||||||
|
|
||||||
// set page geometry
|
// set page geometry
|
||||||
// paper format of A4
|
// paper format of A4
|
||||||
#set page(
|
#set page(
|
||||||
|
@ -31,7 +37,15 @@
|
||||||
#show heading.where(level: 2): it => v(1em) + it + v(0.5em)
|
#show heading.where(level: 2): it => v(1em) + it + v(0.5em)
|
||||||
#show heading.where(level: 3): it => v(0.5em) + it + v(0.25em)
|
#show heading.where(level: 3): it => v(0.5em) + it + v(0.25em)
|
||||||
|
|
||||||
#set raw(tab-size: 4)
|
#set raw(tab-size: 4, theme: "res/github.tmTheme")
|
||||||
|
#show raw.where(block: true): code => {
|
||||||
|
show raw.line: line => {
|
||||||
|
text(fill: gray)[#line.number]
|
||||||
|
h(1em)
|
||||||
|
line.body
|
||||||
|
}
|
||||||
|
code
|
||||||
|
}
|
||||||
|
|
||||||
#set block(spacing: 2em)
|
#set block(spacing: 2em)
|
||||||
#set par(
|
#set par(
|
||||||
|
@ -39,68 +53,88 @@
|
||||||
first-line-indent: 1em,
|
first-line-indent: 1em,
|
||||||
leading: 1em)
|
leading: 1em)
|
||||||
|
|
||||||
#doc
|
#show link: set text(fill: red.darken(15%))
|
||||||
]
|
|
||||||
|
|
||||||
#let HeaderPaddingBottom = 1.5em
|
#set heading(numbering: none)
|
||||||
#let LogoHeight = 3em
|
|
||||||
#let HeaderUnderlinePaddingTop = 0pt
|
|
||||||
|
|
||||||
#let prelude_styled(body: content, thesis) = context [
|
|
||||||
#set page(
|
#set page(
|
||||||
header-ascent: HeaderUnderlinePaddingTop + HeaderPaddingBottom,
|
header-ascent: HeaderUnderlinePaddingTop + HeaderPaddingBottom,
|
||||||
numbering: "I",
|
footer-descent: 1em,
|
||||||
margin: (top: 2.5cm + LogoHeight + HeaderUnderlinePaddingTop + HeaderPaddingBottom),
|
margin: (top: 2.5cm + LogoHeight + HeaderUnderlinePaddingTop + HeaderPaddingBottom, bottom: 2.5cm + 1em),
|
||||||
header: [
|
numbering: (..nums) => {
|
||||||
#grid(
|
let current-page = here().page()
|
||||||
columns: (1fr, auto),
|
if current-page == 1{
|
||||||
align: (horizon, bottom),
|
[]
|
||||||
context [ _ #thesis.title _ ],
|
} else if query(<end-of-prelude>).first().location().page() <= current-page {
|
||||||
image("pages/res/DHBW.svg", height: LogoHeight)
|
numbering("1 / 1", ..nums)
|
||||||
)
|
} else {
|
||||||
#v(HeaderUnderlinePaddingTop - 1em)
|
numbering("I", nums.pos().first())
|
||||||
#line(length: 100%)
|
}
|
||||||
])
|
},
|
||||||
|
header: context {
|
||||||
|
set align(left)
|
||||||
|
if here().page() == 1 {
|
||||||
|
// logo of ABB and DHBW
|
||||||
|
grid(
|
||||||
|
// set width of columns
|
||||||
|
// we need two, so make both half the page width
|
||||||
|
columns: (50%, 50%),
|
||||||
|
// left align logo of ABB
|
||||||
|
align(left, image("res/ABB.svg", height: LogoHeight)),
|
||||||
|
// right align logo of DHBW
|
||||||
|
align(right, image("res/DHBW.svg", height: LogoHeight)))
|
||||||
|
|
||||||
|
} else if query(<end-of-prelude>).first().location().page() <= here().page() {
|
||||||
|
let headers-before = query(selector(heading.where(numbering: "1.", level: 1)).before(here()))
|
||||||
|
|
||||||
|
let header-title = thesis.title
|
||||||
|
|
||||||
|
if headers-before.len() > 0 {
|
||||||
|
header-title = headers-before.last().body
|
||||||
|
} else {
|
||||||
|
let headers-after = query(selector(heading.where(numbering: "1.", level: 1)).after(here()))
|
||||||
|
|
||||||
|
if headers-after.len() > 0 {
|
||||||
|
header-title = headers-after.first().body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
grid(
|
||||||
|
columns: (1fr, auto),
|
||||||
|
align: (horizon, bottom),
|
||||||
|
context [ _ #header-title _ ],
|
||||||
|
image("res/DHBW.svg", height: LogoHeight))
|
||||||
|
|
||||||
|
v(HeaderUnderlinePaddingTop - 1em)
|
||||||
|
line(length: 100%)
|
||||||
|
} else {
|
||||||
|
grid(
|
||||||
|
columns: (1fr, auto),
|
||||||
|
align: (horizon, bottom),
|
||||||
|
context [ _ #config.thesis.title _ ],
|
||||||
|
image("res/DHBW.svg", height: LogoHeight)
|
||||||
|
)
|
||||||
|
v(HeaderUnderlinePaddingTop - 1em)
|
||||||
|
line(length: 100%)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
#body
|
#body
|
||||||
]
|
]
|
||||||
|
|
||||||
#let content_styled(body: content, thesis) = [
|
#let prelude_styled(config: dictionary, body: content) = context [
|
||||||
|
|
||||||
|
#body
|
||||||
|
]
|
||||||
|
|
||||||
|
#let content_styled(config: dictionary, body: content) = [
|
||||||
// setup equate for sub equation labeling
|
// setup equate for sub equation labeling
|
||||||
#import "@preview/equate:0.2.0": equate
|
#import "@preview/equate:0.2.0": equate
|
||||||
#show: equate.with(breakable: true, sub-numbering: true)
|
#show: equate.with(breakable: true, sub-numbering: true)
|
||||||
#set math.equation(numbering: "(1.1)")
|
#set math.equation(numbering: "(1.1)")
|
||||||
|
|
||||||
#set heading(numbering: "1.")
|
#set heading(numbering: "1.")
|
||||||
#page(
|
|
||||||
header-ascent: HeaderUnderlinePaddingTop + HeaderPaddingBottom,
|
|
||||||
numbering: "1/1",
|
|
||||||
footer-descent: 1em,
|
|
||||||
margin: (top: 2.5cm + LogoHeight + HeaderUnderlinePaddingTop + HeaderPaddingBottom, bottom: 2.5cm + 1em),
|
|
||||||
header: context [
|
|
||||||
#let headers-before = query(selector(heading.where(numbering: "1.", level: 1)).before(here()))
|
|
||||||
|
|
||||||
#let header-title = thesis.title
|
#let thesis = config.thesis
|
||||||
|
|
||||||
#if headers-before.len() > 0 {
|
#body
|
||||||
header-title = headers-before.last().body
|
|
||||||
} else {
|
|
||||||
let headers-after = query(selector(heading.where(numbering: "1.", level: 1)).after(here()))
|
|
||||||
|
|
||||||
if headers-after.len() > 0 {
|
|
||||||
header-title = headers-after.first().body
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#grid(
|
|
||||||
columns: (1fr, auto),
|
|
||||||
align: (horizon, bottom),
|
|
||||||
context [ _ #header-title _ ],
|
|
||||||
image("pages/res/DHBW.svg", height: LogoHeight)
|
|
||||||
)
|
|
||||||
#v(HeaderUnderlinePaddingTop - 1em)
|
|
||||||
#line(length: 100%)
|
|
||||||
])[
|
|
||||||
#body
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
// License: MIT
|
// License: MIT
|
||||||
|
|
||||||
// start of template pages and styles
|
// start of template pages and styles
|
||||||
#let dhbw-template(doc) = [
|
#let dhbw-template(config: dictionary, doc: content) = [
|
||||||
|
|
||||||
#import "style.typ": global_styled_doc, prelude_styled, content_styled
|
#import "style.typ": global_styled_doc, prelude_styled, content_styled
|
||||||
|
|
||||||
// apply global style to every element in the argument content
|
// apply global style to every element in the argument content
|
||||||
#global_styled_doc(doc: [
|
#global_styled_doc(config: config, body: [
|
||||||
|
|
||||||
#import "pages/titlepage.typ": new_title_page
|
#import "pages/titlepage.typ": new_title_page
|
||||||
#import "pages/declaration-of-authorship.typ": new_declaration_of_authorship
|
#import "pages/declaration-of-authorship.typ": new_declaration_of_authorship
|
||||||
|
@ -21,60 +21,47 @@
|
||||||
#import "pages/prerelease-note.typ": new_prerelease_note
|
#import "pages/prerelease-note.typ": new_prerelease_note
|
||||||
#import "pages/outline.typ": new_outline
|
#import "pages/outline.typ": new_outline
|
||||||
#import "pages/abstract.typ": new_abstract
|
#import "pages/abstract.typ": new_abstract
|
||||||
#import "pages/glossar.typ": new-glossar
|
|
||||||
|
|
||||||
#set text(lang: "de", region: "de")
|
#set text(lang: "de", region: "de")
|
||||||
|
|
||||||
#let author = (
|
|
||||||
name: "Sven Vogel",
|
|
||||||
semester: 4,
|
|
||||||
program: "Informationstechnik",
|
|
||||||
course: "TINF22IT2",
|
|
||||||
faculty: "Technik",
|
|
||||||
university: "DHBW Mannheim",
|
|
||||||
company: "ABB AG",
|
|
||||||
supervisor: "Florian Miedniak",
|
|
||||||
matriculation-number: 1191225
|
|
||||||
)
|
|
||||||
|
|
||||||
#let thesis = (
|
|
||||||
title: "Konfiguration & Integration von PROFINET",
|
|
||||||
subtitle: "für die AC500 SPS",
|
|
||||||
submission-date: "20. März 2024",
|
|
||||||
timeframe: "1. Januar 2023 - 20. März 2024",
|
|
||||||
kind: "T2000",
|
|
||||||
summary: "",
|
|
||||||
abstract: "",
|
|
||||||
)
|
|
||||||
|
|
||||||
#let glossary = ()
|
|
||||||
|
|
||||||
// preppend title page
|
// preppend title page
|
||||||
#new_title_page(thesis, author)
|
#new_title_page(config)
|
||||||
|
|
||||||
#prelude_styled(thesis, body: [
|
#prelude_styled(config: config, body: [
|
||||||
#pagebreak(weak: true)
|
#pagebreak(weak: true)
|
||||||
#new_declaration_of_authorship(thesis, author)
|
#new_declaration_of_authorship(config)
|
||||||
|
|
||||||
#pagebreak(weak: true)
|
#pagebreak(weak: true)
|
||||||
#new_confidentiality_statement_page(thesis, author)
|
#new_confidentiality_statement_page(config)
|
||||||
|
|
||||||
#pagebreak(weak: true)
|
#pagebreak(weak: true)
|
||||||
#new_prerelease_note(thesis, author)
|
#new_prerelease_note(config)
|
||||||
|
|
||||||
#pagebreak(weak: true)
|
#pagebreak(weak: true)
|
||||||
#new_outline()
|
#new_outline()
|
||||||
|
|
||||||
#pagebreak(weak: true)
|
#pagebreak(weak: true)
|
||||||
#new_abstract(thesis)
|
#new_abstract(config)
|
||||||
|
|
||||||
#pagebreak(weak: true)
|
|
||||||
#new-glossar(glossary)
|
|
||||||
])
|
])
|
||||||
|
|
||||||
#content_styled(thesis, body: [
|
#import "@preview/glossarium:0.4.1": make-glossary, print-glossary, gls, glspl
|
||||||
|
#show: make-glossary
|
||||||
|
|
||||||
|
#pagebreak(weak: true)
|
||||||
|
#print-glossary(config.thesis.glossary)
|
||||||
|
#pagebreak(weak: true)
|
||||||
|
|
||||||
|
#metadata("prelude terminate") <end-of-prelude>
|
||||||
|
|
||||||
|
#content_styled(config: config, body: [
|
||||||
// code of document follows here
|
// code of document follows here
|
||||||
#doc
|
#doc
|
||||||
|
|
||||||
|
#if config.thesis.bibliography != none {
|
||||||
|
pagebreak(weak: true)
|
||||||
|
set bibliography(style: "ieee")
|
||||||
|
config.thesis.bibliography
|
||||||
|
}
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
]
|
]
|
Loading…
Reference in New Issue