From ccd8e89131c71b67b893da8e78f780c4b21f7d18 Mon Sep 17 00:00:00 2001 From: Sven Vogel Date: Fri, 5 Jul 2024 13:04:27 +0200 Subject: [PATCH] changed: layout and formatting added: source code header --- src/conf.typ | 16 +++++-- src/lib.typ | 28 ++++++------ src/pages/abstract.typ | 29 ++++++------ src/pages/appendix.typ | 7 +++ src/pages/confidentiality-statement.typ | 51 ++++++++++++--------- src/pages/declaration-of-authorship.typ | 60 ++++++++++++++---------- src/pages/outline.typ | 9 +++- src/pages/preface.typ | 7 +++ src/pages/prerelease-note.typ | 53 ++++++++++++--------- src/pages/titlepage.typ | 16 ++++--- src/requirements.typ | 9 ++++ src/res/ABB.svg | 15 +++++- src/res/DHBW.svg | 15 +++++- src/res/github.tmTheme | 11 +++++ src/style.typ | 61 ++++++++++++------------- template/main.typ | 53 +++++++++++---------- 16 files changed, 270 insertions(+), 170 deletions(-) diff --git a/src/conf.typ b/src/conf.typ index 455706f..2bb91e0 100644 --- a/src/conf.typ +++ b/src/conf.typ @@ -9,9 +9,13 @@ // default configuration #let default-config = ( - lang: "en", - region: "en", + // language settings used to make decisions about hyphenation and others + lang: "en", // ISO 3166 language code of text: "de", "en" + region: "en", // region code + // mark this thesis as draft + // Adds preleminarry note page and watermark draft: true, + // information about author(s) author: ( name: "Sven Vogel", semester: 4, @@ -22,12 +26,14 @@ company: "ABB AG", supervisor: "Benny Goodman", matriculation-number: 123456789), + // information about thesis thesis: ( title: "Unofficial ABB/DHBW Typst template", - subtitle: "for reports and thesises", + subtitle: "for reports and thesises", // subtitle may be none submission-date: "23rd march 2020", timeframe: "1st january 2020 - 20th march 2020", kind: "T2000", + // translated version of abstract, only used in case language is not english summary: none, abstract: none, preface: none, @@ -37,9 +43,11 @@ appendices: none), style: ( header: ( - bottom-padding: 1.5em, + content-padding: 1.5em, underline-top-padding: 0pt, logo-height: 3em), + footer: ( + content-padding: 1.5em), page: ( format: "a4", margin: ( diff --git a/src/lib.typ b/src/lib.typ index 87b5fcf..d2c165e 100644 --- a/src/lib.typ +++ b/src/lib.typ @@ -7,9 +7,6 @@ // Edited: 27.06.2024 // License: MIT -// start of template pages and styles -#let dhbw-template(config: dictionary, body) = [ - #import "conf.typ": validate-config #import "style.typ": global_styled_doc, content_styled, end_styled #import "pages/titlepage.typ": new_title_page @@ -21,18 +18,19 @@ #import "pages/preface.typ": new-preface #import "pages/appendix.typ": show-appendix +// start of template pages and styles +#let dhbw-template(config, body) = [ #let config = validate-config(config) - #let doc = body - // set document properties - #set document( - author: config.author.name, - keywords: config.thesis.keywords, - title: config.thesis.title) - // apply global style to every element in the argument content - #global_styled_doc(config: config, body: [ + #global_styled_doc(config)[ + + // set document properties + #set document( + author: config.author.name, + keywords: config.thesis.keywords, + title: config.thesis.title) // configure text locale #set text( @@ -72,11 +70,11 @@ // mark end of prelude #metadata("prelude terminate") - #content_styled(config: config, body: doc) + #content_styled(config, doc) #metadata("content terminate") - #end_styled(config: config, body: [ + #end_styled(config)[ // add bibliography if set #if "bibliography" in config.thesis and config.thesis.bibliography != none { pagebreak(weak: true) @@ -87,6 +85,6 @@ // appendix #show-appendix(config: config) - ]) - ]) + ] + ] ] \ No newline at end of file diff --git a/src/pages/abstract.typ b/src/pages/abstract.typ index 654f6b9..f2feb5a 100644 --- a/src/pages/abstract.typ +++ b/src/pages/abstract.typ @@ -6,23 +6,22 @@ // Edited: 28.06.2024 // License: MIT -#let new_abstract(config) = context [ +#let new_abstract(config) = context { - #pagebreak(weak: true) + set align(center + horizon) - #let thesis = config.thesis - - #pagebreak(weak: true) - #align(center + horizon)[ - #if text.lang == "de" [ - = Zusammenfassung - - #thesis.summary - ] - + // 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) - = Abstract - #thesis.abstract + = Zusammenfassung + #config.thesis.summary ] -] \ No newline at end of file + + // abstract is supposed to be on separate page + pagebreak(weak: true) + + heading("Abstract") + config.thesis.abstract +} \ No newline at end of file diff --git a/src/pages/appendix.typ b/src/pages/appendix.typ index 5359375..dca3987 100644 --- a/src/pages/appendix.typ +++ b/src/pages/appendix.typ @@ -1,3 +1,10 @@ +// .--------------------------------------------------------------------------. +// | Appendix | +// '--------------------------------------------------------------------------' + +// Author: Sven Vogel +// Edited: 28.06.2024 +// License: MIT #let show-appendix(config: dictionary) = context { counter(heading).update(0) diff --git a/src/pages/confidentiality-statement.typ b/src/pages/confidentiality-statement.typ index 2ee1d2b..4a85795 100644 --- a/src/pages/confidentiality-statement.typ +++ b/src/pages/confidentiality-statement.typ @@ -1,53 +1,62 @@ +// .--------------------------------------------------------------------------. +// | Confidentiality Statement | +// '--------------------------------------------------------------------------' -#let new_confidentiality_statement_page(config) = context [ +// Author: Sven Vogel +// Edited: 28.06.2024 +// License: MIT - #pagebreak(weak: true) +#let new_confidentiality_statement_page(config) = context { - #let thesis = config.thesis - #let author = config.author + pagebreak(weak: true) - #v(2em) - #if text.lang == "de" [ - #text(size: 20pt, weight: "semibold", font: "Montserrat", "Sperrvermerk") + let thesis = config.thesis + let author = config.author + + if text.lang == "de" [ + #heading(level: 1, "Sperrvermerk", supplement: [special]) ] else if text.lang == "en" [ - #text(size: 20pt, weight: "semibold", font: "Montserrat", "Confidentiality statement") + #heading(level: 1, "Confidentiality Statement", supplement: [special]) ] - #if text.lang == "de" [ + 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) - *#thesis.title* + text(weight: "bold", thesis.title) - #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" [ + 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. ] - #v(25%) + set align(horizon) - #grid( + grid( // set width of columns // we need two, so make both half the page width columns: (50%, 50%), row-gutter: 0.75em, align(left, {line(length: 6cm)}), 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" [ 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 81fb1ed..c2c3a42 100644 --- a/src/pages/declaration-of-authorship.typ +++ b/src/pages/declaration-of-authorship.typ @@ -1,52 +1,64 @@ +// .--------------------------------------------------------------------------. +// | Declaration of Authorship | +// '--------------------------------------------------------------------------' -#let new_declaration_of_authorship(config) = context [ +// Author: Sven Vogel +// Edited: 28.06.2024 +// License: MIT - #pagebreak(weak: true) +#let new_declaration_of_authorship(config) = context { - #let thesis = config.thesis - #let author = config.author + pagebreak(weak: true) - #v(2em) - #if text.lang == "de" [ - #text(size: 20pt, weight: "semibold", font: "Montserrat", "Selbständigkeitserklärung") + let thesis = config.thesis + let author = config.author + + if text.lang == "de" [ + #heading("Selbständigkeitserklärung") ] else if text.lang == "en" [ - #text(size: 20pt, weight: "semibold", font: "Montserrat", "Declaration of authorship") + #heading("Declaration of Authorship") ] - #v(1em) + v(1em) - #if text.lang == "de" [ + if text.lang == "de" [ Ich versichere hiermit, dass ich meine Prüfung mit dem Thema ] else if text.lang == "en" [ - I hereby certify that I have passed my examination with the subject + I hereby confirm that I have written this thesis with the subject ] - #v(1em) + v(1em) - #set align(center) + set align(center) - *#thesis.title* + text(weight: "bold", thesis.title) - #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) - 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. + 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. + ] - #v(25%) + set align(horizon) - #grid( + grid( // set width of columns // we need two, so make both half the page width columns: (50%, 50%), row-gutter: 0.75em, align(left, {line(length: 6cm)}), 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" [ 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 1bde5f3..328c17f 100644 --- a/src/pages/outline.typ +++ b/src/pages/outline.typ @@ -1,3 +1,10 @@ +// .--------------------------------------------------------------------------. +// | Document Outline | +// '--------------------------------------------------------------------------' + +// Author: Sven Vogel +// Edited: 28.06.2024 +// License: MIT // render an outline of figures // with a specific title and filter by a specifc kind of figure @@ -89,7 +96,7 @@ show outline.entry.where( level: 1, ): it => { - v(18pt, weak: true) + v(1.5em, weak: true) strong(it) } diff --git a/src/pages/preface.typ b/src/pages/preface.typ index 1575073..94474c8 100644 --- a/src/pages/preface.typ +++ b/src/pages/preface.typ @@ -1,3 +1,10 @@ +// .--------------------------------------------------------------------------. +// | Preface | +// '--------------------------------------------------------------------------' + +// Author: Sven Vogel +// Edited: 28.06.2024 +// License: MIT #let new-preface(config) = { if config.thesis.preface != none { diff --git a/src/pages/prerelease-note.typ b/src/pages/prerelease-note.typ index 3475346..86d79a0 100644 --- a/src/pages/prerelease-note.typ +++ b/src/pages/prerelease-note.typ @@ -1,47 +1,56 @@ +// .--------------------------------------------------------------------------. +// | Preleminary release Notice | +// '--------------------------------------------------------------------------' -#let new_prerelease_note(config) = context [ +// Author: Sven Vogel +// Edited: 28.06.2024 +// License: MIT - #pagebreak(weak: true) +#let new_prerelease_note(config) = context { - #let thesis = config.thesis - #let author = config.author + pagebreak(weak: true) - #v(2em) - #if text.lang == "de" [ - #text(size: 20pt, weight: "semibold", font: "Montserrat", "Vorabfassung") + let thesis = config.thesis + let author = config.author + + if text.lang == "de" [ + #heading("Vorabfassung") ] else if text.lang == "en" [ - #text(size: 20pt, weight: "semibold", font: "Montserrat", "Preliminary version") + #heading("Preliminary Version") ] - #v(1em) + v(1em) - #if text.lang == "de" [ + 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) - *#thesis.title* + text(weight: "bold", thesis.title) - #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" [ + 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 + v(1em) + h(1em) + [#author.name, #datetime.today().display()] +} \ No newline at end of file diff --git a/src/pages/titlepage.typ b/src/pages/titlepage.typ index 2561a31..d77268b 100644 --- a/src/pages/titlepage.typ +++ b/src/pages/titlepage.typ @@ -1,3 +1,10 @@ +// .--------------------------------------------------------------------------. +// | Titlepage | +// '--------------------------------------------------------------------------' + +// Author: Sven Vogel +// Edited: 28.06.2024 +// License: MIT #let new_title_page(config) = context [ @@ -45,7 +52,7 @@ #author.university ] - #set align(bottom + left) + #set align(horizon + left) #if text.lang == "de" [ #table( @@ -101,8 +108,7 @@ #context panic("no translation for language: ", text.lang) ] - #pad( - top: 1cm, + #align(bottom, grid( // set width of columns // we need two, so make both half the page width @@ -115,9 +121,7 @@ #context panic("no translation for language: ", text.lang) ] ), - align(right, {line(length: 6cm)}) - ) - ) + align(right, {line(length: 6cm)}))) #counter(page).update(0) ] diff --git a/src/requirements.typ b/src/requirements.typ index 4b9b2b3..cfb5a0a 100644 --- a/src/requirements.typ +++ b/src/requirements.typ @@ -1 +1,10 @@ + +// .--------------------------------------------------------------------------. +// | Required packages for template use | +// '--------------------------------------------------------------------------' + +// Author: Sven Vogel +// Edited: 05.07.2024 +// License: MIT + #import "@preview/glossarium:0.4.1": * \ No newline at end of file diff --git a/src/res/ABB.svg b/src/res/ABB.svg index 4f75516..3a58f0c 100644 --- a/src/res/ABB.svg +++ b/src/res/ABB.svg @@ -1,5 +1,18 @@ - + - + +