changed: layout and formatting

added: source code header
This commit is contained in:
Sven Vogel 2024-07-05 13:04:27 +02:00
parent eb8e457a0c
commit ccd8e89131
16 changed files with 270 additions and 170 deletions

View File

@ -9,9 +9,13 @@
// default configuration
#let default-config = (
lang: "en",
region: "en",
// language settings used to make decisions about hyphenation and others
lang: "en", // ISO 3166 language code of text: "de", "en"
region: "en", // region code
// mark this thesis as draft
// Adds preleminarry note page and watermark
draft: true,
// information about author(s)
author: (
name: "Sven Vogel",
semester: 4,
@ -22,12 +26,14 @@
company: "ABB AG",
supervisor: "Benny Goodman",
matriculation-number: 123456789),
// information about thesis
thesis: (
title: "Unofficial ABB/DHBW Typst template",
subtitle: "for reports and thesises",
subtitle: "for reports and thesises", // subtitle may be none
submission-date: "23rd march 2020",
timeframe: "1st january 2020 - 20th march 2020",
kind: "T2000",
// translated version of abstract, only used in case language is not english
summary: none,
abstract: none,
preface: none,
@ -37,9 +43,11 @@
appendices: none),
style: (
header: (
bottom-padding: 1.5em,
content-padding: 1.5em,
underline-top-padding: 0pt,
logo-height: 3em),
footer: (
content-padding: 1.5em),
page: (
format: "a4",
margin: (

View File

@ -7,9 +7,6 @@
// Edited: 27.06.2024
// License: MIT
// start of template pages and styles
#let dhbw-template(config: dictionary, body) = [
#import "conf.typ": validate-config
#import "style.typ": global_styled_doc, content_styled, end_styled
#import "pages/titlepage.typ": new_title_page
@ -21,19 +18,20 @@
#import "pages/preface.typ": new-preface
#import "pages/appendix.typ": show-appendix
// start of template pages and styles
#let dhbw-template(config, body) = [
#let config = validate-config(config)
#let doc = body
// apply global style to every element in the argument content
#global_styled_doc(config)[
// 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: [
// configure text locale
#set text(
lang: config.lang,
@ -72,11 +70,11 @@
// mark end of prelude
#metadata("prelude terminate") <end-of-prelude>
#content_styled(config: config, body: doc)
#content_styled(config, doc)
#metadata("content terminate") <end-of-content>
#end_styled(config: config, body: [
#end_styled(config)[
// add bibliography if set
#if "bibliography" in config.thesis and config.thesis.bibliography != none {
pagebreak(weak: true)
@ -87,6 +85,6 @@
// appendix
#show-appendix(config: config)
])
])
]
]
]

View File

@ -6,23 +6,22 @@
// Edited: 28.06.2024
// License: MIT
#let new_abstract(config) = context [
#let new_abstract(config) = context {
set align(center + horizon)
// only include summary when a language other than english is used
if text.lang == "de" [
// Summary is supposed to be on separate page
#pagebreak(weak: true)
#let thesis = config.thesis
#pagebreak(weak: true)
#align(center + horizon)[
#if text.lang == "de" [
= Zusammenfassung
#thesis.summary
#config.thesis.summary
]
#pagebreak(weak: true)
= Abstract
// abstract is supposed to be on separate page
pagebreak(weak: true)
#thesis.abstract
]
]
heading("Abstract")
config.thesis.abstract
}

View File

@ -1,3 +1,10 @@
// .--------------------------------------------------------------------------.
// | Appendix |
// '--------------------------------------------------------------------------'
// Author: Sven Vogel
// Edited: 28.06.2024
// License: MIT
#let show-appendix(config: dictionary) = context {
counter(heading).update(0)

View File

