feature/templae-rewrite #8

Merged
servostar merged 13 commits from feature/templae-rewrite into main 2024-07-01 18:21:30 +00:00
49 changed files with 2659 additions and 921 deletions

16
.gitea/workflows/ci.yml Normal file
View File

@ -0,0 +1,16 @@
name: Gitea Action for checking typst compilation
run-name: Performing Typst compilation
on: [push]
jobs:
run-ci-linux:
runs-on: ubuntu-latest
env:
TYPST_INSTALL: /usr/local
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install Typst CLI
run: curl -fsSL https://typst.community/typst-install/install.sh | sh
- name: Run CI
run: bash -c ./run-ci.sh

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 DHBW
Copyright (c) 2024 Sven Vogel
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

View File

@ -1,17 +1,9 @@
# Praxisbericht-Template-Typst
Tempalte für Praxisberichte, T100, T200, T3000 und Bechelor Arbeiten. Im Gegensatz zu https://git.montehaselino.de/DHBW/Praxisbericht-Template wird Typst und nicht LaTeX als typsetting sprache verwendet.
The template makes use of ABB and DHBW branding.
## Geplante Features:
- Inhaltsverzeichnis
- Quelltextverzeichnis
- Abbildungsverzechnis
- Tabellenverzeichnis
- Literaturverzeichnis
- Glossar
- Abkürzungsverzeichnis
- Ligratures in code blöcken
- Diagramme
- Literatur
- Fußnoten
- Anhang
## Format
All pages have a margin of 2.5cm between header/footer/content and the page border.
Header and footer do not overlap into this margin.
Bibliography is formated with the IEEE style. Appendecies make use of the APA style.

BIN
assets/thumbnail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -1,3 +0,0 @@
% Bibliography based on BibTeX
% format: https://www.bibtex.com/g/bibtex-format/
% possible entry types: https://www.bibtex.com/e/entry-types/

View File

@ -1,9 +0,0 @@
language: de
ligratures: true
hyphenate: true
paragraph-spacing: 1.5 # relative to line height
line-spacing: 0.75 # relative to line height
first-line-indent: 1 # in centimetres
font-size: 12 # in point
font-familty: "TeX Gyre Termes"

View File

@ -1,9 +0,0 @@
glossary:
# Example:
# - short: PLC
# long: Programmable Logic Controller
# desc: Industrial computer for controlling automation devices

View File

@ -1,30 +0,0 @@
autor: Sven Vogel
titel: Konfiguration & Integration von PROFINET
untertitel: für die AC500 SPS
typ: T2000
semester: 3
fakultät: Technik
studiengang: Informationstechnik
universität: DHBW Mannheim
matrikelnummer: 1191225
betrieb: ABB AG
betreuer: Florian Miedniak
abgabe: 20. März 2024
bearbeitungszeitraum: 1. Januar 2024 - 20. März 2024
stichwörter:
- informatik
- profinet
# Berechent automatisch die Wochen Anzahl
# Start- und Endzeit müssen im Format dd-mm-yyyy sein.
arbeits-pakete:
- thema: Konfiguration des Stacks
start: 08.01.2024
ende: 31.01.2024
- thema: Integration in die Laufzeit
start: 01.02.2024
ende: 01.03.2024
- thema: Testen und Evaluation
start: 04.03.2024
ende: 20.03.2024

15
run-ci.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
set -e
function abort() {
echo "test case `$1` has failed" 1>&2
exit 1
}
echo "Running tests..."
echo "Running test local-import..."
typst compile tests/local-import/main.typ --root . || abort "local-import"
echo "Tests completed successfully"

8
src/conf.typ Normal file
View File

@ -0,0 +1,8 @@
// .--------------------------------------------------------------------------.
// | Configuration |
// '--------------------------------------------------------------------------'
// Author: Sven Vogel
// Edited: 27.06.2024
// License: MIT

View File

@ -1,46 +0,0 @@
// ====================================================
//
// AUDITION OF WORK
//
// Author: Sven Vogel
// License: MIT
// Edited: 29.03.2024
//
// This file binds and styles pages about:
// - title
// - declaration of indipendence
// - confidential clause
// - gender note
// - working packages
// - abstract
// ====================================================
#import "../prelude.typ" as prelude
#set heading(numbering: none, supplement: [Heading])
#set page(numbering: "I.", footer: "")
#include "../pages/title.typ"
#include "../pages/declaration-of-indipendence.typ"
#include "../pages/confidential-clause.typ"
#set page(
binding: left,
header-ascent: 2em,
header: locate(loc => {
table(columns: (1fr, auto),
align: (left, right),
stroke: none,
inset: (top: 0pt, bottom: 0.5em, left: 0pt, right: 0pt),
text(size: prelude.to_pt(prelude.format.font-size), prelude.info.titel),
text(size: prelude.to_pt(prelude.format.font-size), counter(page).display("I.")),
table.hline()
)
}),
footer: ""
)
#include "../pages/gender-note.typ"
#include "../pages/working-packages.typ"
#include "../pages/abstract.typ"

