From 093ed09293a191b57c016ce562bab004d408f75c Mon Sep 17 00:00:00 2001 From: servostar Date: Tue, 27 Aug 2024 19:52:07 +0200 Subject: [PATCH] fixed format of template for (#13) --- src/glossarium.typ | 50 +++++--- src/pages/abstract.typ | 30 ++--- src/pages/appendix.typ | 58 ++++----- src/pages/confidentiality-statement.typ | 66 +++++----- src/pages/declaration-of-authorship.typ | 68 ++++++----- src/pages/outline.typ | 148 ++++++++++++----------- src/pages/prerelease-note.typ | 78 ++++++------ src/pages/titlepage.typ | 154 ++++++++++++------------ src/style.typ | 19 ++- 9 files changed, 358 insertions(+), 313 deletions(-) diff --git a/src/glossarium.typ b/src/glossarium.typ index 143e12d..522079d 100644 --- a/src/glossarium.typ +++ b/src/glossarium.typ @@ -129,7 +129,9 @@ SOFTWARE.*/ // show rule to make the references for glossarium #let make-glossary(body) = { show ref: r => { - if r.element != none and r.element.func() == figure and r.element.kind == __glossarium_figure { + if r.element != none and r.element.func() == figure and r + .element + .kind == __glossarium_figure { // call to the general citing function gls(str(r.target), suffix: r.citation.supplement) } else { @@ -200,25 +202,33 @@ SOFTWARE.*/ 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(", ") + 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(", ") } }, ) diff --git a/src/pages/abstract.typ b/src/pages/abstract.typ index 67e73a3..6da09e2 100644 --- a/src/pages/abstract.typ +++ b/src/pages/abstract.typ @@ -6,22 +6,24 @@ // Edited: 28.06.2024 // 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 - if text.lang == "de" [ - // Summary is supposed to be on separate page - #pagebreak(weak: true) + // only include summary when a language other than english is used + if text.lang == "de" [ + // Summary is supposed to be on separate page + #pagebreak(weak: true) - = Zusammenfassung - #config.thesis.summary - ] + = Zusammenfassung + #config.thesis.summary + ] - // abstract is supposed to be on separate page - pagebreak(weak: true) + // abstract is supposed to be on separate page + pagebreak(weak: true) - heading("Abstract") - config.thesis.abstract -} \ No newline at end of file + heading("Abstract") + config.thesis.abstract + } +) \ No newline at end of file diff --git a/src/pages/appendix.typ b/src/pages/appendix.typ index dca3987..09b33f4 100644 --- a/src/pages/appendix.typ +++ b/src/pages/appendix.typ @@ -6,37 +6,39 @@ // Edited: 28.06.2024 // License: MIT -#let show-appendix(config: dictionary) = context { - counter(heading).update(0) +#let show-appendix(config: dictionary) = ( + context { + counter(heading).update(0) - let title = if text.lang == "en" { - "Appendix" - } else { - "Anhang" - } - - if "appendices" in config.thesis { - pagebreak(weak: true) - - heading(level: 1, numbering: none, title) - v(-2em) - - // APA style appendix - show heading: it => { - let number = if it.numbering != none { - counter(heading).display(it.numbering) - } - block()[ - #title #number - #it.body - ] + let title = if text.lang == "en" { + "Appendix" + } else { + "Anhang" } - 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) + if "appendices" in config.thesis { + pagebreak(weak: true) - set heading(numbering: "A.1", supplement: title) + heading(level: 1, numbering: none, title) + v(-2em) - config.thesis.appendices + // APA style appendix + show heading: it => { + let number = if it.numbering != none { + counter(heading).display(it.numbering) + } + block()[ + #title #number - #it.body + ] + } + + 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) + + set heading(numbering: "A.1", supplement: title) + + config.thesis.appendices + } } -} +) diff --git a/src/pages/confidentiality-statement.typ b/src/pages/confidentiality-statement.typ index 4a85795..931479f 100644 --- a/src/pages/confidentiality-statement.typ +++ b/src/pages/confidentiality-statement.typ @@ -6,51 +6,52 @@ // Edited: 28.06.2024 // License: MIT -#let new_confidentiality_statement_page(config) = context { +#let new_confidentiality_statement_page(config) = ( + context { - pagebreak(weak: true) + pagebreak(weak: true) - let thesis = config.thesis - let author = config.author + let thesis = config.thesis + let author = config.author - if text.lang == "de" [ - #heading(level: 1, "Sperrvermerk", supplement: [special]) - ] else if text.lang == "en" [ - #heading(level: 1, "Confidentiality Statement", supplement: [special]) - ] + if text.lang == "de" [ + #heading(level: 1, "Sperrvermerk", supplement: [special]) + ] else if text.lang == "en" [ + #heading(level: 1, "Confidentiality Statement", supplement: [special]) + ] - if text.lang == "de" [ - Der Inhalt der dieser Arbeit mit dem Thema - ] else if text.lang == "en" [ - The content of this work with the topic - ] + if text.lang == "de" [ + Der Inhalt der dieser Arbeit mit dem Thema + ] else if text.lang == "en" [ + The content of this work with the topic + ] - v(1em) + v(1em) - set align(center) + set align(center) - text(weight: "bold", thesis.title) + text(weight: "bold", thesis.title) - if thesis.subtitle != none { - linebreak() - thesis.subtitle - } + if thesis.subtitle != none { + linebreak() + thesis.subtitle + } - set align(left) + set align(left) - v(1em) + v(1em) - set par(justify: true) + set par(justify: true) - if text.lang == "de" [ - darf weder als Ganzes noch in Auszügen Personen außerhalb des Prüfungsprozesses und des Evalua-tionsverfahrens zugänglich gemacht werden, sofern keine anderslautende Genehmigung der Ausbildungsstätte vorliegt. - ] else if text.lang == "en" [ - may not be made accessible to persons outside the examination process and the evaluation procedure, either as a whole or in excerpts, unless otherwise authorized by the training institution. - ] + if text.lang == "de" [ + darf weder als Ganzes noch in Auszügen Personen außerhalb des Prüfungsprozesses und des Evalua-tionsverfahrens zugänglich gemacht werden, sofern keine anderslautende Genehmigung der Ausbildungsstätte vorliegt. + ] else if text.lang == "en" [ + may not be made accessible to persons outside the examination process and the evaluation procedure, either as a whole or in excerpts, unless otherwise authorized by the training institution. + ] - set align(horizon) + set align(horizon) - grid( + grid( // set width of columns // we need two, so make both half the page width columns: (50%, 50%), @@ -59,4 +60,5 @@ align(left, {line(length: 6cm)}), align(left, if text.lang == "de" [ Ort, Datum ] else if text.lang == "en" [ Place, Date ] else { panic("no translation for language: ", text.lang) }), align(left, if text.lang == "de" [ Unterschrift ] else if text.lang == "en" [ Signature ] else { panic("no translation for language: ", text.lang) })) -} \ No newline at end of file + } +) \ No newline at end of file diff --git a/src/pages/declaration-of-authorship.typ b/src/pages/declaration-of-authorship.typ index c2c3a42..7f94b27 100644 --- a/src/pages/declaration-of-authorship.typ +++ b/src/pages/declaration-of-authorship.typ @@ -6,53 +6,54 @@ // Edited: 28.06.2024 // License: MIT -#let new_declaration_of_authorship(config) = context { +#let new_declaration_of_authorship(config) = ( + context { - pagebreak(weak: true) + pagebreak(weak: true) - let thesis = config.thesis - let author = config.author + let thesis = config.thesis + let author = config.author - if text.lang == "de" [ - #heading("Selbständigkeitserklärung") - ] else if text.lang == "en" [ - #heading("Declaration of Authorship") - ] + if text.lang == "de" [ + #heading("Selbständigkeitserklärung") + ] else if text.lang == "en" [ + #heading("Declaration of Authorship") + ] - v(1em) + v(1em) - if text.lang == "de" [ - Ich versichere hiermit, dass ich meine Prüfung mit dem Thema - ] else if text.lang == "en" [ - I hereby confirm that I have written this thesis with the subject - ] + if text.lang == "de" [ + Ich versichere hiermit, dass ich meine Prüfung mit dem Thema + ] else if text.lang == "en" [ + I hereby confirm that I have written this thesis with the subject + ] - v(1em) + v(1em) - set align(center) + set align(center) - text(weight: "bold", thesis.title) + text(weight: "bold", thesis.title) - if thesis.subtitle != none { - linebreak() - thesis.subtitle - } + if thesis.subtitle != none { + linebreak() + thesis.subtitle + } - set align(left) + set align(left) - v(1em) + v(1em) - set par(justify: true) + set par(justify: true) - if text.lang == "de" [ - selbständig verfasst und keine anderen als die angegebenen Quellen und Hilfsmittel benutzt habe. Ich versichere zudem, dass die eingereichte elektronische Fassung mit der gedruckten Fassung übereinstimmt. - ] else if text.lang == "en" [ - independently and have not used any sources or aids other than those specified. I also confirm that the electronic version submitted is identical to the printed version. - ] + if text.lang == "de" [ + selbständig verfasst und keine anderen als die angegebenen Quellen und Hilfsmittel benutzt habe. Ich versichere zudem, dass die eingereichte elektronische Fassung mit der gedruckten Fassung übereinstimmt. + ] else if text.lang == "en" [ + independently and have not used any sources or aids other than those specified. I also confirm that the electronic version submitted is identical to the printed version. + ] - set align(horizon) + set align(horizon) - grid( + grid( // set width of columns // we need two, so make both half the page width columns: (50%, 50%), @@ -61,4 +62,5 @@ align(left, {line(length: 6cm)}), align(left, if text.lang == "de" [ Ort, Datum ] else if text.lang == "en" [ Place, Date ] else { panic("no translation for language: ", text.lang) }), align(left, if text.lang == "de" [ Unterschrift ] else if text.lang == "en" [ Signature ] else { panic("no translation for language: ", text.lang) })) -} \ No newline at end of file + } +) \ No newline at end of file diff --git a/src/pages/outline.typ b/src/pages/outline.typ index e0b3d8d..8bbd03a 100644 --- a/src/pages/outline.typ +++ b/src/pages/outline.typ @@ -10,88 +10,100 @@ // 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 render_filtered_outline(title: str, kind: selector) = ( + context { - let elems = query(figure.where(kind: kind), here()) - let count = elems.len() + 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: title, - target: figure.where(kind: kind), - ) + // only show outline if there is something to list + if count > 0 { + pagebreak(weak: true) + outline( + title: 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( - target: heading.where(supplement: [chapter]), - title: title, - indent: auto, - ) -} - -#let render_appendix_outline() = context { - let supplement = if text.lang == "en" { - [Appendix] - } else { - [Anhang] - } - - if query(heading.where(supplement: supplement)).len() > 0 { +#let render_figures_outline() = ( + context { let title = if (text.lang == "de") { - "Anhangsverzeichnis" + "Abbildungsverzeichnis" } else if text.lang == "en" { - "Table of Appendices" + "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( - target: heading.where(supplement: supplement), + target: heading.where(supplement: [chapter]), title: title, indent: auto, ) } -} +) + +#let render_appendix_outline() = ( + context { + let supplement = if text.lang == "en" { + [Appendix] + } else { + [Anhang] + } + + if query(heading.where(supplement: supplement)).len() > 0 { + let title = if (text.lang == "de") { + "Anhangsverzeichnis" + } else if text.lang == "en" { + "Table of Appendices" + } + + pagebreak(weak: true) + outline( + target: heading.where(supplement: supplement), + title: title, + indent: auto, + ) + } + } +) #let new_outline() = { pagebreak(weak: true) diff --git a/src/pages/prerelease-note.typ b/src/pages/prerelease-note.typ index 86d79a0..eb73bf0 100644 --- a/src/pages/prerelease-note.typ +++ b/src/pages/prerelease-note.typ @@ -6,51 +6,53 @@ // Edited: 28.06.2024 // License: MIT -#let new_prerelease_note(config) = context { +#let new_prerelease_note(config) = ( + context { - pagebreak(weak: true) + pagebreak(weak: true) - let thesis = config.thesis - let author = config.author + let thesis = config.thesis + let author = config.author - if text.lang == "de" [ - #heading("Vorabfassung") - ] else if text.lang == "en" [ - #heading("Preliminary Version") - ] + if text.lang == "de" [ + #heading("Vorabfassung") + ] else if text.lang == "en" [ + #heading("Preliminary Version") + ] - v(1em) + v(1em) - if text.lang == "de" [ - Bei dieser Ausgabe der Arbeit mit dem Thema - ] else if text.lang == "en" [ - This edition of the work with the subject - ] + if text.lang == "de" [ + Bei dieser Ausgabe der Arbeit mit dem Thema + ] else if text.lang == "en" [ + This edition of the work with the subject + ] - v(1em) + v(1em) - set align(center) + set align(center) - text(weight: "bold", thesis.title) + text(weight: "bold", thesis.title) - if thesis.subtitle != none { - linebreak() - thesis.subtitle + if thesis.subtitle != none { + linebreak() + thesis.subtitle + } + + set align(left) + + v(1em) + + set par(justify: true) + + if text.lang == "de" [ + handelt es sich _nicht_ um die fertige Fassung. Das Dokument kann Inhaltliche-, Grammatikalische- sowie Format-Fehler enthalten. Das Dokument ist im Rahmen der Aufgabenstellung von Seiten der #author.university nicht zur Bewertung freigegeben und ein anderer Verwendungszweck als eine Vorschau ist nicht gestattet. + ] else if text.lang == "en" [ + is not the final version. The document may contain errors in content, grammar and formatting. The document may not be released for evaluation to #author.university as part of the assignment, and any use other than a preview is not permitted. + ] + + v(1em) + h(1em) + [#author.name, #datetime.today().display()] } - - set align(left) - - v(1em) - - set par(justify: true) - - if text.lang == "de" [ - handelt es sich _nicht_ um die fertige Fassung. Das Dokument kann Inhaltliche-, Grammatikalische- sowie Format-Fehler enthalten. Das Dokument ist im Rahmen der Aufgabenstellung von Seiten der #author.university nicht zur Bewertung freigegeben und ein anderer Verwendungszweck als eine Vorschau ist nicht gestattet. - ] else if text.lang == "en" [ - is not the final version. The document may contain errors in content, grammar and formatting. The document may not be released for evaluation to #author.university as part of the assignment, and any use other than a preview is not permitted. - ] - - v(1em) - h(1em) - [#author.name, #datetime.today().display()] -} \ No newline at end of file +) \ No newline at end of file diff --git a/src/pages/titlepage.typ b/src/pages/titlepage.typ index d289053..138627a 100644 --- a/src/pages/titlepage.typ +++ b/src/pages/titlepage.typ @@ -6,91 +6,92 @@ // Edited: 28.06.2024 // License: MIT -#let new_title_page(config) = context [ +#let new_title_page(config) = ( + context [ - #let thesis = config.thesis - #let author = config.author + #let thesis = config.thesis + #let author = config.author - #set align(center) + #set align(center) - // title - #v(2cm) - #text(size: 2em, weight: "semibold", thesis.title) + // title + #v(2cm) + #text(size: 2em, weight: "semibold", thesis.title) - // subtitle - #text(size: 1.5em, thesis.subtitle) + // subtitle + #text(size: 1.5em, thesis.subtitle) - // type of paper - #v(1cm) - #text(size: 1.5em, weight: "bold", thesis.kind) + // type of paper + #v(1cm) + #text(size: 1.5em, weight: "bold", thesis.kind) + + // faculty + #pad(top: 0.5cm)[ + #if text.lang == "de" [ + Praxisphase des #author.semester Studienjahrs an der Fakultät für #author.faculty + #linebreak() + im Studiengang #author.program + ] else if text.lang == "en" [ + Practical phase of the #author.semester academic year at the Faculty of #author.faculty + #linebreak() + in the degree program #author.program + ] else [ + #context panic("no translation for language: ", text.lang) + ] + ] + + // university + #pad(top: 0.5cm)[ + #if text.lang == "de" [ + an der + ] else if text.lang == "en" [ + at + ] else [ + #context panic("no translation for language: ", text.lang) + ] + #linebreak() + #author.university + ] + + #set align(horizon + left) - // faculty - #pad(top: 0.5cm)[ #if text.lang == "de" [ - Praxisphase des #author.semester Studienjahrs an der Fakultät für #author.faculty - #linebreak() - im Studiengang #author.program + #table( + columns: 2, + column-gutter: 1cm, + align: left, + stroke: none, + [*Verfasser:*], author.name, + [*Bearbeitungszeitraum:*], thesis.timeframe, + [*Matrikelnummer, Kurs:*], + str(author.matriculation-number) + ", " + author.course, + + [*Ausbildungsbetrieb:*], author.company, + [*Betrieblicher Betreuer:*], author.supervisor, + [*Abgabedatum:*], thesis.submission-date, + ) ] else if text.lang == "en" [ - Practical phase of the #author.semester academic year at the Faculty of #author.faculty - #linebreak() - in the degree program #author.program + #table( + columns: 2, + column-gutter: 1cm, + align: left, + stroke: none, + [*Author:*], author.name, + [*Editing period:*], thesis.timeframe, + [*Matriculation number, course:*], + str(author.matriculation-number) + ", " + author.course, + + [*Training company:*], author.company, + [*Company supervisor:*], author.supervisor, + [*Submission date:*], thesis.submission-date, + ) ] else [ #context panic("no translation for language: ", text.lang) ] - ] - // university - #pad(top: 0.5cm)[ - #if text.lang == "de" [ - an der - ] else if text.lang == "en" [ - at - ] else [ - #context panic("no translation for language: ", text.lang) - ] - #linebreak() - #author.university - ] - - #set align(horizon + left) - - #if text.lang == "de" [ - #table( - columns: 2, - column-gutter: 1cm, - align: left, - stroke: none, - [*Verfasser:*], author.name, - [*Bearbeitungszeitraum:*], thesis.timeframe, - [*Matrikelnummer, Kurs:*], - str(author.matriculation-number) + ", " + author.course, - - [*Ausbildungsbetrieb:*], author.company, - [*Betrieblicher Betreuer:*], author.supervisor, - [*Abgabedatum:*], thesis.submission-date, - ) - ] else if text.lang == "en" [ - #table( - columns: 2, - column-gutter: 1cm, - align: left, - stroke: none, - [*Author:*], author.name, - [*Editing period:*], thesis.timeframe, - [*Matriculation number, course:*], - str(author.matriculation-number) + ", " + author.course, - - [*Training company:*], author.company, - [*Company supervisor:*], author.supervisor, - [*Submission date:*], thesis.submission-date, - ) - ] else [ - #context panic("no translation for language: ", text.lang) - ] - - #align( - bottom, - grid( + #align( + bottom, + grid( // set width of columns // we need two, so make both half the page width columns: (60%, 40%), @@ -103,7 +104,8 @@ ] ), align(right, {line(length: 6cm)})), - ) + ) - #counter(page).update(0) -] + #counter(page).update(0) + ] +) diff --git a/src/style.typ b/src/style.typ index 779e2ce..6543f89 100644 --- a/src/style.typ +++ b/src/style.typ @@ -111,7 +111,9 @@ header-ascent: style.header.content-padding, footer-descent: style.header.content-padding, margin: ( - 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, left: style.page.margin.left, right: style.page.margin.right, @@ -120,9 +122,15 @@ let current-page = here().page() if current-page == 1 { [] - } else if query().first().location().page() > current-page { + } else if query() + .first() + .location() + .page() > current-page { numbering("I", nums.pos().first()) - } else if query().first().location().page() >= current-page { + } else if query() + .first() + .location() + .page() >= current-page { numbering("1", nums.pos().first()) } else { numbering("a", nums.pos().first()) @@ -159,7 +167,10 @@ // right align logo of DHBW align(right, image("res/DHBW.svg", height: style.header.logo-height))) - } else if query().first().location().page() <= here().page() { + } else if query() + .first() + .location() + .page() <= here().page() { let headers-before = query( selector(heading.where(numbering: "1.", level: 1)).before(here()), )