initial version of template

This commit is contained in:
Laurenz 2023-12-13 17:58:37 +01:00
commit cd80eedd54
No known key found for this signature in database
GPG key ID: FF04836F2CF8C139
12 changed files with 714 additions and 0 deletions

10
README.md Normal file
View file

@ -0,0 +1,10 @@
# Typst template for faculty Technik at DHBW
As an example and guide how to use this template,
check out [this PDF document](./Template-Example-guide.pdf).
As you can see, it is obviously in english,
but feel free to translate it ;).
This is a adapted version of a template by [@satoqz](https://github.com/satoqz/).

BIN
Template-Example-guide.pdf Normal file

Binary file not shown.

2
abstract.typ Normal file
View file

@ -0,0 +1,2 @@
This is quite abstract...

2
acronyms.yml Normal file
View file

@ -0,0 +1,2 @@
HPE: Hewlett Packard Enterprise
JSON: JavaScript Object Notation

BIN
assets/dhbw.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
assets/hpe.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

88
assets/hpe.svg Normal file
View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="149.7mm" height="62.52mm" version="1.1" viewBox="0 0 530.5 221.5" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<title>Hewlett Packard Enterprise logo</title>
<metadata>
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title/>
</cc:Work>
</rdf:RDF>
</metadata>
<g transform="matrix(.3864 0 0 .3864 168.1 -110.2)">
<g transform="matrix(7.446 0 0 7.446 2805 -1839)">
<path d="m-375.9 299.5h-55.2v-10.23h55.2zm3.944-14.18h-63.09v18.12h63.09z" style="fill:#00b188"/>
<g transform="matrix(1.25 0 0 -1.25 -431.1 333.4)">
<path d="m0 0h-3.155v14.5h3.155v-5.728h5.637v5.728h3.155v-14.5h-3.155v6.007h-5.637v-6.007" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -414.1 325.4)">
<path d="m0 0h3.758c-0.07 1.066-0.51 1.809-1.74 1.809-0.928 0-1.74-0.395-2.018-1.809zm2.389-6.587c-3.201 0-5.381 2.018-5.381 5.333 0 3.225 2.134 5.451 4.964 5.451 3.085 0 4.616-2.064 4.616-5.149v-1.16h-6.588c0.372-1.599 1.624-2.016 2.877-2.016 1.09 0 1.878 0.231 2.852 0.835h0.117v-2.389c-0.835-0.604-2.019-0.905-3.457-0.905" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -395.6 325.8)">
<path d="m0 0-1.624-6.076h-2.76l-3.155 10.2v0.116h3.016l1.716-6.1 1.624 6.1h2.459l1.647-6.1 1.74 6.1h2.9v-0.116l-3.155-10.2h-2.761l-1.647 6.076" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -379.8 333.6)">
<path d="m0 0c-2.505 0-3.526 0.997-3.526 3.339v11.39h3.062v-11.18c0-0.719 0.278-0.974 0.881-0.974 0.209 0 0.511 0.069 0.696 0.139h0.047v-2.528c-0.255-0.092-0.696-0.185-1.16-0.185" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -373.5 325.4)">
<path d="m0 0h3.758c-0.07 1.066-0.51 1.809-1.74 1.809-0.927 0-1.74-0.395-2.018-1.809zm2.389-6.587c-3.201 0-5.381 2.018-5.381 5.333 0 3.225 2.134 5.451 4.964 5.451 3.085 0 4.616-2.064 4.616-5.149v-1.16h-6.588c0.371-1.599 1.624-2.016 2.876-2.016 1.091 0 1.879 0.231 2.854 0.835h0.116v-2.389c-0.835-0.604-2.018-0.905-3.457-0.905" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -349.5 320.5)">
<path d="m0 0h2.273v-2.458h-2.273v-4.198c0-0.905 0.348-1.323 1.276-1.323 0.255 0 0.58 0.024 0.928 0.14h0.069v-2.412c-0.394-0.14-0.997-0.301-1.878-0.301-2.483 0-3.457 1.136-3.457 3.757v4.337h-3.92v-4.198c0-0.905 0.348-1.323 1.275-1.323 0.256 0 0.581 0.024 0.929 0.14h0.069v-2.412c-0.394-0.14-0.998-0.301-1.878-0.301-2.483 0-3.457 1.136-3.457 3.757v4.337h-1.578v2.458h1.578v2.829h3.062v-2.829h3.92v2.829h3.062v-2.829" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -333.8 324.1)">
<path d="m0 0c1.602 0 2.366 0.904 2.366 2.203 0 1.346-0.764 2.25-2.366 2.25h-1.995v-4.453zm5.568 2.203c0-3.155-2.111-4.87-5.313-4.87h-2.25v-4.708h-3.153v14.5h5.403c3.202 0 5.313-1.716 5.313-4.917" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -318.4 329.3)">
<path d="m0 0v0.881c-0.464 0.254-1.066 0.347-1.693 0.347-0.997 0-1.6-0.37-1.6-1.205 0-0.859 0.603-1.23 1.507-1.23 0.858 0 1.508 0.441 1.786 1.207zm0.093-2.227c-0.673-0.812-1.669-1.206-2.738-1.206-2.017 0-3.665 1.228-3.665 3.41 0 2.017 1.648 3.362 4.013 3.362 0.742 0 1.509-0.116 2.297-0.347v0.184c0 1.114-0.626 1.6-2.272 1.6-1.045 0-2.042-0.3-2.901-0.788h-0.115v2.459c0.788 0.463 2.181 0.858 3.548 0.858 3.109 0 4.802-1.484 4.802-4.082v-6.47h-2.969v1.02" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -312.7 326.9)">
<path d="m0 0c0 3.317 2.344 5.404 5.406 5.404 1.09 0 2.11-0.232 2.876-0.788v-2.621h-0.117c-0.673 0.51-1.461 0.812-2.365 0.812-1.531 0-2.691-1.045-2.691-2.807s1.16-2.783 2.691-2.783c0.904 0 1.692 0.302 2.365 0.813h0.117v-2.621c-0.766-0.557-1.786-0.789-2.876-0.789-3.062 0-5.406 2.063-5.406 5.38" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -296.1 327.5)">
<path d="m0 0v-4.684h-3.061v14.5h3.061v-8.256l3.086 4.082h3.479v-0.116l-3.711-4.685 3.711-5.404v-0.116h-3.503l-3.062 4.684" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -279.3 329.3)">
<path d="m0 0v0.881c-0.463 0.254-1.067 0.347-1.693 0.347-0.997 0-1.6-0.37-1.6-1.205 0-0.859 0.603-1.23 1.506-1.23 0.86 0 1.509 0.441 1.787 1.207zm0.093-2.227c-0.673-0.812-1.671-1.206-2.737-1.206-2.019 0-3.665 1.228-3.665 3.41 0 2.017 1.646 3.362 4.014 3.362 0.742 0 1.506-0.116 2.295-0.347v0.184c0 1.114-0.626 1.6-2.273 1.6-1.043 0-2.042-0.3-2.9-0.788h-0.116v2.459c0.789 0.463 2.181 0.858 3.549 0.858 3.11 0 4.803-1.484 4.803-4.082v-6.47h-2.97v1.02" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -269 322.5)">
<path d="m0 0c0.556 1.137 1.369 1.786 2.506 1.786 0.417 0 0.834-0.093 0.995-0.186v-2.922h-0.115c-0.348 0.14-0.765 0.232-1.345 0.232-0.951 0-1.693-0.557-1.949-1.623v-5.938h-3.061v10.32h2.969v-1.67" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -254.5 329)">
<path d="m0 0v3.317c-0.51 0.742-1.182 1.066-1.949 1.066-1.344 0-2.249-0.975-2.249-2.737s0.905-2.713 2.249-2.713c0.767 0 1.439 0.325 1.949 1.067zm0.092-2.436c-0.649-0.835-1.67-1.298-3.061-1.298-2.645 0-4.338 2.411-4.338 5.38s1.693 5.404 4.338 5.404c1.345 0 2.319-0.418 2.969-1.183v5.125h3.062v-14.49h-2.97v1.066" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -435 339.3)">
<path d="m0 0h8.954v-1.762h-6.936v-4.429h6.286v-1.717h-6.286v-4.824h6.936v-1.762h-8.954v14.49" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -414.6 344.4)">
<path d="m0 0c2.296 0 3.572-1.508 3.572-3.988v-6.425h-1.925v6.378c0 1.322-0.673 2.273-2.134 2.273-1.206 0-2.227-0.766-2.575-1.855v-6.796h-1.925v10.2h1.925v-1.484c0.603 0.951 1.624 1.693 3.062 1.693" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -403.7 344.6)">
<path d="m0 0h2.621v-1.647h-2.621v-5.496c0-1.159 0.603-1.554 1.693-1.554 0.301 0 0.626 0.046 0.858 0.139h0.07v-1.646c-0.278-0.116-0.673-0.209-1.206-0.209-2.39 0-3.34 1.091-3.34 3.084v5.682h-1.763v1.647h1.763v2.712h1.925v-2.712" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -396.4 349.8)">
<path d="m0 0h5.08c-0.069 1.507-0.812 2.666-2.389 2.666-1.461 0-2.413-1.09-2.691-2.666zm3.039-6.309c-2.993 0-5.034 1.995-5.034 5.195 0 3.201 1.902 5.427 4.663 5.427 2.807 0 4.268-2.018 4.268-5.009v-0.882h-7.006c0.209-2.064 1.532-3.061 3.364-3.061 1.137 0 1.948 0.255 2.853 0.928h0.07v-1.694c-0.835-0.649-1.926-0.904-3.178-0.904" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -382.4 346.6)">
<path d="m0 0c0.441 1.09 1.416 1.739 2.528 1.739 0.442 0 0.836-0.069 0.998-0.162v-1.901h-0.069c-0.279 0.138-0.743 0.208-1.207 0.208-1.043 0-1.925-0.695-2.25-1.855v-6.656h-1.925v10.2h1.925v-1.577" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -370.3 355.5)">
<path d="m0 0c1.902 0 3.016 1.507 3.016 3.572 0 2.04-1.114 3.57-3.016 3.57-1.044 0-2.018-0.626-2.528-1.622v-3.921c0.51-0.996 1.484-1.599 2.528-1.599zm0.325 8.882c3.038 0 4.662-2.482 4.662-5.31 0-2.831-1.624-5.312-4.662-5.312-1.253 0-2.32 0.649-2.853 1.346v-5.057h-1.926v14.12h1.926v-1.159c0.533 0.719 1.6 1.368 2.853 1.368" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -358.8 346.6)">
<path d="m0 0c0.44 1.09 1.415 1.739 2.528 1.739 0.441 0 0.835-0.069 0.997-0.162v-1.901h-0.069c-0.278 0.138-0.742 0.208-1.206 0.208-1.044 0-1.925-0.695-2.25-1.855v-6.656h-1.925v10.2h1.925v-1.577" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -350.9 339.5)">
<path d="m0 0c0.673 0 1.229-0.533 1.229-1.206s-0.556-1.206-1.229-1.206c-0.649 0-1.23 0.533-1.23 1.206s0.581 1.206 1.23 1.206" style="fill:#040404"/>
</g>
<path d="m-352.1 357.4h2.408v-12.76h-2.408z" style="fill:#040404"/>
<g transform="matrix(1.25 0 0 -1.25 -341.1 349.9)">
<path d="m0 0c1.461-0.463 3.084-1.066 3.084-3.014 0-2.088-1.716-3.155-3.919-3.155-1.346 0-2.691 0.325-3.457 0.928v1.832h0.093c0.859-0.788 2.134-1.136 3.34-1.136 1.09 0 2.065 0.418 2.065 1.299 0 0.904-0.811 1.113-2.413 1.646-1.438 0.464-3.038 0.998-3.038 2.922 0 1.972 1.623 3.131 3.688 3.131 1.206 0 2.273-0.255 3.131-0.835v-1.856h-0.069c-0.834 0.673-1.81 1.068-3.016 1.068s-1.879-0.534-1.879-1.253c0-0.812 0.742-1.043 2.39-1.577" style="fill:#040404"/>
</g>
<g transform="matrix(1.25 0 0 -1.25 -332.7 349.8)">
<path d="m0 0h5.079c-0.069 1.507-0.811 2.666-2.389 2.666-1.461 0-2.412-1.09-2.69-2.666zm3.038-6.309c-2.992 0-5.033 1.995-5.033 5.195 0 3.201 1.902 5.427 4.662 5.427 2.808 0 4.268-2.018 4.268-5.009v-0.882h-7.005c0.209-2.064 1.531-3.061 3.363-3.061 1.138 0 1.949 0.255 2.853 0.928h0.07v-1.694c-0.834-0.649-1.925-0.904-3.178-0.904" style="fill:#040404"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.7 KiB