View File

@ -1,39 +0,0 @@
// ====================================================
//
// BIBLIOGRAPHY
//
// Author: Sven Vogel
// License: MIT
// Edited: 29.03.2024
//
// This file binds and styles bibliography of this work
// ====================================================
#import "../prelude.typ" as prelude
#set heading(numbering: none)
// function for filtering out all heading which are not of level 1
#let filter_heading(heading) = {
heading.level == 1
}
#set page(
header: locate(loc => {
align(left, context [
#let current_heading = query(selector(heading).after(here())).filter(filter_heading).first()
#current_heading.body
])
v(-2em)
align(right, counter(page).display("1"))
v(-1em)
line(length: 100%)
}),
)
// load bibliography and add it to the document
#bibliography(
style: "ieee",
"../../conf/bibliography.bib"
)

View File

@ -1,149 +0,0 @@
// ====================================================
//
// OUTLINE
//
// Author: Sven Vogel
// License: MIT
// Edited: 29.03.2024
//
// This file binds and styles the outline of this document
// ====================================================
#import "../prelude.typ" as prelude
#set page(
binding: left,
header-ascent: 2em,
header: locate(loc => {
table(columns: (1fr, auto),
align: (left, right),
stroke: none,
inset: (top: 0pt, bottom: 0.5em, left: 0pt, right: 0pt),
text(size: prelude.to_pt(prelude.format.font-size), prelude.info.titel),
text(size: prelude.to_pt(prelude.format.font-size), counter(page).display("I.")),
table.hline()
)
}),
footer: ""
)
#set heading(supplement: [Heading])
#set page(numbering: "I.", footer: "")
#if prelude.format.language == "de" [
= Inhaltsverzeichnis
] else if prelude.format.language == "en" [
= Table of contents
] else [
#panic("no translation for language: ", prelude.format.language)
]
#par(first-line-indent: 0pt)[
#show outline.entry.where(
level: 1
): it => {
strong(it)
}
#outline(title: none, indent: auto, target: heading.where(supplement: [Heading]))
]
#pagebreak()
#if prelude.format.language == "de" [
= Abbildungsverzeichnis
] else if prelude.format.language == "en" [
= List of figures
] else [
#panic("no translation for language: ", prelude.format.language)
]
#outline(
title: none,
target: figure.where(kind: image),
)
#pagebreak()
#if prelude.format.language == "de" [
= Tabellensverzeichnis
] else if prelude.format.language == "en" [
= List of tables
] else [
#panic("no translation for language: ", prelude.format.language)
]
#outline(
title: none,
target: figure.where(kind: table),
)
#pagebreak()
#if prelude.format.language == "de" [
= Quelltextverzeichnis
] else if prelude.format.language == "en" [
= List of source code
] else [
#panic("no translation for language: ", prelude.format.language)
]
#outline(
title: none,
target: figure.where(kind: raw),
)
#pagebreak()
// for creating glossary
#import "@preview/glossarium:0.2.6": make-glossary, print-glossary, gls, glspl
#show: make-glossary
#if prelude.format.language == "de" [
= Glossar
] else if prelude.format.language == "en" [
= Glossary
] else [
#panic("no translation for language: ", prelude.format.language)
]
// read all entries from config file
#let glossary = yaml("../../conf/glossary.yaml")
// destination array
#let glossary_entries = ()
// parse YAML entries into correct format
#if glossary.glossary != none {
for entry in glossary.glossary {
let short = entry.at("short", default: none)
let long = entry.at("long", default: none)
let desc = entry.at("desc", default: none)
if short == none {
panic("Key of glossary term must be specified")
}
glossary_entries.push((key: short, short: short, long: long, desc: desc))
}
}
#print-glossary(glossary_entries)
#pagebreak()
#if prelude.format.language == "de" [
= Anhangsverzeichnis
] else if prelude.format.language == "en" [
= List of appendencies
] else [
#panic("no translation for language: ", prelude.format.language)
]
#outline(
title: none,
target: heading.where(supplement: [Appendix]),
)
// reset page counter
#counter(page).update(0)

View File

@ -1,34 +0,0 @@
// ====================================================
//
// PREFACE
//
// Author: Sven Vogel
// License: MIT
// Edited: 29.03.2024
//
// This file binds and styles the preface of this document
// ====================================================
#import "../prelude.typ" as prelude
#set heading(supplement: [Heading])
#set page(numbering: "I.", footer: "")
#set page(
binding: left,
header-ascent: 2em,
header: locate(loc => {
table(columns: (1fr, auto),
align: (left, right),
stroke: none,
inset: (top: 0pt, bottom: 0.5em, left: 0pt, right: 0pt),
text(size: prelude.to_pt(prelude.format.font-size), prelude.info.titel),
text(size: prelude.to_pt(prelude.format.font-size), counter(page).display("I.")),
table.hline()
)
}),
footer: ""
)
#include "../pages/preface.typ"

View File

