diff --git a/examples/digitaldog.jpg b/examples/digitaldog.jpg new file mode 100644 index 0000000..2a9ec62 Binary files /dev/null and b/examples/digitaldog.jpg differ diff --git a/examples/lipsum.typ b/examples/lipsum.typ index 5baaa6e..3ada28d 100644 --- a/examples/lipsum.typ +++ b/examples/lipsum.typ @@ -5,4 +5,31 @@ = Lorem Ipsum -#lorem(50) +#lorem(25) + +#lorem(100) + +== Lorem Ipsum 2 + +#lorem(200) + += Lorem Ipsum 3 + +#lorem(15) + +$ integral_2^8 4x^2 $ + +#figure(image("digitaldog.jpg", height: 480pt), caption: [ Some image caption ]) + +#figure( + table( + columns: 2, + "Hello", "World"), + caption: [ Some table ]) + +#figure( + ```rust + fn main() -> { + + } + ```, caption: [Some code]) \ No newline at end of file diff --git a/src/pages/abstract.typ b/src/pages/abstract.typ new file mode 100644 index 0000000..5efd003 --- /dev/null +++ b/src/pages/abstract.typ @@ -0,0 +1,17 @@ + +#let new_abstract(thesis) = context [ + + #pagebreak(weak: true) + #align(center + horizon)[ + #if text.lang == "de" [ + = Zusammenfassung + + #thesis.summary + ] + + #pagebreak(weak: true) + = Abstract + + #thesis.abstract + ] +] \ No newline at end of file diff --git a/src/pages/confidentiality-statement.typ b/src/pages/confidentiality-statement.typ index 3e34690..d52f32e 100644 --- a/src/pages/confidentiality-statement.typ +++ b/src/pages/confidentiality-statement.typ @@ -3,7 +3,8 @@ thesis, author) = context [ - #if text.lang == "de" [ + #v(2em) + #if text.lang == "de" [ #text(size: 20pt, weight: "semibold", font: "Montserrat", "Sperrvermerk") ] else if text.lang == "en" [ #text(size: 20pt, weight: "semibold", font: "Montserrat", "Confidentiality statement") diff --git a/src/pages/declaration-of-authorship.typ b/src/pages/declaration-of-authorship.typ index 638f3a5..c9ba477 100644 --- a/src/pages/declaration-of-authorship.typ +++ b/src/pages/declaration-of-authorship.typ @@ -1,6 +1,7 @@ #let new_declaration_of_authorship(thesis, author) = context [ + #v(2em) #if text.lang == "de" [ #text(size: 20pt, weight: "semibold", font: "Montserrat", "Selbständigkeitserklärung") ] else if text.lang == "en" [ diff --git a/src/pages/outline.typ b/src/pages/outline.typ new file mode 100644 index 0000000..a7fd4ed --- /dev/null +++ b/src/pages/outline.typ @@ -0,0 +1,77 @@ + +// render an outline of figures +// with a specific title and filter by a specifc kind of figure +// can optionally insert a pagebreak after the outline +// NOTE: will not render in case the listing is empty +#let render_filtered_outline(title: str, kind: selector) = context { + let elems = query(figure.where(kind: kind), here()) + let count = elems.len() + + // only show outline if there is something to list + if count > 0 { + pagebreak(weak: true) + outline( + title: heading(level: 3, title), + target: figure.where(kind: kind)) + } +} + +#let render_figures_outline() = context { + let title = if (text.lang == "de") { + "Abbildungsverzeichnis" + } else if text.lang == "en" { + "List of Figures" + } + + render_filtered_outline(title: title, kind: image) +} + +#let render_table_outline() = context { + let title = if (text.lang == "de") { + "Tabellenverzeichnis" + } else if text.lang == "en" { + "List of Tables" + } + + render_filtered_outline(title: title, kind: table) +} + +#let render_raw_outline() = context { + let title = if (text.lang == "de") { + "Quelltextverzeichnis" + } else if text.lang == "en" { + "Code Snippets" + } + + render_filtered_outline(title: title, kind: raw) +} + +#let render_heading_outline() = context { + let title = if (text.lang == "de") { + "Inhaltsverzeichnis" + } else if text.lang == "en" { + "Table of Contents" + } + + pagebreak(weak: true) + outline( + title: heading(level: 3, title), + indent: auto) +} + +#let new_outline() = { + show outline.entry.where( + level: 1, + ): it => { + v(18pt, weak: true) + strong(it) + } + + render_figures_outline() + + render_table_outline() + + render_raw_outline() + + render_heading_outline() +} \ No newline at end of file diff --git a/src/pages/prerelease-note.typ b/src/pages/prerelease-note.typ index 35a683e..688a1b7 100644 --- a/src/pages/prerelease-note.typ +++ b/src/pages/prerelease-note.typ @@ -1,6 +1,7 @@ #let new_prerelease_note(thesis, author) = context [ + #v(2em) #if text.lang == "de" [ #text(size: 20pt, weight: "semibold", font: "Montserrat", "Vorabfassung") ] else if text.lang == "en" [ diff --git a/src/pages/titlepage.typ b/src/pages/titlepage.typ index 020ec56..8bb61eb 100644 --- a/src/pages/titlepage.typ +++ b/src/pages/titlepage.typ @@ -28,23 +28,14 @@ #v(1cm) #text(size: 1.5em, weight: "bold", thesis.kind) - // number of semester - #if text.lang == "de" [ - Praxisphase des #author.semester Studienjahrs - ] else if text.lang == "en" [ - Practical phase of the #author.semester academic year - ] else [ - #context panic("no translation for language: ", text.lang) - ] - // faculty #pad(top: 0.5cm)[ #if text.lang == "de" [ - an der Fakultät für #author.faculty + Praxisphase des #author.semester Studienjahrs an der Fakultät für #author.faculty #linebreak() im Studiengang #author.program ] else if text.lang == "en" [ - at the Faculty of #author.faculty + Practical phase of the #author.semester academic year at the Faculty of #author.faculty #linebreak() in the degree program #author.program ] else [ diff --git a/src/style.typ b/src/style.typ index a64fd3d..8020eb0 100644 --- a/src/style.typ +++ b/src/style.typ @@ -33,14 +33,20 @@ #set raw(tab-size: 4) + #set block(spacing: 2em) + #set par( + justify: true, + first-line-indent: 1em, + leading: 1em) + #doc ] -#let HeaderPaddingBottom = 3em +#let HeaderPaddingBottom = 1.5em #let LogoHeight = 3em -#let HeaderUnderlinePaddingTop = 8pt +#let HeaderUnderlinePaddingTop = 0pt -#let prelude_styled(doc: content, thesis) = context [ +#let prelude_styled(body: content, thesis) = context [ #set page( header-ascent: HeaderUnderlinePaddingTop + HeaderPaddingBottom, numbering: "I", @@ -56,5 +62,40 @@ #line(length: 100%) ]) - #doc + #body +] + +#let content_styled(body: content, thesis) = [ + #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 + + #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("pages/res/DHBW.svg", height: LogoHeight) + ) + #v(HeaderUnderlinePaddingTop - 1em) + #line(length: 100%) + ])[ + #body + ] ] diff --git a/src/template.typ b/src/template.typ index 9fb1736..6d1ac70 100644 --- a/src/template.typ +++ b/src/template.typ @@ -10,7 +10,7 @@ // start of template pages and styles #let dhbw-template(doc) = [ - #import "style.typ": global_styled_doc, prelude_styled + #import "style.typ": global_styled_doc, prelude_styled, content_styled // apply global style to every element in the argument content #global_styled_doc(doc: [ @@ -19,6 +19,8 @@ #import "pages/declaration-of-authorship.typ": new_declaration_of_authorship #import "pages/confidentiality-statement.typ": new_confidentiality_statement_page #import "pages/prerelease-note.typ": new_prerelease_note + #import "pages/outline.typ": new_outline + #import "pages/abstract.typ": new_abstract #set text(lang: "de", region: "de") @@ -39,21 +41,36 @@ subtitle: "für die AC500 SPS", submission-date: "20. März 2024", timeframe: "1. Januar 2023 - 20. März 2024", - kind: "T2000" + kind: "T2000", + summary: "", + abstract: "", ) // preppend title page #new_title_page(thesis, author) - #prelude_styled(thesis, doc: [ + #prelude_styled(thesis, body: [ + #pagebreak(weak: true) #new_declaration_of_authorship(thesis, author) - #pagebreak() + + #pagebreak(weak: true) #new_confidentiality_statement_page(thesis, author) - #pagebreak() + + #pagebreak(weak: true) #new_prerelease_note(thesis, author) + + #pagebreak(weak: true) + #new_outline() + + #pagebreak(weak: true) + #new_abstract(thesis) ]) - // code of document follows here - #doc + #content_styled(thesis, body: [ + // code of document follows here + #doc + ]) + + ]) ] \ No newline at end of file