Compare commits

..

No commits in common. "4a1fcd0a35c0f4f40ead9e454f013042eeebc117" and "7262caeee735e93ef848d36bb46cc61f0f01bcfe" have entirely different histories.

12 changed files with 244 additions and 337 deletions

View File

@ -5,12 +5,15 @@ on: [push]
jobs: jobs:
run-ci-linux: run-ci-linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
TYPST_INSTALL: /usr/local
TYPST_VERSION: 0.11.1
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Setup Nix Shell - name: Install Typst CLI
- uses: cachix/install-nix-action@v18 run: curl -fsSL https://typst.community/typst-install/install.sh | sh -s "$TYPST_VERSION"
with: - name: Set up Python 3
nix_path: nixpkgs=channel:nixos-unstable run: apt update -y && apt install python3-pip -y
- name: Run CI - name: Run CI
run: nix-shell --run ./run-ci.sh run: bash -c ./run-ci.sh

View File

@ -1,42 +0,0 @@
#!/bin/sh
function format() {
# format file
# typstyle --format $1
if [ -z "$1" ]; then
return
fi
local wd=$(dirname $(realpath "$1"))
echo "processing file $1..."
typstyle "$2" "$1" > /dev/null
if [ $? -eq 1 ]; then
echo "failed format validation: $1"
exit 1
fi
local imports=$(rg "#import \"([a-z0-9/\-]+\.typ)\"" -Nor '$1' "$1")
# format all included files
while IFS= read -r line; do
if [ -z "$line" ]; then
continue
fi
format "$wd/$line" "$2"
done <<< "$imports"
}
case $1 in
"--format")
format "$2" "--inplace"
;;
"--check")
format "$2" "--check"
;;
*)
echo "unknown option: $1"
exit 1
;;
esac

View File

@ -1,13 +0,0 @@
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-24.05";
pkgs = import nixpkgs { config = {}; overlays = []; };
in
pkgs.mkShellNoCC {
packages = with pkgs; [
python312
python312Packages.pyyaml
typst
typstyle
];
}

View File

@ -3,16 +3,16 @@
// https://brand.abb/portal/en/branding-principles/basic-brand-elements/color // https://brand.abb/portal/en/branding-principles/basic-brand-elements/color
// ABB branding colors // ABB branding colors
#let ABB-RED = cmyk(0%, 100%, 95%, 0%) #let ABB-RED = cmyk(0%, 100%, 95%, 0%)
#let ABB-BLACK = cmyk(0%, 0%, 0%, 100%) #let ABB-BLACK = cmyk(0%, 0%, 0%, 100%)
#let ABB-GRAY-01 = cmyk(0%, 0%, 0%, 90%) #let ABB-GRAY-01 = cmyk(0%, 0%, 0%, 90%)
#let ABB-GRAY-02 = cmyk(0%, 0%, 0%, 75%) #let ABB-GRAY-02 = cmyk(0%, 0%, 0%, 75%)
#let ABB-GRAY-03 = cmyk(0%, 0%, 0%, 55%) #let ABB-GRAY-03 = cmyk(0%, 0%, 0%, 55%)
#let ABB-GRAY-04 = cmyk(0%, 0%, 0%, 35%) #let ABB-GRAY-04 = cmyk(0%, 0%, 0%, 35%)
#let ABB-GRAY-05 = cmyk(0%, 0%, 0%, 15%) #let ABB-GRAY-05 = cmyk(0%, 0%, 0%, 15%)
#let ABB-GRAY-06 = cmyk(0%, 0%, 0%, 5%) #let ABB-GRAY-06 = cmyk(0%, 0%, 0%, 5%)
#let ABB-WHITE = cmyk(0%, 0%, 0%, 0%) #let ABB-WHITE = cmyk(0%, 0%, 0%, 0%)
// ABB branding functinal colors // ABB branding functinal colors
#let ABB-BLUE = cmyk(100%, 53%, 2%, 16%) #let ABB-BLUE = cmyk(100%, 53%, 2%, 16%)
#let ABB-GREEN = cmyk(91%, 4%, 100%, 25%) #let ABB-GREEN = cmyk(91%, 4%, 100%, 25%)
#let ABB-YELLOW = cmyk(0%, 9%, 100%, 0%) #let ABB-YELLOW = cmyk(0%, 9%, 100%, 0%)

View File