@ -1,50 +0,0 @@
// general document information
#let format = yaml("../../conf/format.yaml")
#let TitleSize = 2
#let SubtitleSize = 1.5
#let LargetextSize = 1.25
#let to_em(x) = {
x * 1em
}
#let to_cm(x) = {
x * 1cm
}
#let to_pt(x) = {
x * 1pt
}
// titles are bold and twice the size of normal text
// also they are centered and not justified
#let title(x) = {
align(center, par(justify: false, text(weight: "regular", size: to_pt(format.font-size) * TitleSize)[#x]))
}
// subtitles are 1.5x the size of normal text
// also they are centered and not justified
#let subtitle(x) = {
par(justify: false, text(size: to_pt(format.font-size) * SubtitleSize)[#x])
}
#let largetext(x) = {
par(justify: false, text(size: to_pt(format.font-size) * LargetextSize)[#x])
}
#let signature = {
set align(bottom)
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, "Ort, Datum"),
align(left, "Unterschrift")
)
}

97
src/lib.typ Normal file
View File

@ -0,0 +1,97 @@
// .--------------------------------------------------------------------------.
// | Template of DHBW thesis |
// '--------------------------------------------------------------------------'
// Author: Sven Vogel
// Edited: 27.06.2024
// License: MIT
// start of template pages and styles
#let dhbw-template(config: dictionary, body) = [
#import "style.typ": global_styled_doc, content_styled, end_styled
#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: [
#import "pages/titlepage.typ": new_title_page
#import "pages/declaration-of-authorship.typ": new_declaration_of_authorship
#import "pages/confidentiality-statement.typ": new_confidentiality_statement_page
#import "pages/prerelease-note.typ": new_prerelease_note
#import "pages/outline.typ": new_outline
#import "pages/abstract.typ": new_abstract
#import "pages/appendix.typ": show-appendix
// configure text locale
#set text(lang: config.lang, region: config.region)
// preppend title page
#new_title_page(config)
// prelude includes: title, declaration of authorship, confidentiality statement, outline and abstract
// these will have roman page numbers
#pagebreak(weak: true)
#new_declaration_of_authorship(config)
#pagebreak(weak: true)
#new_confidentiality_statement_page(config)
#pagebreak(weak: true)
#new_prerelease_note(config)
#pagebreak(weak: true)
#new_abstract(config)
#pagebreak(weak: true)
#new_outline()
// glossary is built inline here because the links must be
// exposed to the entire document
#import "@preview/glossarium:0.4.1": make-glossary, print-glossary, gls, glspl
#show: make-glossary
#pagebreak(weak: true)
#if "glossary" in config.thesis and config.thesis.glossary != none {
heading(supplement: [outline], "Glossar")
print-glossary(config.thesis.glossary)
pagebreak(weak: true)
counter(page).update(1)
}
// mark end of prelude
#metadata("prelude terminate") <end-of-prelude>
#content_styled(config: config, body: [
// code of document follows here
#doc
])
#metadata("content terminate") <end-of-content>
#end_styled(config: config, body: [
// add bibliography if set
#if config.thesis.bibliography != none {
pagebreak(weak: true)
set bibliography(style: "ieee")
config.thesis.bibliography
counter(page).update(1)
}
// appendix
#show-appendix(config: config)
])
])
]

View File

