diff --git a/README.md b/README.md index c596760..c21876c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ +![HKA Logo](./template/logo/hka_horizontal.svg) + # Typst Template HKA -This is a thesis template written in [Typst](https://typst.app/), +This is a thesis template written in [Typst](https://typst.app/), based on the [template of the TU Munich](https://github.com/ls1intum/thesis-template-typst). ## Usage @@ -11,7 +13,7 @@ on the dashboard and searching for `unofficial-hka-thesis`. Locally, you can use the following command to start with this templates: ```bash -typst init @preview/unofficial-hka-thesis:1.0.0 +typst init @preview/unofficial-hka-thesis:1.0.2 ``` ### Features @@ -47,7 +49,7 @@ In the intranet you can download the official titlepage. As Typst is not able to Every header includes the heading of the current chapter, section or subsection. ![Current Subsection](assets/image.png) -If a new section or subsection starts at the current page this one is chosen. +If a new section or subsection starts at the current page this one is chosen. ![New Section](assets/image-1.png) If a new chapter starts at the current page, no header will be shown. @@ -63,4 +65,4 @@ Every footer is divided by a line from the main body. The footer contains the pa **Anything Missing?** Please [create an issue](https://github.com/AnsgarLichter/unofficial-hka-thesis/issues/new) or open a Pull Request right away. -**Have Questions?** Please [open a discussion](https://github.com/AnsgarLichter/unofficial-hka-thesis/discussions). \ No newline at end of file +**Have Questions?** Please [open a discussion](https://github.com/AnsgarLichter/unofficial-hka-thesis/discussions). diff --git a/assets/HKALogo.png b/assets/HKALogo.png deleted file mode 100644 index de443bc..0000000 Binary files a/assets/HKALogo.png and /dev/null differ diff --git a/assets/company.jpg b/assets/company.jpg deleted file mode 100644 index 57babb8..0000000 Binary files a/assets/company.jpg and /dev/null differ diff --git a/assets/company.svg b/assets/company.svg deleted file mode 100644 index 29b765e..0000000 --- a/assets/company.svg +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib.typ b/lib.typ index 495f9f9..cdb679b 100644 --- a/lib.typ +++ b/lib.typ @@ -1,5 +1,6 @@ #import "modules/titlepage.typ": * -#import "@preview/glossarium:0.5.1": print-glossary, register-glossary +#import "@preview/glossarium:0.5.9": print-glossary +#import "@preview/hydra:0.6.3": hydra #let in-outline = state("in-outline", false) #let flex-caption(long, short) = context { @@ -7,25 +8,27 @@ } #let preface( - settings: () + settings: (), + preface ) = { // Page Setup set page( margin: ( - left: settings.pageMargins.left, - right: settings.pageMargins.right, - top: settings.pageMargins.top, - bottom: settings.pageMargins.bottom + left: settings.page-margins.left, + right: settings.page-margins.right, + top: settings.page-margins.top, + bottom: settings.page-margins.bottom ), - numbering: "I", - number-align: center + header-ascent: 2%, + numbering: "i", + number-align: right ) counter(page).update(2) // Body Font Family set text( - font: settings.fontBody, - size: settings.fontBodySize, + font: settings.font-body, + size: settings.font-body-size, lang: "en" ) @@ -33,27 +36,29 @@ // Headings show heading: set block( - below: settings.headingsSpacing.below, - above: settings.headingsSpacing.above + below: settings.headings-spacing.below, + above: settings.headings-spacing.above ) - show heading: set text(font: settings.fontBody, size: settings.fontHeadingSize) + show heading: set text(font: settings.font-heading) + show heading.where(level: 1): set text(font: settings.font-heading, size: settings.font-heading-size) set heading(numbering: none) // Paragraphs - set par(leading: settings.distanceBetweenLines, justify: true) + set par(leading: settings.distance-between-lines, justify: true) // Figures - show figure: set text(size: settings.fontFiguresSubtitleSize) + show figure: set text(size: settings.font-figures-subtitle-size) //Indentation of Lists - set list(indent: settings.listIndentation) - set enum(indent: settings.listIndentation) + set list(indent: settings.list-indentation) + set enum(indent: settings.list-indentation) + + preface } #let listings( abbreviations: () ) = { - register-glossary(abbreviations) // Enable short captions to omit citations show outline: it => { in-outline.update(true) @@ -68,7 +73,7 @@ }, target: heading.where(supplement: [Chapter], outlined: true), - indent: true, + indent: auto, depth: 3 ) @@ -115,12 +120,12 @@ ) } -#let mainBody( +#let main-body( settings: (), body ) = { // Main Body - set heading(numbering: settings.headingsNumberingStyle, supplement: [Chapter]) + set heading(numbering: settings.headings-numbering-style, supplement: [Chapter]) show heading.where(level: 1): it => { if it.numbering == none { [ @@ -139,74 +144,39 @@ } set figure(numbering: it => { - let numberingOfHeading = counter(heading).display(); - let topLevelNumber = numberingOfHeading.slice(0, numberingOfHeading.position(".")) - [#topLevelNumber.#it] + let numbering-of-heading = counter(heading).display(); + let top-level-number = numbering-of-heading.slice(0, numbering-of-heading.position(".")) + [#top-level-number.#it] }) set page( // Header with current heading header: context { - let elements = query( - selector(heading.where(depth: 1)).after(here()) + grid(columns: (1fr, 1fr), + align(left, emph(hydra(1))), + align(right, emph(hydra(2))) ) - - // Don't show header if a new chapter is starting at the current page - if elements != () and elements.first().location().page() == here().page() and elements.first().depth == 1 { - return; + if hydra(1) != none { + line(length: 100%, stroke: 0.5pt, start: (0%, -1.8em)) } - - let displayHeading - let displayNumbering - let element - elements = query(selector(heading).after(here())) - if elements != () and elements.first().location().page() == here().page() { - element = elements.first() - if element.has("numbering") and element.numbering != none { - displayNumbering = numbering(element.numbering, ..counter(heading).at(element.location())) - } else { - displayNumbering = numbering(settings.headingsNumberingStyle, ..counter(heading).at(element.location())) - } - - displayHeading = element.body - } else { - // Otherwise take the next heading backwards - elements = query( - heading.where().before(here()) - ) - if elements != () { - element = elements.last() - if element.has("numbering") and element.numbering != none { - displayNumbering = numbering(element.numbering, ..counter(heading).at(element.location())) - } else { - displayNumbering = numbering(settings.headingsNumberingStyle, ..counter(heading).at(element.location())) - } - - displayHeading = element.body - } - } - - align(center, displayNumbering + " " + displayHeading) - line(length: 100%, stroke: (paint: gray)) }, // Footer with Page Numbering footer: context { - let currentPage = counter(page).display() - let finalPage = counter(page).final().first() + let current-page = counter(page).display() + let final-page = counter(page).final().first() - line(length: 100%, stroke: (paint: gray)) - align(center)[#currentPage / #finalPage] + align(right, current-page) } ) set page( - numbering: "1/1", + numbering: "1", number-align: center, ) counter(page).update(1) // Set after header and after all initial pages to just apply it to the acutal content - set par(spacing: settings.spaceBeforeParagraph) + set par(spacing: settings.space-before-paragraph, justify: true) // Actual Content body @@ -220,39 +190,39 @@ heading("Appendix", outlined: true, numbering: none) }, target: heading.where(supplement: [Appendix], outlined: true), - indent: true, + indent: auto, depth: 3 ) counter(heading).update(0) - set heading(numbering: "A.1.", supplement: [Appendix]) + set heading(numbering: "A.1", supplement: [Appendix]) show heading: it => { - let prefixedNumbering; + let prefixed-numbering; if it.level == 1 and it.numbering != none { - prefixedNumbering = [#it.supplement #counter(heading).display()] + prefixed-numbering = [#it.supplement #counter(heading).display()] } else if it.numbering != none { - prefixedNumbering = [#counter(heading).display()] + prefixed-numbering = [#counter(heading).display()] } block( below: 0.85em, above: 1.75em )[ - #prefixedNumbering #it.body + #prefixed-numbering #it.body ] } set figure(numbering: it => { let alphabet = ("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z") - let numberingOfHeading = counter(heading).display(); - let topLevelNumber = numberingOfHeading.slice(0, numberingOfHeading.position(".")) - let index = alphabet.position((el) => { el == topLevelNumber}) + let numbering-of-heading = counter(heading).display(); + let top-level-number = numbering-of-heading.slice(0, numbering-of-heading.position(".")) + let index = alphabet.position((el) => { el == top-level-number}) if index == none { - let numberingToAlphabet = numbering("A", int(topLevelNumber)) + let numberingToAlphabet = numbering("A", int(top-level-number)) [#numberingToAlphabet.#it] } else { - [#topLevelNumber.#it] + [#top-level-number.#it] } }) @@ -319,4 +289,4 @@ }).join()) } } -} \ No newline at end of file +} diff --git a/modules/titlepage.typ b/modules/titlepage.typ index b0bd1ee..7cb6448 100644 --- a/modules/titlepage.typ +++ b/modules/titlepage.typ @@ -1,4 +1,4 @@ -#let openTitlePage(settings: ()) = { +#let open-title-page(settings: ()) = { set page( paper: "a4", margin: (left: 30mm, right: 30mm, top: 40mm, bottom: 40mm), @@ -8,58 +8,58 @@ ) set text( - font: settings.fontBody, - size: settings.fontBodySize, + font: settings.font-body, + size: settings.font-body-size, lang: "en" ) set par(leading: 1em) } -#let finishTitlePage( +#let finish-title-page( settings: (), degree: "", program: "", title: "", subtitle: "", - titleGerman: "", - subtitleGerman: "", + title-german: "", + subtitle-german: "", author: "", - matriculationNumber: "", - placeOfWork: "", + matriculation-number: "", + place-of-work: "", supervisor: "", advisor: "", - startDate: none, - submissionDate: none, + start-date: none, + submission-date: none, ) = { v(5mm) - align(center, text(font: settings.fontHeading, 1.9em, weight: 700, "University of Applied Sciences Karlsruhe")) + align(center, text(font: settings.font-heading, 1.9em, weight: 700, "University of Applied Sciences Karlsruhe")) v(15mm) - align(center, text(font: settings.fontHeading, 1.5em, weight: 100, degree + "’s Thesis in " + program)) + align(center, text(font: settings.font-heading, 1.5em, weight: 100, degree + "’s Thesis in " + program)) v(8mm) - if titleGerman.len() > 0 { - if subtitle.len() > 0 or subtitleGerman.len() > 0 { - align(center, text(font: settings.fontHeading, 1.2em, weight: 700, title)) - align(center, text(font: settings.fontHeading, 1.2em, weight: 500, subtitle)) + if title-german.len() > 0 { + if subtitle.len() > 0 or subtitle-german.len() > 0 { + align(center, text(font: settings.font-heading, 1.2em, weight: 700, title)) + align(center, text(font: settings.font-heading, 1.2em, weight: 500, subtitle)) v(10mm) - align(center, text(font: settings.fontHeading, 1.2em, weight: 700, titleGerman)) - align(center, text(font: settings.fontHeading, 1.2em, weight: 500, subtitleGerman)) + align(center, text(font: settings.font-heading, 1.2em, weight: 700, title-german)) + align(center, text(font: settings.font-heading, 1.2em, weight: 500, subtitle-german)) } else { - align(center, text(font: settings.fontHeading, 1.4em, weight: 700, title)) + align(center, text(font: settings.font-heading, 1.4em, weight: 700, title)) v(10mm) - align(center, text(font: settings.fontHeading, 1.4em, weight: 700, titleGerman)) + align(center, text(font: settings.font-heading, 1.4em, weight: 700, title-german)) } } else { if subtitle.len() > 0 { - align(center, text(font: settings.fontHeading, 1.8em, weight: 700, title)) + align(center, text(font: settings.font-heading, 1.8em, weight: 700, title)) v(5mm) - align(center, text(font: settings.fontHeading, 1.4em, weight: 500, subtitle)) + align(center, text(font: settings.font-heading, 1.4em, weight: 500, subtitle)) } else { - align(center, text(font: settings.fontHeading, 2.0em, weight: 700, title)) + align(center, text(font: settings.font-heading, 2.0em, weight: 700, title)) } } @@ -73,12 +73,12 @@ columns: (3fr, 3fr), gutter: 1em, strong("Author: "), author, - strong("Matriculation Number: "), matriculationNumber, - strong("Place of Work: "), placeOfWork, + strong("Matriculation Number: "), matriculation-number, + strong("Place of Work: "), place-of-work, strong("Supervisor: "), supervisor, strong("Advisor: "), advisor, - strong("Start Date: "), startDate, - strong("Submission Date: "), submissionDate, + strong("Start Date: "), start-date, + strong("Submission Date: "), submission-date, ) ) } else { @@ -90,11 +90,11 @@ columns: (3fr, 3fr), gutter: 1em, strong("Author: "), author, - strong("Matriculation Number: "), matriculationNumber, - strong("Place of Work: "), placeOfWork, + strong("Matriculation Number: "), matriculation-number, + strong("Place of Work: "), place-of-work, strong("Supervisor: "), supervisor, - strong("Start Date: "), startDate, - strong("Submission Date: "), submissionDate, + strong("Start Date: "), start-date, + strong("Submission Date: "), submission-date, ) ) } diff --git a/template/chapters/1_introduction.typ b/template/chapters/1_introduction.typ index 76a38b5..d47b236 100644 --- a/template/chapters/1_introduction.typ +++ b/template/chapters/1_introduction.typ @@ -1,6 +1,6 @@ -#import "@preview/unofficial-hka-thesis:1.0.0": todo, flex-caption -#import "@preview/glossarium:0.5.1": gls, glspl +#import "@preview/unofficial-hka-thesis:1.0.2": todo, flex-caption +#import "@preview/glossarium:0.5.9": gls, glspl = Introduction diff --git a/template/chapters/2_foundations.typ b/template/chapters/2_foundations.typ index e63c266..ec9a682 100644 --- a/template/chapters/2_foundations.typ +++ b/template/chapters/2_foundations.typ @@ -1,5 +1,5 @@ -#import "@preview/unofficial-hka-thesis:1.0.0": todo, flex-caption -#import "@preview/acrostiche:0.2.0": acr, acrpl +#import "@preview/unofficial-hka-thesis:1.0.2": todo, flex-caption +#import "@preview/acrostiche:0.6.0": acr, acrpl = Foundations diff --git a/template/logo/HKALogo.png b/template/logo/HKALogo.png deleted file mode 100644 index de443bc..0000000 Binary files a/template/logo/HKALogo.png and /dev/null differ diff --git a/template/logo/hka_horizontal.svg b/template/logo/hka_horizontal.svg new file mode 100644 index 0000000..330416a --- /dev/null +++ b/template/logo/hka_horizontal.svg @@ -0,0 +1,14 @@ + + + Hochschule Karlsruhe + Hochschule Karlsruhe - University of Applied Sciences + + + + + + + + + + diff --git a/template/logo/hka_text.svg b/template/logo/hka_text.svg new file mode 100644 index 0000000..94485fe --- /dev/null +++ b/template/logo/hka_text.svg @@ -0,0 +1,6 @@ + + + Hochschule Karlsruhe + Hochschule Karlsruhe - University of Applied Sciences + + diff --git a/template/logo/hka_vertikal.svg b/template/logo/hka_vertikal.svg new file mode 100644 index 0000000..6b6872d --- /dev/null +++ b/template/logo/hka_vertikal.svg @@ -0,0 +1,6 @@ + + + Hochschule Karlsruhe + Hochschule Karlsruhe + + diff --git a/template/settings/metadata.typ b/template/settings/metadata.typ index 811199d..f348bcf 100644 --- a/template/settings/metadata.typ +++ b/template/settings/metadata.typ @@ -1,15 +1,14 @@ #let degree = "Master" //Bachelor or Master #let program = "Computer Science" -#let titleEnglish = "Title English" -#let subtitleEnglish = "Subtitle English" -#let titleGerman = "Title German" -#let subtitleGerman = "Subtitle German" +#let title-english = "Title English" +#let subtitle-english = "Subtitle English" +#let title-german = "Title German" +#let subtitle-german = "Subtitle German" #let author = "Max Mustermann" -#let matriculationNumber = "12345" -#let placeOfWork = "ABC" +#let matriculation-number = "12345" +#let place-of-work = "ABC" #let supervisor = "Prof Dr. Max Mustermann" #let advisor = "Prof Dr. John Doe" -#let startDate = "01.03.2024" -#let submissionDate = "31.08.2024" -#let submissionDateExposé = "29.02.2024" +#let start-date = "01.03.2024" +#let submission-date = "31.08.2024" #let place = "Karlsruhe" \ No newline at end of file diff --git a/template/settings/settings.typ b/template/settings/settings.typ index 72be3b9..b58bc49 100644 --- a/template/settings/settings.typ +++ b/template/settings/settings.typ @@ -1,20 +1,20 @@ #let settings = ( - fontBody: "New Computer Modern", - fontBodySize: 12pt, - fontFiguresSubtitleSize: 0.85em, + font-body: "New Computer Modern", + font-body-size: 12pt, + font-figures-subtitle-size: 0.85em, // At the moment only used on the title page - fontHeading: "New Computer Modern Sans", - fontHeadingSize: 16pt, - headingsNumberingStyle: "1.1.", - headingsSpacing: ( + font-heading: "New Computer Modern Sans", + font-heading-size: 16pt, + headings-numbering-style: "1.1.", + headings-spacing: ( below: 0.85em, above: 1.75em ), - citationStyle: "ieee", - spaceBeforeParagraph: 24pt, - distanceBetweenLines: 1em, - listIndentation: 2.5em, - pageMargins: ( + citation-style: "ieee", + space-before-paragraph: 24pt, + distance-between-lines: 1em, + list-indentation: 2.5em, + page-margins: ( top: 4cm, bottom: 2.5cm, left: 2.5cm, diff --git a/template/supplementary/abstract.typ b/template/supplementary/abstract.typ index 5c6449a..8a1fe6a 100644 --- a/template/supplementary/abstract.typ +++ b/template/supplementary/abstract.typ @@ -1,4 +1,4 @@ -#import "@preview/unofficial-hka-thesis:1.0.0": todo, flex-caption +#import "@preview/unofficial-hka-thesis:1.0.2": todo, flex-caption #heading(outlined: false, numbering: none, "Abstract") diff --git a/template/supplementary/abstractGerman.typ b/template/supplementary/abstractGerman.typ index fca6805..f76f525 100644 --- a/template/supplementary/abstractGerman.typ +++ b/template/supplementary/abstractGerman.typ @@ -1,4 +1,4 @@ -#import "@preview/unofficial-hka-thesis:1.0.0": todo, flex-caption +#import "@preview/unofficial-hka-thesis:1.0.2": todo, flex-caption #heading(outlined: false, numbering: none, "Zusammenfassung") diff --git a/template/thesis.pdf b/template/thesis.pdf new file mode 100644 index 0000000..b191f73 Binary files /dev/null and b/template/thesis.pdf differ diff --git a/template/thesis.typ b/template/thesis.typ index 06b9c8b..1c2fe0e 100644 --- a/template/thesis.typ +++ b/template/thesis.typ @@ -1,43 +1,48 @@ -#import "@preview/unofficial-hka-thesis:1.0.0": * +#import "@preview/unofficial-hka-thesis:1.0.2": * #import "abbreviations.typ": abbreviations #import "settings/metadata.typ": * #import "settings/settings.typ": * -#import "@preview/glossarium:0.5.1": make-glossary +#import "@preview/glossarium:0.5.9": make-glossary, register-glossary #show: make-glossary +#register-glossary(abbreviations) -#set document(title: titleEnglish, author: author) -#openTitlePage(settings: settings) +#set document(title: title-english, author: author) +#open-title-page(settings: settings) // Customize your company logo or just use the one from the university #grid( - columns: (1fr, 1fr), + columns: (1fr, auto, 15pt, auto), align(left)[ #image("/logo/company.svg", height: 1.5cm) ], align(right)[ - #image("/logo/HKALogo.png", height: 2cm) + #image("/logo/hka_text.svg", height: 1.0cm) + ], + box(width: auto), + align(right)[ + #image("/logo/hka_horizontal.svg", height: 1.0cm) ] ) -#finishTitlePage( +#finish-title-page( settings: settings, degree: degree, program: program, - title: titleEnglish, - subtitle: subtitleEnglish, + title: title-english, + subtitle: subtitle-english, author: author, - matriculationNumber: matriculationNumber, - placeOfWork: placeOfWork, + matriculation-number: matriculation-number, + place-of-work: place-of-work, supervisor: supervisor, advisor: advisor, - startDate: startDate, - submissionDate: submissionDate, + start-date: start-date, + submission-date: submission-date, ) -#preface(settings: settings) +#show: preface.with(settings: settings) // Citations - applied here so that you are able to use a local CSL file to define the citation style -#set cite(style: settings.citationStyle) +#set cite(style: settings.citation-style) // Statutory Declaration #include "supplementary/statutoryDeclaration.typ" @@ -53,7 +58,7 @@ #listings(abbreviations: abbreviations) -#show: mainBody.with( +#show: main-body.with( settings: settings ) @@ -70,4 +75,4 @@ #include "chapters/A1_Material.typ" #include "chapters/A2_Transcripts.typ" -] \ No newline at end of file +] diff --git a/typst.toml b/typst.toml index 4cad9d7..741afe1 100644 --- a/typst.toml +++ b/typst.toml @@ -1,6 +1,6 @@ [package] name = "unofficial-hka-thesis" -version = "1.0.0" +version = "1.0.2" entrypoint = "lib.typ" authors = ["Ansgar Lichter "] license = "MIT"