@ -1,53 +1,62 @@
// .--------------------------------------------------------------------------.
// | Confidentiality Statement |
// '--------------------------------------------------------------------------'
#let new_confidentiality_statement_page(config) = context [
// Author: Sven Vogel
// Edited: 28.06.2024
// License: MIT
#pagebreak(weak: true)
#let new_confidentiality_statement_page(config) = context {
#let thesis = config.thesis
#let author = config.author
pagebreak(weak: true)
#v(2em)
#if text.lang == "de" [
#text(size: 20pt, weight: "semibold", font: "Montserrat", "Sperrvermerk")
let thesis = config.thesis
let author = config.author
if text.lang == "de" [
#heading(level: 1, "Sperrvermerk", supplement: [special])
] else if text.lang == "en" [
#text(size: 20pt, weight: "semibold", font: "Montserrat", "Confidentiality statement")
#heading(level: 1, "Confidentiality Statement", supplement: [special])
]
#if text.lang == "de" [
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)
v(1em)
#set align(center)
set align(center)
*#thesis.title*
text(weight: "bold", thesis.title)
#thesis.subtitle
if thesis.subtitle != none {
linebreak()
thesis.subtitle
}
#set align(left)
set align(left)
#v(1em)
v(1em)
#set par(justify: true)
set par(justify: true)
#if text.lang == "de" [
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%)
set align(horizon)
#grid(
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" [ 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,52 +1,64 @@
// .--------------------------------------------------------------------------.
// | Declaration of Authorship |
// '--------------------------------------------------------------------------'
#let new_declaration_of_authorship(config) = context [
// Author: Sven Vogel
// Edited: 28.06.2024
// License: MIT
#pagebreak(weak: true)
#let new_declaration_of_authorship(config) = context {
#let thesis = config.thesis
#let author = config.author
pagebreak(weak: true)
#v(2em)
#if text.lang == "de" [
#text(size: 20pt, weight: "semibold", font: "Montserrat", "Selbständigkeitserklärung")
let thesis = config.thesis
let author = config.author
if text.lang == "de" [
#heading("Selbständigkeitserklärung")
] else if text.lang == "en" [
#text(size: 20pt, weight: "semibold", font: "Montserrat", "Declaration of authorship")
#heading("Declaration of Authorship")
]
#v(1em)
v(1em)
#if text.lang == "de" [
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
I hereby confirm that I have written this thesis with the subject
]
#v(1em)
v(1em)
#set align(center)
set align(center)
*#thesis.title*
text(weight: "bold", thesis.title)
#thesis.subtitle
if thesis.subtitle != none {
linebreak()
thesis.subtitle
}
#set align(left)
set align(left)
#v(1em)
v(1em)
#set par(justify: true)
set par(justify: true)
if text.lang == "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 text.lang == "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.
]
#v(25%)
set align(horizon)
#grid(
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" [ 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,3 +1,10 @@
// .--------------------------------------------------------------------------.
// | Document Outline |
// '--------------------------------------------------------------------------'
// Author: Sven Vogel
// Edited: 28.06.2024
// License: MIT
// render an outline of figures
// with a specific title and filter by a specifc kind of figure
@ -89,7 +96,7 @@
show outline.entry.where(
level: 1,
): it => {
v(18pt, weak: true)
v(1.5em, weak: true)
strong(it)
}

View File

@ -1,3 +1,10 @@
// .--------------------------------------------------------------------------.
// | Preface |
// '--------------------------------------------------------------------------'
// Author: Sven Vogel
// Edited: 28.06.2024
// License: MIT
#let new-preface(config) = {
if config.thesis.preface != none {

View File

@ -1,47 +1,56 @@
// .--------------------------------------------------------------------------.
// | Preleminary release Notice |
// '--------------------------------------------------------------------------'
#let new_prerelease_note(config) = context [
// Author: Sven Vogel
// Edited: 28.06.2024
// License: MIT
#pagebreak(weak: true)
#let new_prerelease_note(config) = context {
#let thesis = config.thesis
#let author = config.author
pagebreak(weak: true)
#v(2em)
#if text.lang == "de" [
#text(size: 20pt, weight: "semibold", font: "Montserrat", "Vorabfassung")
let thesis = config.thesis
let author = config.author
if text.lang == "de" [
#heading("Vorabfassung")
] else if text.lang == "en" [
#text(size: 20pt, weight: "semibold", font: "Montserrat", "Preliminary version")
#heading("Preliminary Version")
]
#v(1em)
v(1em)
#if text.lang == "de" [
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)
v(1em)
#set align(center)
set align(center)
*#thesis.title*
text(weight: "bold", thesis.title)
#thesis.subtitle
if thesis.subtitle != none {
linebreak()
thesis.subtitle
}
#set align(left)
set align(left)
#v(1em)
v(1em)
#set par(justify: true)
set par(justify: true)
#if text.lang == "de" [
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()
]
v(1em)
h(1em)
[#author.name, #datetime.today().display()]
}

View File