@ -1,144 +0,0 @@
#import "prelude.typ" as prelude
// ------------------------------------------
// Set page geometry and PDF meta data
// ------------------------------------------
// set page geometry:
// paper format of A4
// top margin is 2cm (blank space) + 2em (header) + 1em (spacing)
#set page(
margin: (left: 3cm, right: 2cm, top: 2cm + 3em, bottom: 2cm),
paper: "a4",
)
// set PDF meta information
#set document(
title: prelude.info.titel,
author: prelude.info.autor,
keywords: prelude.info.stichwörter
)
// ------------------------------------------
// Configure fonts and headings
// ------------------------------------------
// set global text parameter
#set text(
font: prelude.format.font-familty,
size: prelude.to_pt(prelude.format.font-size),
ligatures: prelude.format.ligratures,
hyphenate: prelude.format.hyphenate,
alternates: false,
discretionary-ligatures: prelude.format.ligratures,
lang: prelude.format.language
)
// set the text properties of verbatim/raw text blocks
#show raw: set text(
font: "FiraCode Nerd Font",
size: prelude.to_pt(prelude.format.font-size),
ligatures: prelude.format.ligratures,
hyphenate: prelude.format.hyphenate,
alternates: false,
discretionary-ligatures: prelude.format.ligratures,
lang: prelude.format.language
)
#show heading.where(level: 1): set text(
font: prelude.format.font-familty,
size: prelude.to_pt(prelude.format.font-size) * 2,
ligatures: prelude.format.ligratures,
hyphenate: prelude.format.hyphenate,
alternates: false,
discretionary-ligatures: prelude.format.ligratures,
lang: prelude.format.language,
weight: "regular"
)
#show heading.where(level: 2): set text(
font: prelude.format.font-familty,
size: prelude.to_pt(prelude.format.font-size) * 1.5,
ligatures: prelude.format.ligratures,
hyphenate: prelude.format.hyphenate,
alternates: false,
discretionary-ligatures: prelude.format.ligratures,
lang: prelude.format.language,
weight: "regular"
)
#show heading.where(level: 3): set text(
font: prelude.format.font-familty,
size: prelude.to_pt(prelude.format.font-size) * 1.25,
ligatures: prelude.format.ligratures,
hyphenate: prelude.format.hyphenate,
alternates: false,
discretionary-ligatures: prelude.format.ligratures,
lang: prelude.format.language,
weight: "regular"
)
// ------------------------------------------
// Setup paragraphs
// ------------------------------------------
// use block element as paragraph
// set block settings for every paragraph
#show par: set block(
below: prelude.to_em(prelude.format.paragraph-spacing), // paragraph spacing
)
// set global paragraph settings
#set par(
leading: prelude.to_em(prelude.format.line-spacing),
justify: true,
first-line-indent: prelude.to_cm(prelude.format.first-line-indent)
)
// ------------------------------------------
// Start of content
// ------------------------------------------
#include "content/audition.typ"
#include "content/preface.typ"
#include "content/outline.typ"
#set heading(numbering: "1.")
// start numbering pages with numeric digits
#set page(numbering: "1.")
#let filter_heading(heading) = {
heading.level == 1
}
#set page(
binding: left,
header-ascent: 2em,
header: locate(loc => {
let current_heading = query(selector(heading).after(here())).filter(filter_heading).first()
let heading_depth = counter(heading).get().at(0) + 1
table(columns: (1fr, auto),
align: (left, right),
stroke: none,
inset: (top: 0pt, bottom: 0.5em, left: 0pt, right: 0pt),
text(size: prelude.to_pt(prelude.format.font-size))[#heading_depth #current_heading.body],
text(size: prelude.to_pt(prelude.format.font-size), counter(page).display("1")),
table.hline()
)
}),
footer: ""
)
#set heading(supplement: [Heading])
#include "pages/introduction.typ"
// ------------------------------------------
// Actual work pages follow here
// ------------------------------------------
#include "content/bibliography.typ"
#include "pages/appendix.typ"

View File

@ -1,17 +1,26 @@
#import "../prelude.typ" as prelude
// .--------------------------------------------------------------------------.
// | Abstract |
// '--------------------------------------------------------------------------'
= Abstract
// Author: Sven Vogel
// Edited: 28.06.2024
// License: MIT
// abstract text goes here
#let abstract = [
]
// summary text goes here
// and is only included if the language is set to german
#if prelude.format.language == "de" [
#let new_abstract(config) = context [
= Zusammenfassung
#let thesis = config.thesis
#pagebreak(weak: true)
#align(center + horizon)[
#if text.lang == "de" [
= Zusammenfassung
#thesis.summary
]
#pagebreak(weak: true)
= Abstract
#thesis.abstract
]
]

View File

@ -1,65 +1,35 @@
#import "../prelude.typ" as prelude
// ------------------------------------------
// Appendix setup
// ------------------------------------------
#let show-appendix(config: dictionary) = context {
counter(heading).update(0)
// function for filtering out all heading which are not of level 1
#let filter_heading(heading) = {
heading.level == 1
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
]
}
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
}
}
#set page(
binding: left,
header-ascent: 2em,
header: locate(loc => {
let current_heading = query(selector(heading).after(here())).filter(filter_heading).first()
table(columns: (1fr, auto),
align: (left, right),
stroke: none,
inset: (top: 0pt, bottom: 0.5em, left: 0pt, right: 0pt),
text(size: prelude.to_pt(prelude.format.font-size))[#current_heading.body],
text(size: prelude.to_pt(prelude.format.font-size), counter(page).display("1")),
table.hline()
)
}),
footer: ""
)
#set heading(numbering: none)
#if prelude.format.language == "de" [
= Anhang
] else if prelude.format.language == "en" [
= Appendix
] else [
#panic("no translation for language: ", prelude.format.language)
]
#set heading(numbering: "A.1")
// reset page counter
#counter(heading).update(1)
#let appendix(text) = [
#heading(
supplement: [Appendix],
level: 2,
numbering: "A.1",
)[#text]
<#text>
]
// ------------------------------------------
// Put your appendencies here and link them
// to correclty reference them in the document
// ------------------------------------------
// Example:
//
// #appendix([Titel])
//
// Some appendix content goes here
// Then reference it in the document:
// @Titel

View File

@ -1,31 +0,0 @@
#import "../prelude.typ" as prelude
// title
#if prelude.format.language == "de" [
= Sperrvermerk
] else if prelude.format.language == "en" [
= Confidential Clause
] else [
#panic("no translation for language: ", prelude.format.language)
]
#v(1cm)
#prelude.largetext()[
#if prelude.format.language == "de" [
Der Inhalt dieser Arbeit darf weder als Ganzes noch in
Auszügen Personen außerhalb des Prüfungsprozesses
und des Evaluationsverfahrens zugänglich gemacht werden,
sofern keine anders lautende Genehmigung der Ausbildungsstätte vorliegt.
] else if prelude.format.language == "en" [
The content of this thesis may not be made accessible
to persons outside the examination process and the evaluation procedure,
either in whole or in part, unless otherwise authorized by the institution.
] else [
#panic("no translation for language: ", prelude.format.language)
]
]
#prelude.signature
#pagebreak()