@ -53,9 +53,9 @@
page: ( page: (
format: "a4", format: "a4",
margin: ( margin: (
left: 3cm, left: 3cm,
right: 2.5cm, right: 2.5cm,
top: 2.5cm, top: 2.5cm,
bottom: 2.5cm)), bottom: 2.5cm)),
text: ( text: (
size: 12pt, size: 12pt,
@ -81,20 +81,20 @@
} }
for (key, val) in base { for (key, val) in base {
if key in update { if key in update {
let update_val = update.at(key) let update_val = update.at(key)
if type(val) == dictionary and type(update_val) == dictionary { if type(val) == dictionary and type(update_val) == dictionary {
base.insert(key, deep-insert-checked(val, update_val)) base.insert(key, deep-insert-checked(val, update_val))
} else if val == none or type(val) == type(update_val) { } else if val == none or type(val) == type(update_val) {
base.insert(key, update_val) base.insert(key, update_val)
} else {
panic("missmatched dictionary entry `" + key + "` type: expected `" + type(val) + "` got `" + type(update_val) + "`")
}
} else { } else {
panic("missmatched dictionary entry `" + key + "` type: expected `" + type(val) + "` got `" + type(update_val) + "`") base.insert(key, val)
} }
} else {
base.insert(key, val)
} }
}
return base return base
} }

View File

