2024-06-27 13:57:04 +00:00
|
|
|
|
|
|
|
// .--------------------------------------------------------------------------.
|
|
|
|
// | Global style of document |
|
|
|
|
// '--------------------------------------------------------------------------'
|
|
|
|
|
|
|
|
// Author: Sven Vogel
|
|
|
|
// Edited: 27.06.2024
|
|
|
|
// License: MIT
|
|
|
|
|
2024-07-01 10:13:57 +00:00
|
|
|
#let HeaderPaddingBottom = 1.5em
|
|
|
|
#let LogoHeight = 3em
|
|
|
|
#let HeaderUnderlinePaddingTop = 0pt
|
|
|
|
|
2024-06-27 13:57:04 +00:00
|
|
|
// global style of document
|
2024-07-01 10:13:57 +00:00
|
|
|
#let global_styled_doc(config: dictionary, body: content) = context [
|
|
|
|
#let thesis = config.thesis
|
|
|
|
|
2024-06-27 13:57:04 +00:00
|
|
|
// set page geometry
|
|
|
|
// paper format of A4
|
|
|
|
#set page(
|
|
|
|
paper: "a4",
|
2024-06-28 09:54:30 +00:00
|
|
|
margin: (left: 3cm, right: 2.5cm, top: 2.5cm, bottom: 2.5cm))
|
2024-06-27 13:57:04 +00:00
|
|
|
|
2024-06-28 09:54:30 +00:00
|
|
|
#set text(
|
|
|
|
size: 12pt,
|
|
|
|
ligatures: true,
|
|
|
|
hyphenate: true,
|
|
|
|
dir: ltr,
|
|
|
|
font: "Open Sans")
|
|
|
|
|
|
|
|
#show heading: set text(
|
|
|
|
font: "Montserrat",
|
|
|
|
weight: "semibold")
|
|
|
|
|
|
|
|
// Set header spacing
|
|
|
|
#show heading.where(level: 1): it => v(2em) + it + v(1em)
|
|
|
|
#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)
|
|
|
|
|
2024-07-01 10:13:57 +00:00
|
|
|
#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
|
|
|
|
}
|
2024-06-27 13:57:04 +00:00
|
|
|
|
2024-06-28 13:20:58 +00:00
|
|
|
#set block(spacing: 2em)
|
|
|
|
#set par(
|
|
|
|
justify: true,
|
|
|
|
first-line-indent: 1em,
|
|
|
|
leading: 1em)
|
|
|
|
|
2024-07-01 10:13:57 +00:00
|
|
|
#show link: set text(fill: red.darken(15%))
|
2024-06-28 09:54:30 +00:00
|
|
|
|
2024-07-01 10:13:57 +00:00
|
|
|
#set heading(numbering: none)
|
2024-06-28 09:54:30 +00:00
|
|
|
#set page(
|
|
|
|
header-ascent: HeaderUnderlinePaddingTop + HeaderPaddingBottom,
|
2024-07-01 10:13:57 +00:00
|
|
|
footer-descent: 1em,
|
|
|
|
margin: (top: 2.5cm + LogoHeight + HeaderUnderlinePaddingTop + HeaderPaddingBottom, bottom: 2.5cm + 1em),
|
|
|
|
numbering: (..nums) => {
|
|
|
|
let current-page = here().page()
|
|
|
|
if current-page == 1{
|
|
|
|
[]
|
2024-07-01 11:50:54 +00:00
|
|
|
} else if query(<end-of-prelude>).first().location().page() > current-page {
|
|
|
|
numbering("I", nums.pos().first())
|
|
|
|
} else if query(<end-of-content>).first().location().page() >= current-page {
|
2024-07-01 10:13:57 +00:00
|
|
|
numbering("1 / 1", ..nums)
|
|
|
|
} else {
|
2024-07-01 11:50:54 +00:00
|
|
|
numbering("a", nums.pos().first())
|
2024-07-01 10:13:57 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
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
|
|
|
|
]
|
|
|
|
|
|
|
|
#let prelude_styled(config: dictionary, body: content) = context [
|
2024-06-28 09:54:30 +00:00
|
|
|
|
2024-06-28 13:20:58 +00:00
|
|
|
#body
|
|
|
|
]
|
|
|
|
|
2024-07-01 10:13:57 +00:00
|
|
|
#let content_styled(config: dictionary, body: content) = [
|
2024-06-28 13:52:45 +00:00
|
|
|
// setup equate for sub equation labeling
|
|
|
|
#import "@preview/equate:0.2.0": equate
|
|
|
|
#show: equate.with(breakable: true, sub-numbering: true)
|
|
|
|
#set math.equation(numbering: "(1.1)")
|
|
|
|
|
2024-06-28 13:20:58 +00:00
|
|
|
#set heading(numbering: "1.")
|
|
|
|
|
2024-07-01 10:13:57 +00:00
|
|
|
#let thesis = config.thesis
|
2024-06-28 13:20:58 +00:00
|
|
|
|
2024-07-01 10:13:57 +00:00
|
|
|
#body
|
2024-06-28 09:54:30 +00:00
|
|
|
]
|
2024-07-01 11:50:54 +00:00
|
|
|
|
|
|
|
#let end_styled(config: dictionary, body: content) = [
|
|
|
|
|
|
|
|
#set heading(numbering: "1.")
|
|
|
|
|
|
|
|
#let thesis = config.thesis
|
|
|
|
|
|
|
|
#body
|
|
|
|
]
|