View File

@ -0,0 +1,51 @@
#let new_confidentiality_statement_page(config) = context [
#let thesis = config.thesis
#let author = config.author
#v(2em)
#if text.lang == "de" [
#text(size: 20pt, weight: "semibold", font: "Montserrat", "Sperrvermerk")
] else if text.lang == "en" [
#text(size: 20pt, weight: "semibold", font: "Montserrat", "Confidentiality statement")
]
#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)
#set align(center)
*#thesis.title*
#thesis.subtitle
#set align(left)
#v(1em)
#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.
]
#v(25%)
#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" [ Unterschrift ] else if text.lang == "en" [ Signature ] else { panic("no translation for language: ", text.lang) }))
]

View File

@ -0,0 +1,50 @@
#let new_declaration_of_authorship(config) = context [
#let thesis = config.thesis
#let author = config.author
#v(2em)
#if text.lang == "de" [
#text(size: 20pt, weight: "semibold", font: "Montserrat", "Selbständigkeitserklärung")
] else if text.lang == "en" [
#text(size: 20pt, weight: "semibold", font: "Montserrat", "Declaration of authorship")
]
#v(1em)
#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
]
#v(1em)
#set align(center)
*#thesis.title*
#thesis.subtitle
#set align(left)
#v(1em)
#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.
#v(25%)
#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" [ Unterschrift ] else if text.lang == "en" [ Signature ] else { panic("no translation for language: ", text.lang) }))
]

View File

@ -1,49 +0,0 @@
#import "../prelude.typ" as prelude
#set align(center)
// title
#if prelude.format.language == "de" [
= Selbständigkeitserklärung
] else if prelude.format.language == "en" [
= Declaration of independence
] else [
#panic("no translation for language: ", prelude.format.language)
]
#v(1cm)
#prelude.largetext()[
#if prelude.format.language == "de" [
Ich versichere hiermit, dass ich meine #linebreak() Prüfung mit dem Thema
] else if prelude.format.language == "en" [
I hereby certify that I have written my #linebreak() exam with the topic
] else [
#panic("no translation for language: ", prelude.format.language)
]
]
#v(1cm)
#prelude.title(prelude.info.titel)
// subtitle
#prelude.subtitle(prelude.info.untertitel)
#set align(left)
#v(1cm)
#prelude.largetext()[
#if prelude.format.language == "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 prelude.format.language == "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.
] else [
#panic("no translation for language: ", prelude.format.language)
]
]
#prelude.signature
#pagebreak()

View File

@ -1,23 +0,0 @@
#import "../prelude.typ" as prelude
// title
#if prelude.format.language == "de" [
= Gender-Hinweis
] else if prelude.format.language == "en" [
= Gender note
] else [
#panic("no translation for language: ", prelude.format.language)
]
#prelude.largetext()[
#if prelude.format.language == "de" [
Zur besseren Lesbarkeit wird in dieser Arbeit das generische Maskulinum verwendet.
Die in dieser Arbeit verwendeten Personenbezeichnungen beziehen sich, sofern nicht anders kenntlich gemacht, auf alle Geschlechter.
] else if prelude.format.language == "en" [
For better readability, the generic masculine is used in this work.
The personal designations used in this work refer to all genders, unless otherwise indicated.
] else [
#panic("no translation for language: ", prelude.format.language)
]
]

View File

@ -1,4 +0,0 @@
#import "../prelude.typ" as prelude
= Einleitung

103
src/pages/outline.typ Normal file
View File

@ -0,0 +1,103 @@
// render an outline of figures
// 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 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: heading(level: 3, 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: heading(level: 3, 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: heading(level: 3, title),
indent: auto)
}
}
#let new_outline() = {
show outline.entry.where(
level: 1,
): it => {
v(18pt, weak: true)
strong(it)
}
render_figures_outline()
render_table_outline()
render_raw_outline()
render_appendix_outline()
render_heading_outline()
}

View File

@ -1,10 +0,0 @@
#import "../prelude.typ" as prelude
= Vorwort
= Firmengeschichte
= Das Unternehmen ABB
= Abteilung

View File

@ -0,0 +1,45 @@
#let new_prerelease_note(config) = context [
#let thesis = config.thesis
#let author = config.author
#v(2em)
#if text.lang == "de" [
#text(size: 20pt, weight: "semibold", font: "Montserrat", "Vorabfassung")
] else if text.lang == "en" [
#text(size: 20pt, weight: "semibold", font: "Montserrat", "Preliminary version")
]
#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
]
#v(1em)
#set align(center)
*#thesis.title*
#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()
]

View File