@ -30,10 +30,7 @@ SOFTWARE.*/
#let __query_labels_with_key(loc, key, before: false) = { #let __query_labels_with_key(loc, key, before: false) = {
if before { if before {
query( query(
selector(label(__glossary_label_prefix + key)).before( selector(label(__glossary_label_prefix + key)).before(loc, inclusive: false),
loc,
inclusive: false,
),
loc, loc,
) )
} else { } else {
@ -43,7 +40,7 @@ SOFTWARE.*/
// key not found error // key not found error
#let __not-found-panic-error-msg(key) = { #let __not-found-panic-error-msg(key) = {
__glossarium_error_prefix + "key '" + key + "' not found" __glossarium_error_prefix+"key '"+key+"' not found"
} }
// Reference a term // Reference a term
@ -52,25 +49,20 @@ SOFTWARE.*/
let __glossary_entries = __glossary_entries.final(here()) let __glossary_entries = __glossary_entries.final(here())
if key in __glossary_entries { if key in __glossary_entries {
let entry = __glossary_entries.at(key) let entry = __glossary_entries.at(key)
let gloss = __query_labels_with_key(here(), key, before: true) let gloss = __query_labels_with_key(here(), key, before: true)
let is_first = gloss == () let is_first = gloss == ()
let entlong = entry.at("long", default: "") let entlong = entry.at("long", default: "")
let textLink = if display != none { let textLink = if display != none {
[#display] [#display]
} else if ( } else if (is_first or long == true) and entlong != [] and entlong != "" and long != false {
is_first or long == true
) and entlong != [] and entlong != "" and long != false {
[#entlong (#entry.short#suffix)] [#entlong (#entry.short#suffix)]
} else { } else {
[#entry.short#suffix] [#entry.short#suffix]
} }
[#link( [#link(label(entry.key), textLink)#label(__glossary_label_prefix + entry.key)]
label(entry.key),
textLink,
)#label(__glossary_label_prefix + entry.key)]
} else { } else {
panic(__not-found-panic-error-msg(key)) panic(__not-found-panic-error-msg(key))
} }
@ -84,14 +76,14 @@ SOFTWARE.*/
let __glossary_entries = __glossary_entries.final(here()) let __glossary_entries = __glossary_entries.final(here())
if key in __glossary_entries { if key in __glossary_entries {
let entry = __glossary_entries.at(key) let entry = __glossary_entries.at(key)
let gloss = __query_labels_with_key(here(), key, before: true) let gloss = __query_labels_with_key(here(), key, before: true)
let is_first = gloss == () let is_first = gloss == ()
let entlongplural = entry.at("longplural", default: "") let entlongplural = entry.at("longplural", default: "");
let entlong = if entlongplural == [] or entlongplural == "" { let entlong = if entlongplural == [] or entlongplural == "" {
// if the entry long plural is not provided, then fallback to adding 's' suffix // if the entry long plural is not provided, then fallback to adding 's' suffix
let entlong = entry.at("long", default: "") let entlong = entry.at("long", default: "");
if entlong != [] and entlong != "" { if entlong != [] and entlong != "" {
[#entlong#suffix] [#entlong#suffix]
} else { } else {
@ -100,26 +92,21 @@ SOFTWARE.*/
} else { } else {
[#entlongplural] [#entlongplural]
} }
let entplural = entry.at("plural", default: "") let entplural = entry.at("plural", default: "");
let short = if entplural == [] or entplural == "" { let short = if entplural == [] or entplural == "" {
[#entry.short#suffix] [#entry.short#suffix]
} else { } else {
[#entplural] [#entplural]
} }
let textLink = if ( let textLink = if (is_first or long == true) and entlong != [] and entlong != "" and long != false {
is_first or long == true
) and entlong != [] and entlong != "" and long != false {
[#entlong (#short)] [#entlong (#short)]
} else { } else {
[#short] [#short]
} }
[#link( [#link(label(entry.key), textLink)#label(__glossary_label_prefix + entry.key)]
label(entry.key),
textLink,
)#label(__glossary_label_prefix + entry.key)]
} else { } else {
panic(__not-found-panic-error-msg(key)) panic(__not-found-panic-error-msg(key))
} }
@ -165,73 +152,69 @@ SOFTWARE.*/
for entry in entry_list { for entry in entry_list {
x.insert(entry.key, entry) x.insert(entry.key, entry)
} }
x x
}) })
let groups = entries.map(x => x.at("group")).dedup() let groups = entries.map(x => x.at("group")).dedup()
for group in groups.sorted() { for group in groups.sorted() {
if group != "" [#heading(group, level: 1, outlined: false) ] if group != "" [#heading(group, level: 1, outlined: false) ]
for entry in entries.sorted(key: x => x.key) { for entry in entries.sorted(key: x => x.key) {
if entry.group == group { if entry.group == group {
[ [
#show figure.where(kind: __glossarium_figure): it => it.caption #show figure.where(kind: __glossarium_figure): it => it.caption
#figure( #figure(
supplement: "", supplement: "",
kind: __glossarium_figure, kind: __glossarium_figure,
numbering: none, numbering: none,
caption: { caption: {
context { context {
let term_references = __query_labels_with_key(here(), entry.key) let term_references = __query_labels_with_key(here(), entry.key)
if term_references.len() != 0 or show-all { if term_references.len() != 0 or show-all {
let desc = entry.at("desc", default: "") let desc = entry.at("desc", default: "")
let long = entry.at("long", default: "") let long = entry.at("long", default: "")
let hasLong = long != "" and long != [] let hasLong = long != "" and long != []
let hasDesc = desc != "" and desc != [] let hasDesc = desc != "" and desc != []
grid( grid(
columns: 2, columns: 2,
column-gutter: 1em, column-gutter: 1em,
text(weight: "bold", entry.short), text(weight: "bold", entry.short),
{ {
if hasLong { if hasLong {
text(weight: "bold", entry.long) text(weight: "bold", entry.long)
}
if hasLong and hasDesc [:]
if hasDesc [ #desc ] else [. ]
if disable-back-references != true {
term_references.map(x => x.location()).sorted(key: x => x.page()).fold(
(values: (), pages: ()),
((values, pages), x) => if pages.contains(x.page()) {
(values: values, pages: pages)
} else {
values.push(x)
pages.push(x.page())
(values: values, pages: pages)
},
).values.map(x => {
let page-numbering = x.page-numbering();
if page-numbering == none {
page-numbering = "1"
}
link(x)[#numbering(page-numbering, ..counter(page).at(x))]
}
).join(", ")
}
} }
if hasLong and hasDesc [:] )
if hasDesc [ #desc ] else [. ] }
if disable-back-references != true {
term_references.map(x => x.location()).sorted(key: x => x.page()).fold(
(values: (), pages: ()),
((values, pages), x) => if pages.contains(x.page()) {
(values: values, pages: pages)
} else {
values.push(x)
pages.push(x.page())
(values: values, pages: pages)
},
).values.map(x => {
let page-numbering = x.page-numbering()
if page-numbering == none {
page-numbering = "1"
}
link(x)[#numbering(
page-numbering,
..counter(page).at(x),
)]
}).join(", ")
}
},
)
} }
} },
}, )[] #label(entry.key)
)[] #label(entry.key)
#parbreak() #parbreak()
] ]
} }
} }
if enable-group-pagebreak { if enable-group-pagebreak { pagebreak(weak: true) }
pagebreak(weak: true)
}
} }
}; };

View File

@ -9,72 +9,66 @@
#let glossary(entries) = { #let glossary(entries) = {
assert(
type(entries) == dictionary,
message: "The glossary is not a dictionary",
)
for (k, v) in entries.pairs() {
assert( assert(
type(v) == dictionary, type(entries) == dictionary,
message: "The glossary entry `" + k + "` is not a dictionary", message: "The glossary is not a dictionary",
) )
for key in v.keys() { for (k, v) in entries.pairs() {
assert( assert(
key in ("short", "long", "desc", "group"), type(v) == dictionary,
message: "Found unexpected key `" + key + "` in glossary entry `" + k, message: "The glossary entry `" + k + "` is not a dictionary")
)
}
assert( for key in v.keys() {
type(v.short) == str, assert(
message: "The short form of glossary entry `" + k + "` is not a string", key in ("short", "long", "desc", "group"),
) message: "Found unexpected key `" + key + "` in glossary entry `" + k)
if "long" in v {
assert(
type(v.long) == str,
message: "The long form of glossary entry `" + k + "` is not a string",
)
}
if "desc" in v {
assert(
type(v.desc) == str,
message: "The description of glossary entry `" + k + "` is not a string",
)
}
if "group" in v {
assert(
type(v.group) == str,
message: "The optional group of glossary entry `" + k + "` is not a string",
)
} else {
let group = if "long" in v {
if (context text.lang) == "de" {
"Akronyme"
} else {
"Acronyms"
}
} else {
if (context text.lang) == "de" {
"Begriffe"
} else {
"Terms"
}
} }
entries.at(k).group = group assert(
type(v.short) == str,
message: "The short form of glossary entry `" + k + "` is not a string")
if "long" in v {
assert(
type(v.long) == str,
message: "The long form of glossary entry `" + k + "` is not a string")
}
if "desc" in v {
assert(
type(v.desc) == str,
message: "The description of glossary entry `" + k + "` is not a string")
}
if "group" in v {
assert(
type(v.group) == str,
message: "The optional group of glossary entry `" + k + "` is not a string")
} else {
let group = if "long" in v {
if (context text.lang) == "de" {
"Akronyme"
} else {
"Acronyms"
}
} else {
if (context text.lang) == "de" {
"Begriffe"
} else {
"Terms"
}
}
entries.at(k).group = group
}
} }
}
return entries.pairs().map(((key, entry)) => ( return entries.pairs().map(((key, entry)) => (
key: key, key: key,
short: eval(entry.short, mode: "markup"), short: eval(entry.short, mode: "markup"),
long: eval(entry.at("long", default: ""), mode: "markup"), long: eval(entry.at("long", default: ""), mode: "markup"),
desc: eval(entry.at("desc", default: ""), mode: "markup"), desc: eval(entry.at("desc", default: ""), mode: "markup"),
group: entry.at("group", default: ""), group: entry.at("group", default: "")
)) ))
} }

View File

@ -7,20 +7,20 @@
// Edited: 27.06.2024 // Edited: 27.06.2024
// License: MIT // License: MIT
#import "conf.typ": validate-config #import "conf.typ": validate-config
#import "branding.typ": * #import "branding.typ": *
#import "style.typ": global_styled_doc, content_styled, end_styled #import "style.typ": global_styled_doc, content_styled, end_styled
#import "glossary.typ": glossary #import "glossary.typ": glossary
#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
#import "pages/confidentiality-statement.typ": new_confidentiality_statement_page #import "pages/confidentiality-statement.typ": new_confidentiality_statement_page
#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/preface.typ": new-preface #import "pages/preface.typ": new-preface
#import "pages/appendix.typ": show-appendix #import "pages/appendix.typ": show-appendix
#let group-break() = { #let group-break()= {
[#pagebreak()] [#pagebreak()]
} }
@ -36,14 +36,12 @@
#set document( #set document(
author: config.author.name, author: config.author.name,
keywords: config.thesis.keywords, keywords: config.thesis.keywords,
title: config.thesis.title, title: config.thesis.title)
)
// configure text locale // configure text locale
#set text( #set text(
lang: config.lang, lang: config.lang,
region: config.region, region: config.region)
)
// preppend title page // preppend title page
#new_title_page(config) #new_title_page(config)
@ -59,7 +57,7 @@
#new-preface(config) #new-preface(config)
#new_outline() #new_outline()
// glossary is built inline here because the links must be // glossary is built inline here because the links must be
// exposed to the entire document // exposed to the entire document
#import "glossarium.typ": * #import "glossarium.typ": *
#show: make-glossary #show: make-glossary
@ -70,11 +68,10 @@
print-glossary( print-glossary(
disable-back-references: true, disable-back-references: true,
enable-group-pagebreak: true, enable-group-pagebreak: true,
glossary(config.thesis.glossary), glossary(config.thesis.glossary))
)
pagebreak(weak: true) pagebreak(weak: true)
} }
#counter(page).update(1) #counter(page).update(1)
// mark end of prelude // mark end of prelude