@ -1,3 +1,10 @@
// .--------------------------------------------------------------------------.
// | Titlepage |
// '--------------------------------------------------------------------------'
// Author: Sven Vogel
// Edited: 28.06.2024
// License: MIT
#let new_title_page(config) = context [
@ -45,7 +52,7 @@
#author.university
]
#set align(bottom + left)
#set align(horizon + left)
#if text.lang == "de" [
#table(
@ -101,8 +108,7 @@
#context panic("no translation for language: ", text.lang)
]
#pad(
top: 1cm,
#align(bottom,
grid(
// set width of columns
// we need two, so make both half the page width
@ -115,9 +121,7 @@
#context panic("no translation for language: ", text.lang)
]
),
align(right, {line(length: 6cm)})
)
)
align(right, {line(length: 6cm)})))
#counter(page).update(0)
]

View File

@ -1 +1,10 @@
// .--------------------------------------------------------------------------.
// | Required packages for template use |
// '--------------------------------------------------------------------------'
// Author: Sven Vogel
// Edited: 05.07.2024
// License: MIT
#import "@preview/glossarium:0.4.1": *

View File

@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<!--
.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
| ABB logo |
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
Author: N/A
Changed: Sven Vogel
Edited: 05.07.2024
License: MIT
Source: https://commons.wikimedia.org/wiki/File:ABB_logo.svg
Created with Inkscape (http://www.inkscape.org/)
-->
<svg
width="385.80621mm"

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<!--
.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
| DHBW logo |
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
Author: N/A
Changed: Sven Vogel
Edited: 05.07.2024
License: MIT
Source: https://upload.wikimedia.org/wikipedia/de/1/1d/DHBW-Logo.svg
Created with Inkscape (http://www.inkscape.org/)
-->
<svg
width="353.7124mm"

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -1,3 +1,14 @@
<!--
.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
| GitHub light theme |
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
Author: Seth Lopez
Changed: Sven Vogel
Edited: 05.07.2024
License: MIT
-->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--

View File

@ -9,21 +9,23 @@
#let watermark-color = luma(50%).transparentize(70%)
#let watermark() = rotate(-22.5deg,
rect(radius: 1em, inset: 1em, stroke: watermark-color, {
text(size: 48pt, weight: "bold", fill: watermark-color, "DRAFT")
linebreak()
text(size: 14pt, weight: "bold", fill: watermark-color)[
#let watermark(config) = if config.draft {
rotate(-22.5deg)[
#rect(
radius: 1em,
inset: 1em,
stroke: watermark-color)[
#text(size: 4em, weight: "bold", fill: watermark-color, "DRAFT")
#linebreak()
#text(size: 1.25em, weight: "bold", fill: watermark-color)[
This page is part of a preliminary
#linebreak()
document version.
#linebreak()
#text(size: 10pt, "Further usage without the authors consent is not permitted.")
]
}))
#text(size: 0.75em, "Further usage without the authors consent is not permitted.")]]]}
// global style of document
#let global_styled_doc(config: dictionary, body: content) = context {
#let global_styled_doc(config, body) = {
let thesis = config.thesis
let style = config.style
@ -63,14 +65,12 @@
set heading(numbering: none)
set page(
paper: style.page.format,
foreground: if config.draft {
watermark()
},
header-ascent: 0pt,
footer-descent: 0pt,
foreground: watermark(config),
header-ascent: style.header.content-padding,
footer-descent: style.header.content-padding,
margin: (
top: style.page.margin.top + style.header.logo-height + style.header.underline-top-padding + style.header.bottom-padding,
bottom: style.page.margin.bottom + 1em,
top: style.page.margin.top + style.header.logo-height + style.header.underline-top-padding + style.header.content-padding,
bottom: style.page.margin.bottom + style.footer.content-padding,
left: style.page.margin.left,
right: style.page.margin.right),
numbering: (..nums) => {
@ -150,19 +150,14 @@
body
}
#let content_styled(config: dictionary, body: content) = [
#set heading(numbering: "1.")
#let content_styled(config, body) = {
set heading(numbering: "1.")
#let thesis = config.thesis
body
}
#body
]
#let end_styled(config, body) = {
set heading(numbering: "1.")
#let end_styled(config: dictionary, body: content) = [
#set heading(numbering: "1.")
#let thesis = config.thesis
#body
]
body
}

View File

@ -3,8 +3,7 @@
#import "glossary.typ": glossary
#import "abstract.typ": abstract, summary
#show: dhbw-template.with(
config: (
#show: dhbw-template.with((
lang: "en",
region: "en",
author: (