@ -1,142 +0,0 @@
#import "../prelude.typ" as prelude
#let LogoHeight = 1.5cm
#set align(center)
// logo of ABB and DHBW
#grid(
// set width of columns
// we need two, so make both half the page width
columns: (50%, 50%),
// left align logo of ABB
align(left, image("../../res/svg/ABB.svg", height: LogoHeight)),
// right align logo of DHBW
align(right, image("../../res/svg/DHBW.svg", height: LogoHeight))
)
// title
#v(2cm)
#prelude.title(prelude.info.titel)
// subtitle
#prelude.subtitle(prelude.info.untertitel)
// type of paper
#v(1cm)
#prelude.largetext(prelude.info.typ)
// number of semester
#if prelude.format.language == "de" [
Praxisphase des #prelude.info.semester Studienjahrs
] else if prelude.format.language == "en" [
Practical phase of the #prelude.info.semester academic year
] else [
#panic("no translation for language: ", prelude.format.language)
]
// fakulty
#pad(top: 0.5cm)[
#if prelude.format.language == "de" [
an der Fakultät für #prelude.info.fakultät
#linebreak()
im Studiengang #prelude.info.studiengang
] else if prelude.format.language == "en" [
at the Faculty of #prelude.info.fakultät
#linebreak()
in the degree program #prelude.info.studiengang
] else [
#panic("no translation for language: ", prelude.format.language)
]
]
// university
#pad(top: 0.5cm)[
#if prelude.format.language == "de" [
an der
] else if prelude.format.language == "en" [
at
] else [
#panic("no translation for language: ", prelude.format.language)
]
#linebreak()
#prelude.info.universität
]
#set align(bottom + left)
#if prelude.format.language == "de" [
#table(
columns: 2,
column-gutter: 1cm,
align: left,
stroke: none,
"Verfasser:",
prelude.info.autor,
"Bearbeitungszeitraum:",
prelude.info.bearbeitungszeitraum,
"Matrikelnummer, Kurs:",
str(prelude.info.matrikelnummer) + ", " + prelude.info.studiengang,
"Ausbildungsbetrieb:",
prelude.info.betrieb,
"Betrieblicher Betreuer:",
prelude.info.betreuer,
"Abgabedatum:",
prelude.info.abgabe
)
] else if prelude.format.language == "en" [
#table(
columns: 2,
column-gutter: 1cm,
align: left,
stroke: none,
"Author:",
prelude.info.autor,
"Editing period:",
prelude.info.bearbeitungszeitraum,
"Matriculation number, course:",
str(prelude.info.matrikelnummer) + ", " + prelude.info.studiengang,
"Training company:",
prelude.info.betrieb,
"Company supervisor:",
prelude.info.betreuer,
"Submission date:",
prelude.info.abgabe
)
] else [
#panic("no translation for language: ", prelude.format.language)
]
#pad(
top: 1cm,
grid(
// set width of columns
// we need two, so make both half the page width
columns: (60%, 40%),
align(left, if prelude.format.language == "de" [
Unterschrift des betrieblichen Betreuers
] else if prelude.format.language == "en" [
Signature of the company supervisor
] else [
#panic("no translation for language: ", prelude.format.language)
]
),
align(right, {line(length: 6cm)})
)
)
#pagebreak()
#counter(page).update(1)

123
src/pages/titlepage.typ Normal file
View File

@ -0,0 +1,123 @@
#let new_title_page(config) = context [
#let thesis = config.thesis
#let author = config.author
#set align(center)
// title
#v(2cm)
#text(size: 2em, weight: "semibold", thesis.title)
// subtitle
#text(size: 1.5em, thesis.subtitle)
// 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(bottom + 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)
]
#pad(
top: 1cm,
grid(
// set width of columns
// we need two, so make both half the page width
columns: (60%, 40%),
align(left, if text.lang == "de" [
Unterschrift des betrieblichen Betreuers
] else if text.lang == "en" [
Signature of the company supervisor
] else [
#context panic("no translation for language: ", text.lang)
]
),
align(right, {line(length: 6cm)})
)
)
#counter(page).update(0)
]

View File

@ -1,51 +0,0 @@
#import "../prelude.typ" as prelude
// title
#if prelude.format.language == "de" [
= Übersicht Arbeitspakete
Folgende Tabelle zeigt die Aktivtäten welche im Zeitraum vom #prelude.info.bearbeitungszeitraum abgehandelt wurden.
] else if prelude.format.language == "en" [
= Work package overview
The following table shows the activities that were covered during the #prelude.info.processing period.
] else [
#panic("no translation for language: ", prelude.format.language)
]
#let table_align(col, row) = {
if row == 0 {
center
} else {
left
}
}
#figure(
kind: table,
caption: if prelude.format.language == "de" [
Übersicht Arbeitspakete
] else if prelude.format.language == "en" [
Work package overview
] else [
#panic("no translation for language: ", prelude.format.language)
],
table(
columns: (1fr, auto, auto),
align: table_align,
inset: 0.25cm,
[*Thema*], [*Zeitraum*], [*Dauer (Wochen)*],
..for packet in prelude.info.arbeits-pakete {
let start_split = packet.start.split(".")
let start = datetime(day: int(start_split.at(0)), month: int(start_split.at(1)), year: int(start_split.at(2)))
let end_split = packet.ende.split(".")
let end = datetime(day: int(end_split.at(0)), month: int(end_split.at(1)), year: int(end_split.at(2)))
let dur = end - start
(packet.thema, packet.start + " - " + packet.ende, str(calc.round(dur.weeks())))
}
)
)
#pagebreak()