View File

@ -7,7 +7,7 @@
// License: MIT // License: MIT
#let new_abstract(config) = context { #let new_abstract(config) = context {
set align(center + horizon) set align(center + horizon)
// only include summary when a language other than english is used // only include summary when a language other than english is used

View File

@ -9,65 +9,63 @@
// render an outline of figures // render an outline of figures
// with a specific title and filter by a specifc kind of figure // with a specific title and filter by a specifc kind of figure
// can optionally insert a pagebreak after the outline // can optionally insert a pagebreak after the outline
// NOTE: will not render in case the listing is empty // NOTE: will not render in case the listing is empty
#let render_filtered_outline(title: str, kind: selector) = context { #let render_filtered_outline(title: str, kind: selector) = context {
let elems = query(figure.where(kind: kind), here()) let elems = query(figure.where(kind: kind), here())
let count = elems.len() let count = elems.len()
// only show outline if there is something to list // only show outline if there is something to list
if count > 0 { if count > 0 {
pagebreak(weak: true) pagebreak(weak: true)
outline( outline(
title: title, title: title,
target: figure.where(kind: kind), target: figure.where(kind: kind))
)
} }
} }
#let render_figures_outline() = context { #let render_figures_outline() = context {
let title = if (text.lang == "de") { let title = if (text.lang == "de") {
"Abbildungsverzeichnis" "Abbildungsverzeichnis"
} else if text.lang == "en" { } else if text.lang == "en" {
"List of Figures" "List of Figures"
} }
render_filtered_outline(title: title, kind: image) render_filtered_outline(title: title, kind: image)
} }
#let render_table_outline() = context { #let render_table_outline() = context {
let title = if (text.lang == "de") { let title = if (text.lang == "de") {
"Tabellenverzeichnis" "Tabellenverzeichnis"
} else if text.lang == "en" { } else if text.lang == "en" {
"List of Tables" "List of Tables"
} }
render_filtered_outline(title: title, kind: table) render_filtered_outline(title: title, kind: table)
} }
#let render_raw_outline() = context { #let render_raw_outline() = context {
let title = if (text.lang == "de") { let title = if (text.lang == "de") {
"Quelltextverzeichnis" "Quelltextverzeichnis"
} else if text.lang == "en" { } else if text.lang == "en" {
"Code Snippets" "Code Snippets"
} }
render_filtered_outline(title: title, kind: raw) render_filtered_outline(title: title, kind: raw)
} }
#let render_heading_outline() = context { #let render_heading_outline() = context {
let title = if (text.lang == "de") { let title = if (text.lang == "de") {
"Inhaltsverzeichnis" "Inhaltsverzeichnis"
} else if text.lang == "en" { } else if text.lang == "en" {
"Table of Contents" "Table of Contents"
} }
pagebreak(weak: true) pagebreak(weak: true)
outline( outline(
target: heading.where(supplement: [chapter]), target: heading.where(supplement: [chapter]),
title: title, title: title,
indent: auto, indent: auto)
)
} }
#let render_appendix_outline() = context { #let render_appendix_outline() = context {
@ -83,20 +81,21 @@
} else if text.lang == "en" { } else if text.lang == "en" {
"Table of Appendices" "Table of Appendices"
} }
pagebreak(weak: true) pagebreak(weak: true)
outline( outline(
target: heading.where(supplement: supplement), target: heading.where(supplement: supplement),
title: title, title: title,
indent: auto, indent: auto)
)
} }
} }
#let new_outline() = { #let new_outline() = {
pagebreak(weak: true) pagebreak(weak: true)
show outline.entry.where(level: 1): it => { show outline.entry.where(
level: 1,
): it => {
v(1.5em, weak: true) v(1.5em, weak: true)
strong(it) strong(it)
} }