View file

@ -0,0 +1,96 @@
#import "../template.typ": *
Fist, in the `thesis.typ` file, adapt the configuration to match your requirements.
For further configuration, look in the upper part of the `template.typ` file,
e.g. to learn how to change the company name and logo.
Of cause, you may change other parts of the template to adapt it to your preferences.
Also, make sure to read the #link("https://typst.app/docs/")[Typst documentation].
This template is for english documents only (for now),
but one could translate it...
*Note* that the template needs to know your first chapter,
you can supply it if it is not "Introduction" using the `first_chapter_title` parameter.
#figure(```typ
#show: thesis.with(
...
first_chapter_title = "Introduction but with another title",
)
```, kind: "code", supplement: "Code example",
caption: [Code example explaining how to configure a different first chapter]
)
== Bibliography
As for bibliography / reference listing,
you may decide whether to use Hayagriva, a yaml-based format format designed for Typst
or BibTeX (`.bib`) format, which is well supported by other platforms since it is commonly used by LaTeX.
To switch between bibliography formats, change the above to the following:
#figure(```typ
#show: thesis.with(
...
bibliography_path = "literature.bib", // or literature.yml for Hayagriva
)
```, kind: "code", supplement: "Code example",
caption: [Code example on how to use different bibliography formats with this template]
)
== Proposed Structure
But of cause, you can do it as you like.
Put each chapter in the `chapter/` directory,
prefixed i.e. with `01-` if it is the first chapter.
I'd recommend using CamelCase or snake_case but not spaces.
Also, I would recommend deciding if to put the heading `= Introduction`
in these files or to the parent file.
You can include files using the following e.g:
```typ
#include ./chapters/01-example.typ
```
If your chapter gets too large for one file, create a subdirectory
in `chapters` with the chapters name,
and create files for the different sections.
== Acronyms
These are implemented provided by this template, not typst itself.
You can use them like:
```typ
#acro("HPE")
#acro("HPE", pref: true) // To prefer the long version
#acro("JSON", append: "-schemata")
```
+ #acro("HPE")
+ #acro("HPE", pref: true) // To prefer the long version
+ #acro("JSON", append: "-schemata")
== TODO marker
Well, if you are too lazy to write now,
just add a todo-marker.
```typ
#todo([Your #strike[excuse] notes on what change here])
```
For example:
#todo([I could probably write more on how to use this template and Typst in general, if I wouldn't be too lazy...])
And the template makes sure it is well readable in the PDF and not forgotten.
== Once you are done
Add a signature to your thesis.
Use the `signature` property.
Set it to `hide`, to leave some blank space for you to sign manually,
e.g. in a printed version.
Or put in the path to your signature image or svg.

2
literature.yml Normal file
View file

@ -0,0 +1,2 @@
# format: https://github.com/typst/hayagriva/blob/main/docs/file-format.md

463
template.typ Executable file
View file

@ -0,0 +1,463 @@
#let acronyms = yaml("acronyms.yml");
#let acroStates = state("acronymStates", ());
#let thesis(
// the title of your thesis
title: none,
// your name
author: none,
// your student id / matriculation number
student_id: none,
// the name of your course, such as "TINF21A"
course: none,
signature: none,
// the name of your supervisor
supervisor: none,
// the due date of your thesis
date: none,
// the time period that the work described in your thesis took place in
time_period: none,
// the type of your thesis, such as T1000, T2000, etc.
type: none,
// your degree, such as "Bachelor of Science"
degree: "Bachelor of Science",
// your major, such as "Computer Science"
major: "Computer Science",
// Details on your university
university: (
name: "Cooperative State University Baden-Württemberg",
location: "Stuttgart",
image: "assets/dhbw.png",
),
// Details on your company
company: (
name: "Hewlett Packard Enterprise",
image: "assets/hpe.png",
),
// Does the document require a Confidentiality Clause?
confidentiality_clause: false,
// Path to your bibliography file
// You may use `.yml` for Hayagriva format
// or `.bib` for BibLaTeX format
bibliography_path: "literature.yml",
// The contents of your abstract
abstract: include "./abstract.typ",
// First chapter of your thesis
// This is required to generate the content section correctly
first_chapter_title: "Introduction",
// set automatically by using the template via `#show: thesis.with(...)
body,
) = [
// Assert all parameters are set
#assert.ne(title, none)
#assert.ne(author, none)
#assert.ne(student_id, none)
#assert.ne(type, none)
#assert.ne(course, none)
#assert.ne(date, none)
#assert.ne(time_period, none)
#assert.ne(supervisor, none)
#set document(
title: title,
author: author,
)
#set page(
paper: "a4",
margin: 2.5cm,
numbering: none, // don't number the first pages, i.e. titlepage and abstract
)
// suggested font and font size by the DHBW style guide
#set text(
font: "Linux Libertine",
size: 12pt,
hyphenate: false,
lang: "en",
ligatures: true,
)
#set par(
leading: 8pt, // 1.5x line spacing
justify: true,
linebreaks: "optimized",
)
#set figure(
numbering: "I"
)
// don't outline or number the first headings
#set heading(
numbering: none,
outlined: false,
)
// modify the spacing between various headings and the content below them
#show heading: it => {
let sizes = if it.level == 1 {
(64pt, 24pt, 24pt)
} else if it.level == 2 {
(32pt, 20pt, 18pt)
} else {
(24pt, 16pt, 14pt)
}
[
#set text(size: sizes.at(2))
#v(sizes.at(0))
#if it.numbering != none [
#counter(heading).display(it.numbering) #h(4pt) #it.body
] else [#it.body]
#v(sizes.at(1))
]
}
// Alternative formating for headdings
// #show heading: it => {
// v(1em)
// if it.numbering != none {
// grid(
// columns: (auto, auto),
// {
// numbering(it.numbering, ..counter(heading).at(it.location()))
// h(24pt / it.level)
// },
// it.body,
// )
// } else {
// it.body
// }
// v(0.5em)
// }
// #show heading.where(level: 1): set text(size: 24pt)
// #show heading.where(level: 2): set text(size: 20pt)
// #show heading.where(level: 3): set text(size: 16pt)
// Style figure captions
#show figure : it => block(breakable: false)[
#v(15pt, weak: true)
#it.body
#align(center)[
// #v(.5em)
#block(width: 80%, text(size: .9em)[
#it.supplement #it.counter.display(it.numbering):
#emph(it.caption)
])
#v(15pt)
]
]
// rename level 1 headings to "Chapter", otherwise "Section"
#set ref(supplement: it => {
if it.func() == heading and it.level == 1 {
"Chapter"
} else {
"Section"
}
})
// beginning of the document, render the title page
#set align(center)
// nice
#grid(
columns: (1fr, 1fr),
align(center)[
#image(company.image, width: 69%)
],
align(center)[
#image(university.image, width: 69%)
],
)
#v(64pt)
#set par(justify: false)
#text(20pt)[*#title*]
#v(32pt)
#set par(justify: true)
#text(16pt)[*#type*]
#v(16pt)
#text(14pt)[for the]
#text(14pt)[*#degree*]
#text(14pt)[from the Course of Studies #major]
#v(32pt)
#text(14pt)[by]
#text(16pt)[*#author*]
#v(16pt)
#text(14pt)[#date]
#set align(bottom)
#grid(
columns: (1fr, 0.5fr, 1fr),
align(left)[
*Time Period* \
*Student ID, Course* \
*Company* \
*Supervisor in the Company*
],
none,
align(left)[
#time_period \
#student_id, #course \
#company.name \
#supervisor
],
)
#pagebreak()
#set align(top)
#set align(left)
// initially set the page numbering to roman
#set page(numbering: "I")
#counter(page).update(1)
// https://www.dhbw.de/fileadmin/user_upload/Dokumente/Broschueren_Handbuch_Betriebe/Infoblatt_Vertraulichkeit.pdf
#if confidentiality_clause [
== Confidentiality Clause
The content of this work may not be made accessible to people outside of the
testing process and the evaluation process neither as a whole nor as excerpts,
unless an authorization stating otherwise is presented by the training facility.
// #text(lang: "de")[
// Der Inhalt dieser Arbeit darf weder als Ganzes noch in Auszügen Personen außerhalb des
// Prüfungs- und des Evaluationsverfahrens zugänglich gemacht werden, sofern keine anders
// lautende Genehmigung des Dualen Partners vorliegt.
// ]
#pagebreak()
]
// render the abstract aligned to the center of the page
#set align(horizon)
#set align(center)
== Abstract
#block(width: 70%)[#abstract]
#pagebreak()
#set align(top)
#set align(start)
= Author's Declaration
Hereby I solemnly declare:
+ that this #type, titled #text(style: "italic")[#title] is entirely the product of my
own scholarly work, unless otherwise indicated in the text or references, or acknowledged below;
+ I have indicated the thoughts adopted directly or indirectly from other sources at the appropriate
places within the document;
+ this #type has not been submitted either in whole or part, for a degree at this or
any other university or institution;
+ I have not published this #type in the past;
// - the printed version is equivalent to the submitted one.
I am aware that a dishonest declaration will entail legal consequences.
#v(48pt)
#university.location, #date
// #v(48pt)
#box(width: 196pt, height: 40pt)[
#if signature == "hide" {
box(height: 50pt)
} else if signature == none {
[
Set your signature by setting the `signature` argument
to an image or set it to `hide`, to leave place for signing otherwise
#v(2pt)
]
} else {
image(signature)
}
#v(0pt, weak: true)
#line(length: 100%)
#author
]
#pagebreak()
= Contents
#locate(loc => {
let headings = query(heading, loc)
let before_content = true
let after_content = false
for elem in headings {
// kind of hacky, we track whether the main document has started by looking for a chapter by name
if elem.body == [#first_chapter_title] {
before_content = false
}
// similarly, track the end of the main content by the position of the "Bibliography" chapter
if elem.body == [Bibliography] {
after_content = true
}
// page numbers of the main document are arabic, the first pages are roman
let index_fmt = if before_content {
"I"
} else {
"1"
}
let location = elem.location()
let page_index = counter(page).at(location).at(0)
let formatted_index = numbering(index_fmt, page_index)
// only the main content should be numbered
let formatted_name = if before_content or after_content {
elem.body
} else [
#numbering("1.1", ..counter(heading).at(location))
#h(4pt)
#elem.body
]
let is_chapter = elem.level == 1
// indent headings in the table of contents based on their level
let indent = if is_chapter {
0pt
} else if elem.level == 2 {
2em
} else {
4em
}
// non-chapter headings have their line filled with dots
let spacer = if is_chapter { " " } else { " . " }
if elem.body != [Abstract] and elem.body != [Confidentiality Clause] {
link(
location,
[
#h(indent)
// add extra spacing between chapters
#if is_chapter {v(1pt)}
// chapters are bold, sections are not
#if is_chapter [*#formatted_name*] else [#formatted_name]
#box(width: 1fr, repeat(spacer))
#h(8pt)
#if is_chapter [*#formatted_index*] else [#formatted_index] \
],
)
}
}
})
// #outline(target: heading.)
// #show outline.entry.where(
// level: 1
// ): it => {
// v(12pt, weak: true)
// strong(it)
// }
// #outline(target: heading, depth: 3, indent: 2em, fill: repeat(" . "))
#pagebreak()
// start adding headings to the outline after the table of contents
#set heading(outlined: true)
// = List of Figures
#show outline.entry: it => [
#v(12pt, weak: true) #it
]
#outline(target: figure, title: "List of Figures", fill: repeat(" . "))
#pagebreak()
= Acronyms
#let acroArr = ();
#for (k, v) in acronyms.pairs().sorted(key: s => lower(s.at(0))) {
acroArr.push([*#k* #label(k)]);
acroArr.push([#v]);
}
#table(
columns: (1fr, 6fr),
align: horizon,
stroke: none,
..acroArr,
)
#pagebreak()
// update heading and page numberings to begin the main part of the document
#set heading(numbering: "1.1")
#set page(numbering: "1 / 1")
#counter(page).update(1)
// the actual chapters
#body
// finally, include the bibliography chapter at the end of the document
#pagebreak()
// #bibliography(bibliography_path, style: "ieee")
#bibliography(bibliography_path, style: "ieee")
]
#let acro(short, pref: false, append: "") = {
let item = acronyms.at(short)
locate(loc => {
let entries = acroStates.at(loc).filter(e => e == short);
if entries.len() > 0 {
if pref {
link(label(short))[#item#append]
} else {
link(label(short))[#short#append]
}
} else {
acroStates.update(e => {e.push(short); e;});
if pref {
link(label(short))[#item#append (#short)]
} else {
link(label(short))[#short#append (#item)]
}
}
});
}
#let acroOnce(main, inside) = [#main (#inside)]
#let todo(content) = par(emph([
#h(5pt) #text(weight: "bold")[To-do/WIP:] #content
]))

41
thesis.typ Executable file
View file

@ -0,0 +1,41 @@
#import "template.typ" : *
#show: thesis.with(
title: "Creating a Typst template",
author: "Your name",
type: "TX000",
student_id: "change-me",
course: "TINF2XA",
date: "00.00.2024",
time_period: "01.01.2023 - 00.00.2024",
supervisor: "Someone",
signature: none, // TODO
)
// NOTE: https://www.dhbw.de/fileadmin/user_upload/Dokumente/Dokumente_fuer_Studierende/191212_Leitlinien_Praxismodule_Studien_Bachelorarbeiten.pdf
// Requirements:
// - 25-35 pages without directories und attachments
// incl. graphics and tables
// - must document: task, process of implementation, solutions and results
// - proof that a connection between theoretical and practical was made
// and that the holy theory taught by the DHBW is of relevance
// - No
= Introduction
#include "./chapters/01-Introduction.typ"
#pagebreak()
= Technical Background
== Spell checking
You can use #link("https://github.com/crate-ci/typos")[Typos],
but I am too lazy to explain.
#pagebreak()
= Summary and Conclusion
#lorem(100)

10
typos.toml Normal file
View file

@ -0,0 +1,10 @@
[default.extend-words]
Mosquitto = "Mosquitto"
Hashi = "Hashi" # HashiCorp Vault
[files]
extend-exclude = [
"/template.typ",
"/images/"
]