Compare commits

...

3 Commits

Author SHA1 Message Date
Sven Vogel 5ec79a536d added: glossary 2024-06-28 15:52:45 +02:00
Sven Vogel 26f947a0d3 added: outline 2024-06-28 15:20:58 +02:00
Sven Vogel 381e8d5d42 added: prelude of document 2024-06-28 11:54:30 +02:00
11 changed files with 467 additions and 68 deletions

BIN
examples/digitaldog.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

View File

@ -5,4 +5,35 @@
= Lorem Ipsum
#lorem(50)
#lorem(25)
#lorem(100)
== Lorem Ipsum 2
#lorem(200)
= 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.
$
#figure(image("digitaldog.jpg", height: 480pt), caption: [ Some image caption ])
#figure(
table(
columns: 2,
"Hello", "World"),
caption: [ Some table ])
#figure(
```rust
fn main() -> {
}
```, caption: [Some code])

17
src/pages/abstract.typ Normal file
View File

@ -0,0 +1,17 @@
#let new_abstract(thesis) = context [
#pagebreak(weak: true)
#align(center + horizon)[
#if text.lang == "de" [
= Zusammenfassung
#thesis.summary
]
#pagebreak(weak: true)
= Abstract
#thesis.abstract
]
]

View File

@ -0,0 +1,50 @@
#let new_confidentiality_statement_page(
thesis,
author) = context [
#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,47 @@
#let new_declaration_of_authorship(thesis, author) = context [
#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) }))
]

7
src/pages/glossar.typ Normal file
View File

@ -0,0 +1,7 @@
#let new-glossar(glossary) = {
import "@preview/glossarium:0.4.1": make-glossary, print-glossary, gls, glspl
show: make-glossary
print-glossary(glossary)
}

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

@ -0,0 +1,77 @@
// 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(
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_heading_outline()
}

View File

@ -0,0 +1,42 @@
#let new_prerelease_note(thesis, author) = context [
#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 content, grammatical and format errors. The document is not released for evaluation by #author.university within the scope 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,5 +1,7 @@
#let new_title_page() = [
#let new_title_page(
thesis,
author) = context [
#let LogoHeight = 1.5cm
@ -11,113 +13,103 @@
// 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)),
align(left, image("res/ABB.svg", height: LogoHeight)),
// right align logo of DHBW
align(right, image("../../res/svg/DHBW.svg", height: LogoHeight))
)
align(right, image("res/DHBW.svg", height: LogoHeight)))
// title
#v(2cm)
#prelude.title(prelude.info.titel)
#text(size: 2em, weight: "semibold", thesis.title)
// subtitle
#prelude.subtitle(prelude.info.untertitel)
#text(size: 1.5em, thesis.subtitle)
// type of paper
#v(1cm)
#prelude.largetext(prelude.info.typ)
#text(size: 1.5em, weight: "bold", thesis.kind)
// 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
// faculty
#pad(top: 0.5cm)[
#if prelude.format.language == "de" [
an der Fakultät für #prelude.info.fakultät
#if text.lang == "de" [
Praxisphase des #author.semester Studienjahrs an der Fakultät für #author.faculty
#linebreak()
im Studiengang #prelude.info.studiengang
] else if prelude.format.language == "en" [
at the Faculty of #prelude.info.fakultät
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 #prelude.info.studiengang
in the degree program #author.program
] else [
#panic("no translation for language: ", prelude.format.language)
#context panic("no translation for language: ", text.lang)
]
]
// university
#pad(top: 0.5cm)[
#if prelude.format.language == "de" [
#if text.lang == "de" [
an der
] else if prelude.format.language == "en" [
] else if text.lang == "en" [
at
] else [
#panic("no translation for language: ", prelude.format.language)
#context panic("no translation for language: ", text.lang)
]
#linebreak()
#prelude.info.universität
#author.university
]
#set align(bottom + left)
#if prelude.format.language == "de" [
#if text.lang == "de" [
#table(
columns: 2,
column-gutter: 1cm,
align: left,
stroke: none,
"Verfasser:",
prelude.info.autor,
[*Verfasser:*],
author.name,
"Bearbeitungszeitraum:",
prelude.info.bearbeitungszeitraum,
[*Bearbeitungszeitraum:*],
thesis.timeframe,
"Matrikelnummer, Kurs:",
str(prelude.info.matrikelnummer) + ", " + prelude.info.studiengang,
[*Matrikelnummer, Kurs:*],
str(author.matriculation-number) + ", " + author.course,
"Ausbildungsbetrieb:",
prelude.info.betrieb,
[*Ausbildungsbetrieb:*],
author.company,
"Betrieblicher Betreuer:",
prelude.info.betreuer,
[*Betrieblicher Betreuer:*],
author.supervisor,
"Abgabedatum:",
prelude.info.abgabe
[*Abgabedatum:*],
thesis.submission-date
)
] else if prelude.format.language == "en" [
] else if text.lang == "en" [
#table(
columns: 2,
column-gutter: 1cm,
align: left,
stroke: none,
"Author:",
prelude.info.autor,
[*Author:*],
author.name,
"Editing period:",
prelude.info.bearbeitungszeitraum,
[*Editing period:*],
thesis.timeframe,
"Matriculation number, course:",
str(prelude.info.matrikelnummer) + ", " + prelude.info.studiengang,
[*Matriculation number, course:*],
str(author.matriculation-number) + ", " + author.course,
"Training company:",
prelude.info.betrieb,
[*Training company:*],
author.company,
"Company supervisor:",
prelude.info.betreuer,
[*Company supervisor:*],
author.supervisor,
"Submission date:",
prelude.info.abgabe
[*Submission date:*],
thesis.submission-date
)
] else [
#panic("no translation for language: ", prelude.format.language)
#context panic("no translation for language: ", text.lang)
]
#pad(
@ -126,19 +118,17 @@
// set width of columns
// we need two, so make both half the page width
columns: (60%, 40%),
align(left, if prelude.format.language == "de" [
align(left, if text.lang == "de" [
Unterschrift des betrieblichen Betreuers
] else if prelude.format.language == "en" [
] else if text.lang == "en" [
Signature of the company supervisor
] else [
#panic("no translation for language: ", prelude.format.language)
#context panic("no translation for language: ", text.lang)
]
),
align(right, {line(length: 6cm)})
)
)
#pagebreak()
#counter(page).update(1)
]