View File

@ -60,14 +60,24 @@
column-gutter: 1cm, column-gutter: 1cm,
align: left, align: left,
stroke: none, stroke: none,
[*Verfasser:*], author.name,
[*Bearbeitungszeitraum:*], thesis.timeframe, [*Verfasser:*],
author.name,
[*Bearbeitungszeitraum:*],
thesis.timeframe,
[*Matrikelnummer, Kurs:*], [*Matrikelnummer, Kurs:*],
str(author.matriculation-number) + ", " + author.course, str(author.matriculation-number) + ", " + author.course,
[*Ausbildungsbetrieb:*], author.company, [*Ausbildungsbetrieb:*],
[*Betrieblicher Betreuer:*], author.supervisor, author.company,
[*Abgabedatum:*], thesis.submission-date,
[*Betrieblicher Betreuer:*],
author.supervisor,
[*Abgabedatum:*],
thesis.submission-date
) )
] else if text.lang == "en" [ ] else if text.lang == "en" [
#table( #table(
@ -75,21 +85,30 @@
column-gutter: 1cm, column-gutter: 1cm,
align: left, align: left,
stroke: none, stroke: none,
[*Author:*], author.name,
[*Editing period:*], thesis.timeframe, [*Author:*],
author.name,
[*Editing period:*],
thesis.timeframe,
[*Matriculation number, course:*], [*Matriculation number, course:*],
str(author.matriculation-number) + ", " + author.course, str(author.matriculation-number) + ", " + author.course,
[*Training company:*], author.company, [*Training company:*],
[*Company supervisor:*], author.supervisor, author.company,
[*Submission date:*], thesis.submission-date,
[*Company supervisor:*],
author.supervisor,
[*Submission date:*],
thesis.submission-date
) )
] else [ ] else [
#context panic("no translation for language: ", text.lang) #context panic("no translation for language: ", text.lang)
] ]
#align( #align(bottom,
bottom,
grid( grid(
// set width of columns // set width of columns
// we need two, so make both half the page width // we need two, so make both half the page width
@ -102,8 +121,7 @@
#context panic("no translation for language: ", text.lang) #context panic("no translation for language: ", text.lang)
] ]
), ),
align(right, {line(length: 6cm)})), align(right, {line(length: 6cm)})))
)
#counter(page).update(0) #counter(page).update(0)
] ]