View File

@ -1,9 +0,0 @@
// import extras
#import "extra/util.typ": title, subtitle, largetext, signature, to_cm, to_pt, to_em
// import document information
#let info = yaml("../conf/info.yaml")
// general document information
#let format = yaml("../conf/format.yaml")

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

1742
src/res/github.tmTheme Normal file

File diff suppressed because it is too large Load Diff

144
src/style.typ Normal file
View File

@ -0,0 +1,144 @@
// .--------------------------------------------------------------------------.
// | Global style of document |
// '--------------------------------------------------------------------------'
// Author: Sven Vogel
// Edited: 27.06.2024
// License: MIT
#let HeaderPaddingBottom = 1.5em
#let LogoHeight = 3em
#let HeaderUnderlinePaddingTop = 0pt
// global style of document
#let global_styled_doc(config: dictionary, body: content) = context [
#let thesis = config.thesis
// set page geometry
// paper format of A4
#set page(
paper: "a4",
margin: (left: 3cm, right: 2.5cm, top: 2.5cm, bottom: 2.5cm))
#set text(
size: 12pt,
ligatures: true,
hyphenate: true,
dir: ltr,
font: "Open Sans")
#show heading: set text(
font: "Montserrat",
weight: "semibold")
#set heading(supplement: [chapter])
// Set header spacing
#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 raw(tab-size: 4, theme: "res/github.tmTheme")
#show raw.where(block: true): code => {
show raw.line: line => {
text(fill: gray)[#line.number]
h(1em)
line.body
}
code
}
#set block(spacing: 2em)
#set par(
justify: true,
first-line-indent: 1em,
leading: 1em)
#show link: set text(fill: red.darken(15%))
#show ref: set text(fill: red.darken(15%))
#set heading(numbering: none)
#set page(
header-ascent: HeaderUnderlinePaddingTop + HeaderPaddingBottom,
footer-descent: 1em,
margin: (top: 2.5cm + LogoHeight + HeaderUnderlinePaddingTop + HeaderPaddingBottom, bottom: 2.5cm + 1em),
numbering: (..nums) => {
let current-page = here().page()
if current-page == 1{
[]
} else if query(<end-of-prelude>).first().location().page() > current-page {
numbering("I", nums.pos().first())
} else if query(<end-of-content>).first().location().page() >= current-page {
numbering("1 / 1", ..nums)
} else {
numbering("a", nums.pos().first())
}
},
header: context {
set align(left)
if here().page() == 1 {
// logo of ABB and DHBW
grid(
// set width of columns
// we need two, so make both half the page width
columns: (50%, 50%),
// left align logo of ABB
align(left, image("res/ABB.svg", height: LogoHeight)),
// right align logo of DHBW
align(right, image("res/DHBW.svg", height: LogoHeight)))
} else if query(<end-of-prelude>).first().location().page() <= here().page() {
let headers-before = query(selector(heading.where(numbering: "1.", level: 1)).before(here()))
let header-title = thesis.title
if headers-before.len() > 0 {
header-title = headers-before.last().body
} else {
let headers-after = query(selector(heading.where(numbering: "1.", level: 1)).after(here()))
if headers-after.len() > 0 {
header-title = headers-after.first().body
}
}
grid(
columns: (1fr, auto),
align: (horizon, bottom),
context [ _ #header-title _ ],
image("res/DHBW.svg", height: LogoHeight))
v(HeaderUnderlinePaddingTop - 1em)
line(length: 100%)
} else {
grid(
columns: (1fr, auto),
align: (horizon, bottom),
context [ _ #config.thesis.title _ ],
image("res/DHBW.svg", height: LogoHeight)
)
v(HeaderUnderlinePaddingTop - 1em)
line(length: 100%)
}
})
#body
]
#let content_styled(config: dictionary, body: content) = [
#set heading(numbering: "1.")
#let thesis = config.thesis
#body
]
#let end_styled(config: dictionary, body: content) = [
#set heading(numbering: "1.")
#let thesis = config.thesis
#body
]

12
template/abstract.typ Normal file
View File

@ -0,0 +1,12 @@
// English summary "abstract" is content of this block:
#let abstract = [
#lorem(100)
]
// Other languages abstract translation is content of this block:
// NOTE: An abstract is required in case the thesis is not written primarily in english
// if writing in english (and the language is set to "en") this can be let empty or set to none
#let summary = [
#lorem(100)
]

9
template/appendix.typ Normal file
View File