View File

@ -8,15 +8,99 @@
// License: MIT
// global style of document
#let global_styled_doc(doc: content) = [
#let global_styled_doc(doc: content) = context [
// set page geometry
// paper format of A4
#set page(
paper: "a4",
margin: (left: 3cm, right: 2cm, top: 2cm, bottom: 2cm))
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 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)
#set block(spacing: 2em)
#set par(
justify: true,
first-line-indent: 1em,
leading: 1em)
#doc
]
#let HeaderPaddingBottom = 1.5em
#let LogoHeight = 3em
#let HeaderUnderlinePaddingTop = 0pt
#let prelude_styled(body: content, thesis) = context [
#set page(
header-ascent: HeaderUnderlinePaddingTop + HeaderPaddingBottom,
numbering: "I",
margin: (top: 2.5cm + LogoHeight + HeaderUnderlinePaddingTop + HeaderPaddingBottom),
header: [
#grid(
columns: (1fr, auto),
align: (horizon, bottom),
context [ _ #thesis.title _ ],
image("pages/res/DHBW.svg", height: LogoHeight)
)
#v(HeaderUnderlinePaddingTop - 1em)
#line(length: 100%)
])
#body
]
#let content_styled(body: content, thesis) = [
// setup equate for sub equation labeling
#import "@preview/equate:0.2.0": equate
#show: equate.with(breakable: true, sub-numbering: true)
#set math.equation(numbering: "(1.1)")
#set heading(numbering: "1.")
#page(
header-ascent: HeaderUnderlinePaddingTop + HeaderPaddingBottom,
numbering: "1/1",
footer-descent: 1em,
margin: (top: 2.5cm + LogoHeight + HeaderUnderlinePaddingTop + HeaderPaddingBottom, bottom: 2.5cm + 1em),
header: context [
#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("pages/res/DHBW.svg", height: LogoHeight)
)
#v(HeaderUnderlinePaddingTop - 1em)
#line(length: 100%)
])[
#body
]
]

View File

@ -10,17 +10,71 @@
// start of template pages and styles
#let dhbw-template(doc) = [
#import "style.typ": global_styled_doc
#import "style.typ": global_styled_doc, prelude_styled, content_styled
// apply global style to every element in the argument content
#global_styled_doc(doc: [
#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/glossar.typ": new-glossar
#set text(lang: "de", region: "de")
#let author = (
name: "Sven Vogel",
semester: 4,
program: "Informationstechnik",
course: "TINF22IT2",
faculty: "Technik",
university: "DHBW Mannheim",
company: "ABB AG",
supervisor: "Florian Miedniak",
matriculation-number: 1191225
)
#let thesis = (
title: "Konfiguration & Integration von PROFINET",
subtitle: "für die AC500 SPS",
submission-date: "20. März 2024",
timeframe: "1. Januar 2023 - 20. März 2024",
kind: "T2000",
summary: "",
abstract: "",
)
#let glossary = ()
// preppend title page
#new_title_page()
#new_title_page(thesis, author)
// code of document follows here
#doc
#prelude_styled(thesis, body: [
#pagebreak(weak: true)
#new_declaration_of_authorship(thesis, author)
#pagebreak(weak: true)
#new_confidentiality_statement_page(thesis, author)
#pagebreak(weak: true)
#new_prerelease_note(thesis, author)
#pagebreak(weak: true)
#new_outline()
#pagebreak(weak: true)
#new_abstract(thesis)
#pagebreak(weak: true)
#new-glossar(glossary)
])
#content_styled(thesis, body: [
// code of document follows here
#doc
])
])
]