View File

@ -9,15 +9,14 @@
#import "branding.typ": * #import "branding.typ": *
#let watermark-color = luma(50%).transparentize(70%) #let watermark-color = luma(50%).transparentize(70%)
#let watermark(config) = if config.draft { #let watermark(config) = if config.draft {
rotate(-22.5deg)[ rotate(-22.5deg)[
#rect( #rect(
radius: 1em, radius: 1em,
inset: 1em, inset: 1em,
stroke: watermark-color, stroke: watermark-color)[
)[
#text(size: 4em, weight: "bold", fill: watermark-color, "DRAFT") #text(size: 4em, weight: "bold", fill: watermark-color, "DRAFT")
#linebreak() #linebreak()
#text(size: 1.25em, weight: "bold", fill: watermark-color)[ #text(size: 1.25em, weight: "bold", fill: watermark-color)[
@ -25,11 +24,7 @@
#linebreak() #linebreak()
document version. document version.
#linebreak() #linebreak()
#text( #text(size: 0.75em, "Further usage without the authors consent is not permitted.")]]]}
size: 0.75em,
"Further usage without the authors consent is not permitted.",
)]]]
}
// global style of document // global style of document
#let global_styled_doc(config, body) = { #let global_styled_doc(config, body) = {
@ -42,13 +37,11 @@
hyphenate: true, hyphenate: true,
dir: ltr, dir: ltr,
font: style.text.font, font: style.text.font,
fill: ABB-BLACK, fill: ABB-BLACK)
)
show heading: set text( show heading: set text(
font: style.heading.font, font: style.heading.font,
weight: "semibold", weight: "semibold")
)
set heading(supplement: [chapter]) set heading(supplement: [chapter])
@ -62,8 +55,7 @@
// set theme for code blocks // set theme for code blocks
set raw( set raw(
tab-size: style.code.tab-size, tab-size: style.code.tab-size,
theme: style.code.theme, theme: style.code.theme)
)
show raw: set text(font: style.code.font) show raw: set text(font: style.code.font)
show figure: set block(breakable: true) show figure: set block(breakable: true)
@ -75,20 +67,8 @@
stroke: (x, y) => ( stroke: (x, y) => (
left: none, left: none,
right: none, right: none,
top: if y == 0 { top: if y == 0 { 1.5pt } else if y < 2 { 1pt } else { 0pt },
1.5pt bottom: if y == 0 { 1pt } else { 1.5pt } ))
} else if y < 2 {
1pt
} else {
0pt
},
bottom: if y == 0 {
1pt
} else {
1.5pt
},
),
)
// make table header bold // make table header bold
show table.cell.where(y: 0): set text(weight: "bold") show table.cell.where(y: 0): set text(weight: "bold")
@ -97,8 +77,7 @@
set par( set par(
justify: true, justify: true,
first-line-indent: 1em, first-line-indent: 1em,
leading: 1em, leading: 1em)
)
// give links a color // give links a color
show link: set text(fill: style.link.color) show link: set text(fill: style.link.color)
@ -114,11 +93,10 @@
top: style.page.margin.top + style.header.logo-height + style.header.underline-top-padding + style.header.content-padding, top: style.page.margin.top + style.header.logo-height + style.header.underline-top-padding + style.header.content-padding,
bottom: style.page.margin.bottom + style.footer.content-padding, bottom: style.page.margin.bottom + style.footer.content-padding,
left: style.page.margin.left, left: style.page.margin.left,
right: style.page.margin.right, right: style.page.margin.right),
),
numbering: (..nums) => { numbering: (..nums) => {
let current-page = here().page() let current-page = here().page()
if current-page == 1 { if current-page == 1{
[] []
} else if query(<end-of-prelude>).first().location().page() > current-page { } else if query(<end-of-prelude>).first().location().page() > current-page {
numbering("I", nums.pos().first()) numbering("I", nums.pos().first())
@ -137,11 +115,7 @@
} else if query(<end-of-prelude>).first().location().page() > page-number { } else if query(<end-of-prelude>).first().location().page() > page-number {
numbering("I", page-counter) numbering("I", page-counter)
} else if query(<end-of-content>).first().location().page() >= page-number { } else if query(<end-of-content>).first().location().page() >= page-number {
numbering( numbering("1 / 1", page-counter, counter(page).at(<end-of-content>).last())
"1 / 1",
page-counter,
counter(page).at(<end-of-content>).last(),
)
} else { } else {
numbering("a", page-counter) numbering("a", page-counter)
} }
@ -160,18 +134,14 @@
align(right, image("res/DHBW.svg", height: style.header.logo-height))) align(right, image("res/DHBW.svg", height: style.header.logo-height)))
} else if query(<end-of-prelude>).first().location().page() <= here().page() { } else if query(<end-of-prelude>).first().location().page() <= here().page() {
let headers-before = query( let headers-before = query(selector(heading.where(numbering: "1.", level: 1)).before(here()))
selector(heading.where(numbering: "1.", level: 1)).before(here()),
)
let header-title = thesis.title let header-title = thesis.title
if headers-before.len() > 0 { if headers-before.len() > 0 {
header-title = headers-before.last().body header-title = headers-before.last().body
} else { } else {
let headers-after = query( let headers-after = query(selector(heading.where(numbering: "1.", level: 1)).after(here()))
selector(heading.where(numbering: "1.", level: 1)).after(here()),
)
if headers-after.len() > 0 { if headers-after.len() > 0 {
header-title = headers-after.first().body header-title = headers-after.first().body
@ -182,9 +152,8 @@
columns: (1fr, auto), columns: (1fr, auto),
align: (horizon, bottom), align: (horizon, bottom),
context [ _ #header-title _ ], context [ _ #header-title _ ],
image("res/DHBW.svg", height: style.header.logo-height), image("res/DHBW.svg", height: style.header.logo-height))
)
v(style.header.underline-top-padding - 1em) v(style.header.underline-top-padding - 1em)
line(length: 100%) line(length: 100%)
} else { } else {
@ -192,13 +161,12 @@
columns: (1fr, auto), columns: (1fr, auto),
align: (horizon, bottom), align: (horizon, bottom),
context [ _ #config.thesis.title _ ], context [ _ #config.thesis.title _ ],
image("res/DHBW.svg", height: style.header.logo-height), image("res/DHBW.svg", height: style.header.logo-height)
) )
v(style.header.underline-top-padding - 1em) v(style.header.underline-top-padding - 1em)
line(length: 100%) line(length: 100%)
} }
}, })
)
body body
} }