@ -0,0 +1,9 @@
= Raw data
#label("Anhang-A")
#lorem(50)
== More raw data
#lorem(50)

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

15
template/glossary.typ Normal file
View File

@ -0,0 +1,15 @@
#let glossary = (
(
key: "oidc",
short: "OIDC",
long: "OpenID Connect",
desc: [OpenID is an open standard and decentralized authentication protocol promoted by the non-profit #link("https://en.wikipedia.org/wiki/OpenID#OpenID_Foundation")[OpenID Foundation].]
),
(
key: "potato",
short: "potato",
plural: "potatoes",
desc: [#lorem(10)]
),
)

112
template/main.typ Normal file
View File

@ -0,0 +1,112 @@
#import "../src/lib.typ": dhbw-template
#import "glossary.typ": glossary
#import "abstract.typ": abstract, summary
#show: dhbw-template.with(
config: (
lang: "en",
region: "en",
author: (
name: "Sven Vogel",
semester: 4,
program: "Informationtechnology",
course: "TINF19IT1",
faculty: "Technik",
university: "DHBW Mannheim",
company: "ABB AG",
supervisor: "Benny Goodman",
matriculation-number: 123456789),
thesis: (
title: "Unofficial ABB/DHBW Typst template",
subtitle: "for reports and thesises",
submission-date: "23rd march 2020",
timeframe: "1st january 2020 - 20th march 2020",
kind: "T2000",
summary: summary,
abstract: abstract,
keywords: ( "IT", "other stuff" ),
bibliography: bibliography("refs.bib"),
glossary: glossary,
appendices: include "appendix.typ")))
#import "@preview/wrap-it:0.1.0": wrap-content
= Lorem Ipsum
#lorem(25)
@oidc
#lorem(100)
@Anhang-A
== Lorem Ipsum 2
#lorem(200)
@einstein
= Lorem Ipsum 3
#lorem(15)
$
angle.l a, b angle.r &= arrow(a) dot arrow(b) \
&= a_1 b_1 + a_2 b_2 + ... a_n b_n \
&= sum_(i=1)^n a_i b_i.
$
#lorem(140)
#wrap-content(
figure(image("assets/digitaldog.jpg", width: 200pt), caption: [ Some image caption ]),
lorem(200))
#figure(
table(
columns: 2,
"Hello", "World"),
caption: [ Some table ])
#pagebreak()
#figure(
```rust
use std::env;
use std::fs::OpenOptions;
use std::io::Write;
fn main() {
// Get the file path from the environment variable
let file_path = match env::var("OUTPUT_FILE") {
Ok(path) => path,
Err(_) => {
eprintln!("Error: OUTPUT_FILE environment variable is not set");
return;
}
};
// Open the file in append mode, create it if it doesn't exist
let mut file = match OpenOptions::new()
.append(true)
.create(true)
.open(&file_path)
{
Ok(file) => file,
Err(e) => {
eprintln!("Error opening file {}: {}", file_path, e);
return;
}
};
// Write "Hello, World" to the file
if let Err(e) = writeln!(file, "Hello, World") {
eprintln!("Error writing to file: {}", e);
} else {
println!("Successfully appended 'Hello, World' to {}", file_path);
}
}
```, caption: [Some code])
= Conclusion
#lorem(320)

12
template/refs.bib Normal file
View File

@ -0,0 +1,12 @@
@article{einstein,
author = "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]",
journal = "Annalen der Physik",
volume = "322",
number = "10",
pages = "891--921",
year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004",
keywords = "physics"
}

View File

@ -0,0 +1,29 @@
#import "../../src/lib.typ": dhbw-template
#show: dhbw-template.with(
config: (
lang: "en",
region: "en",
author: (
name: "Sven Vogel",
semester: 4,
program: "Informationtechnology",
course: "TINF19IT1",
faculty: "Technik",
university: "DHBW Mannheim",
company: "ABB AG",
supervisor: "Benny Goodman",
matriculation-number: 123456789),
thesis: (
title: "Unofficial ABB/DHBW Typst template",
subtitle: "for reports and thesises",
submission-date: "23rd march 2020",
timeframe: "1st january 2020 - 20th march 2020",
kind: "T2000",
summary: none,
abstract: none,
keywords: ( "IT", "other stuff" ),
bibliography: none,
glossary: none,
appendices: none)))

16
typst.toml Normal file
View File

@ -0,0 +1,16 @@
[package]
name = "dhbw-abb-typst-template"
version = "0.1.0"
entrypoint = "src/template.typ"
authors = ["Sven Vogel <sven.vogel1@de.abb.com>"]
license = "MIT"
description = "Unoffical typst DHBW/ABB template for use as thesis and report works"
repository = "https://git.montehaselino.de/DHBW/dhbw-abb-typst-template"
keywords = ["dhbw", "abb", "thesis"]
categories = ["paper", "thesis", "report"]
exclude = ["examples"]
[template]
path = "template"
entrypoint = "main.typ"
thumbnail = "assets/thumbnail.png"