diff --git a/README.md b/README.md index c21876c..c596760 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ -![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 @@ -13,7 +11,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.2 +typst init @preview/unofficial-hka-thesis:1.0.0 ``` ### Features @@ -49,7 +47,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. @@ -65,4 +63,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). +**Have Questions?** Please [open a discussion](https://github.com/AnsgarLichter/unofficial-hka-thesis/discussions). \ No newline at end of file diff --git a/assets/HKALogo.png b/assets/HKALogo.png new file mode 100644 index 0000000..de443bc Binary files /dev/null and b/assets/HKALogo.png differ diff --git a/assets/company.jpg b/assets/company.jpg new file mode 100644 index 0000000..57babb8 Binary files /dev/null and b/assets/company.jpg differ diff --git a/assets/company.svg b/assets/company.svg new file mode 100644 index 0000000..29b765e --- /dev/null +++ b/assets/company.svg @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib.typ b/lib.typ index cdb679b..495f9f9 100644 --- a/lib.typ +++ b/lib.typ @@ -1,6 +1,5 @@ #import "modules/titlepage.typ": * -#import "@preview/glossarium:0.5.9": print-glossary -#import "@preview/hydra:0.6.3": hydra +#import "@preview/glossarium:0.5.1": print-glossary, register-glossary #let in-outline = state("in-outline", false) #let flex-caption(long, short) = context { @@ -8,27 +7,25 @@ } #let preface( - settings: (), - preface + settings: () ) = { // Page Setup set page( margin: ( - left: settings.page-margins.left, - right: settings.page-margins.right, - top: settings.page-margins.top, - bottom: settings.page-margins.bottom + left: settings.pageMargins.left, + right: settings.pageMargins.right, + top: settings.pageMargins.top, + bottom: settings.pageMargins.bottom ), - header-ascent: 2%, - numbering: "i", - number-align: right + numbering: "I", + number-align: center ) counter(page).update(2) // Body Font Family set text( - font: settings.font-body, - size: settings.font-body-size, + font: settings.fontBody, + size: settings.fontBodySize, lang: "en" ) @@ -36,29 +33,27 @@ // Headings show heading: set block( - below: settings.headings-spacing.below, - above: settings.headings-spacing.above + below: settings.headingsSpacing.below, + above: settings.headingsSpacing.above ) - show heading: set text(font: settings.font-heading) - show heading.where(level: 1): set text(font: settings.font-heading, size: settings.font-heading-size) + show heading: set text(font: settings.fontBody, size: settings.fontHeadingSize) set heading(numbering: none) // Paragraphs - set par(leading: settings.distance-between-lines, justify: true) + set par(leading: settings.distanceBetweenLines, justify: true) // Figures - show figure: set text(size: settings.font-figures-subtitle-size) + show figure: set text(size: settings.fontFiguresSubtitleSize) //Indentation of Lists - set list(indent: settings.list-indentation) - set enum(indent: settings.list-indentation) - - preface + set list(indent: settings.listIndentation) + set enum(indent: settings.listIndentation) } #let listings( abbreviations: () ) = { + register-glossary(abbreviations) // Enable short captions to omit citations show outline: it => { in-outline.update(true) @@ -73,7 +68,7 @@ }, target: heading.where(supplement: [Chapter], outlined: true), - indent: auto, + indent: true, depth: 3 ) @@ -120,12 +115,12 @@ ) } -#let main-body( +#let mainBody( settings: (), body ) = { // Main Body - set heading(numbering: settings.headings-numbering-style, supplement: [Chapter]) + set heading(numbering: settings.headingsNumberingStyle, supplement: [Chapter]) show heading.where(level: 1): it => { if it.numbering == none { [ @@ -144,39 +139,74 @@ } set figure(numbering: 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] + let numberingOfHeading = counter(heading).display(); + let topLevelNumber = numberingOfHeading.slice(0, numberingOfHeading.position(".")) + [#topLevelNumber.#it] }) set page( // Header with current heading header: context { - grid(columns: (1fr, 1fr), - align(left, emph(hydra(1))), - align(right, emph(hydra(2))) + let elements = query( + selector(heading.where(depth: 1)).after(here()) ) - if hydra(1) != none { - line(length: 100%, stroke: 0.5pt, start: (0%, -1.8em)) + + // 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; } + + 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 current-page = counter(page).display() - let final-page = counter(page).final().first() + let currentPage = counter(page).display() + let finalPage = counter(page).final().first() - align(right, current-page) + line(length: 100%, stroke: (paint: gray)) + align(center)[#currentPage / #finalPage] } ) set page( - numbering: "1", + numbering: "1/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.space-before-paragraph, justify: true) + set par(spacing: settings.spaceBeforeParagraph) // Actual Content body @@ -190,39 +220,39 @@ heading("Appendix", outlined: true, numbering: none) }, target: heading.where(supplement: [Appendix], outlined: true), - indent: auto, + indent: true, depth: 3 ) counter(heading).update(0) - set heading(numbering: "A.1", supplement: [Appendix]) + set heading(numbering: "A.1.", supplement: [Appendix]) show heading: it => { - let prefixed-numbering; + let prefixedNumbering; if it.level == 1 and it.numbering != none { - prefixed-numbering = [#it.supplement #counter(heading).display()] + prefixedNumbering = [#it.supplement #counter(heading).display()] } else if it.numbering != none { - prefixed-numbering = [#counter(heading).display()] + prefixedNumbering = [#counter(heading).display()] } block( below: 0.85em, above: 1.75em )[ - #prefixed-numbering #it.body + #prefixedNumbering #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 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}) + let numberingOfHeading = counter(heading).display(); + let topLevelNumber = numberingOfHeading.slice(0, numberingOfHeading.position(".")) + let index = alphabet.position((el) => { el == topLevelNumber}) if index == none { - let numberingToAlphabet = numbering("A", int(top-level-number)) + let numberingToAlphabet = numbering("A", int(topLevelNumber)) [#numberingToAlphabet.#it] } else { - [#top-level-number.#it] + [#topLevelNumber.#it] } }) @@ -289,4 +319,4 @@ }).join()) } } -} +} \ No newline at end of file diff --git a/modules/titlepage.typ b/modules/titlepage.typ index 7cb6448..b0bd1ee 100644 --- a/modules/titlepage.typ +++ b/modules/titlepage.typ @@ -1,4 +1,4 @@ -#let open-title-page(settings: ()) = { +#let openTitlePage(settings: ()) = { set page( paper: "a4", margin: (left: 30mm, right: 30mm, top: 40mm, bottom: 40mm), @@ -8,58 +8,58 @@ ) set text( - font: settings.font-body, - size: settings.font-body-size, + font: settings.fontBody, + size: settings.fontBodySize, lang: "en" ) set par(leading: 1em) } -#let finish-title-page( +#let finishTitlePage( settings: (), degree: "", program: "", title: "", subtitle: "", - title-german: "", - subtitle-german: "", + titleGerman: "", + subtitleGerman: "", author: "", - matriculation-number: "", - place-of-work: "", + matriculationNumber: "", + placeOfWork: "", supervisor: "", advisor: "", - start-date: none, - submission-date: none, + startDate: none, + submissionDate: none, ) = { v(5mm) - align(center, text(font: settings.font-heading, 1.9em, weight: 700, "University of Applied Sciences Karlsruhe")) + align(center, text(font: settings.fontHeading, 1.9em, weight: 700, "University of Applied Sciences Karlsruhe")) v(15mm) - align(center, text(font: settings.font-heading, 1.5em, weight: 100, degree + "’s Thesis in " + program)) + align(center, text(font: settings.fontHeading, 1.5em, weight: 100, degree + "’s Thesis in " + program)) v(8mm) - 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)) + 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)) v(10mm) - 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)) + align(center, text(font: settings.fontHeading, 1.2em, weight: 700, titleGerman)) + align(center, text(font: settings.fontHeading, 1.2em, weight: 500, subtitleGerman)) } else { - align(center, text(font: settings.font-heading, 1.4em, weight: 700, title)) + align(center, text(font: settings.fontHeading, 1.4em, weight: 700, title)) v(10mm) - align(center, text(font: settings.font-heading, 1.4em, weight: 700, title-german)) + align(center, text(font: settings.fontHeading, 1.4em, weight: 700, titleGerman)) } } else { if subtitle.len() > 0 { - align(center, text(font: settings.font-heading, 1.8em, weight: 700, title)) + align(center, text(font: settings.fontHeading, 1.8em, weight: 700, title)) v(5mm) - align(center, text(font: settings.font-heading, 1.4em, weight: 500, subtitle)) + align(center, text(font: settings.fontHeading, 1.4em, weight: 500, subtitle)) } else { - align(center, text(font: settings.font-heading, 2.0em, weight: 700, title)) + align(center, text(font: settings.fontHeading, 2.0em, weight: 700, title)) } } @@ -73,12 +73,12 @@ columns: (3fr, 3fr), gutter: 1em, strong("Author: "), author, - strong("Matriculation Number: "), matriculation-number, - strong("Place of Work: "), place-of-work, + strong("Matriculation Number: "), matriculationNumber, + strong("Place of Work: "), placeOfWork, strong("Supervisor: "), supervisor, strong("Advisor: "), advisor, - strong("Start Date: "), start-date, - strong("Submission Date: "), submission-date, + strong("Start Date: "), startDate, + strong("Submission Date: "), submissionDate, ) ) } else { @@ -90,11 +90,11 @@ columns: (3fr, 3fr), gutter: 1em, strong("Author: "), author, - strong("Matriculation Number: "), matriculation-number, - strong("Place of Work: "), place-of-work, + strong("Matriculation Number: "), matriculationNumber, + strong("Place of Work: "), placeOfWork, strong("Supervisor: "), supervisor, - strong("Start Date: "), start-date, - strong("Submission Date: "), submission-date, + strong("Start Date: "), startDate, + strong("Submission Date: "), submissionDate, ) ) } diff --git a/template/chapters/1_introduction.typ b/template/chapters/1_introduction.typ index d47b236..76a38b5 100644 --- a/template/chapters/1_introduction.typ +++ b/template/chapters/1_introduction.typ @@ -1,6 +1,6 @@ -#import "@preview/unofficial-hka-thesis:1.0.2": todo, flex-caption -#import "@preview/glossarium:0.5.9": gls, glspl +#import "@preview/unofficial-hka-thesis:1.0.0": todo, flex-caption +#import "@preview/glossarium:0.5.1": gls, glspl = Introduction diff --git a/template/chapters/2_foundations.typ b/template/chapters/2_foundations.typ index ec9a682..e63c266 100644 --- a/template/chapters/2_foundations.typ +++ b/template/chapters/2_foundations.typ @@ -1,5 +1,5 @@ -#import "@preview/unofficial-hka-thesis:1.0.2": todo, flex-caption -#import "@preview/acrostiche:0.6.0": acr, acrpl +#import "@preview/unofficial-hka-thesis:1.0.0": todo, flex-caption +#import "@preview/acrostiche:0.2.0": acr, acrpl = Foundations diff --git a/template/logo/HKALogo.png b/template/logo/HKALogo.png new file mode 100644 index 0000000..de443bc Binary files /dev/null and b/template/logo/HKALogo.png differ diff --git a/template/logo/hka_horizontal.svg b/template/logo/hka_horizontal.svg deleted file mode 100644 index 330416a..0000000 --- a/template/logo/hka_horizontal.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - Hochschule Karlsruhe - Hochschule Karlsruhe - University of Applied Sciences - - - - - - - - - - diff --git a/template/logo/hka_text.svg b/template/logo/hka_text.svg deleted file mode 100644 index 94485fe..0000000 --- a/template/logo/hka_text.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - Hochschule Karlsruhe - Hochschule Karlsruhe - University of Applied Sciences - - diff --git a/template/logo/hka_vertikal.svg b/template/logo/hka_vertikal.svg deleted file mode 100644 index 6b6872d..0000000 --- a/template/logo/hka_vertikal.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - Hochschule Karlsruhe - Hochschule Karlsruhe - - diff --git a/template/settings/metadata.typ b/template/settings/metadata.typ index f348bcf..811199d 100644 --- a/template/settings/metadata.typ +++ b/template/settings/metadata.typ @@ -1,14 +1,15 @@ #let degree = "Master" //Bachelor or Master #let program = "Computer Science" -#let title-english = "Title English" -#let subtitle-english = "Subtitle English" -#let title-german = "Title German" -#let subtitle-german = "Subtitle German" +#let titleEnglish = "Title English" +#let subtitleEnglish = "Subtitle English" +#let titleGerman = "Title German" +#let subtitleGerman = "Subtitle German" #let author = "Max Mustermann" -#let matriculation-number = "12345" -#let place-of-work = "ABC" +#let matriculationNumber = "12345" +#let placeOfWork = "ABC" #let supervisor = "Prof Dr. Max Mustermann" #let advisor = "Prof Dr. John Doe" -#let start-date = "01.03.2024" -#let submission-date = "31.08.2024" +#let startDate = "01.03.2024" +#let submissionDate = "31.08.2024" +#let submissionDateExposé = "29.02.2024" #let place = "Karlsruhe" \ No newline at end of file diff --git a/template/settings/settings.typ b/template/settings/settings.typ index b58bc49..72be3b9 100644 --- a/template/settings/settings.typ +++ b/template/settings/settings.typ @@ -1,20 +1,20 @@ #let settings = ( - font-body: "New Computer Modern", - font-body-size: 12pt, - font-figures-subtitle-size: 0.85em, + fontBody: "New Computer Modern", + fontBodySize: 12pt, + fontFiguresSubtitleSize: 0.85em, // At the moment only used on the title page - font-heading: "New Computer Modern Sans", - font-heading-size: 16pt, - headings-numbering-style: "1.1.", - headings-spacing: ( + fontHeading: "New Computer Modern Sans", + fontHeadingSize: 16pt, + headingsNumberingStyle: "1.1.", + headingsSpacing: ( below: 0.85em, above: 1.75em ), - citation-style: "ieee", - space-before-paragraph: 24pt, - distance-between-lines: 1em, - list-indentation: 2.5em, - page-margins: ( + citationStyle: "ieee", + spaceBeforeParagraph: 24pt, + distanceBetweenLines: 1em, + listIndentation: 2.5em, + pageMargins: ( top: 4cm, bottom: 2.5cm, left: 2.5cm, diff --git a/template/supplementary/abstract.typ b/template/supplementary/abstract.typ index 8a1fe6a..5c6449a 100644 --- a/template/supplementary/abstract.typ +++ b/template/supplementary/abstract.typ @@ -1,4 +1,4 @@ -#import "@preview/unofficial-hka-thesis:1.0.2": todo, flex-caption +#import "@preview/unofficial-hka-thesis:1.0.0": todo, flex-caption #heading(outlined: false, numbering: none, "Abstract") diff --git a/template/supplementary/abstractGerman.typ b/template/supplementary/abstractGerman.typ index f76f525..fca6805 100644 --- a/template/supplementary/abstractGerman.typ +++ b/template/supplementary/abstractGerman.typ @@ -1,4 +1,4 @@ -#import "@preview/unofficial-hka-thesis:1.0.2": todo, flex-caption +#import "@preview/unofficial-hka-thesis:1.0.0": todo, flex-caption #heading(outlined: false, numbering: none, "Zusammenfassung") diff --git a/template/thesis.pdf b/template/thesis.pdf deleted file mode 100644 index b191f73..0000000 Binary files a/template/thesis.pdf and /dev/null differ diff --git a/template/thesis.typ b/template/thesis.typ index 1c2fe0e..06b9c8b 100644 --- a/template/thesis.typ +++ b/template/thesis.typ @@ -1,48 +1,43 @@ -#import "@preview/unofficial-hka-thesis:1.0.2": * +#import "@preview/unofficial-hka-thesis:1.0.0": * #import "abbreviations.typ": abbreviations #import "settings/metadata.typ": * #import "settings/settings.typ": * -#import "@preview/glossarium:0.5.9": make-glossary, register-glossary +#import "@preview/glossarium:0.5.1": make-glossary #show: make-glossary -#register-glossary(abbreviations) -#set document(title: title-english, author: author) -#open-title-page(settings: settings) +#set document(title: titleEnglish, author: author) +#openTitlePage(settings: settings) // Customize your company logo or just use the one from the university #grid( - columns: (1fr, auto, 15pt, auto), + columns: (1fr, 1fr), align(left)[ #image("/logo/company.svg", height: 1.5cm) ], align(right)[ - #image("/logo/hka_text.svg", height: 1.0cm) - ], - box(width: auto), - align(right)[ - #image("/logo/hka_horizontal.svg", height: 1.0cm) + #image("/logo/HKALogo.png", height: 2cm) ] ) -#finish-title-page( +#finishTitlePage( settings: settings, degree: degree, program: program, - title: title-english, - subtitle: subtitle-english, + title: titleEnglish, + subtitle: subtitleEnglish, author: author, - matriculation-number: matriculation-number, - place-of-work: place-of-work, + matriculationNumber: matriculationNumber, + placeOfWork: placeOfWork, supervisor: supervisor, advisor: advisor, - start-date: start-date, - submission-date: submission-date, + startDate: startDate, + submissionDate: submissionDate, ) -#show: preface.with(settings: settings) +#preface(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.citation-style) +#set cite(style: settings.citationStyle) // Statutory Declaration #include "supplementary/statutoryDeclaration.typ" @@ -58,7 +53,7 @@ #listings(abbreviations: abbreviations) -#show: main-body.with( +#show: mainBody.with( settings: settings ) @@ -75,4 +70,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 741afe1..4cad9d7 100644 --- a/typst.toml +++ b/typst.toml @@ -1,6 +1,6 @@ [package] name = "unofficial-hka-thesis" -version = "1.0.2" +version = "1.0.0" entrypoint = "lib.typ" authors = ["Ansgar Lichter "] license = "MIT"