diff --git a/README.md b/README.md index a47191a..0466da7 100644 --- a/README.md +++ b/README.md @@ -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 \ No newline at end of file +## 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. \ No newline at end of file diff --git a/examples/appendix.typ b/examples/appendix.typ new file mode 100644 index 0000000..e600d52 --- /dev/null +++ b/examples/appendix.typ @@ -0,0 +1,8 @@ + += Ein Text im Anhang + +#lorem(50) + +== Noch mehr Text im Anhang + +#lorem(50) diff --git a/examples/lipsum.typ b/examples/lipsum.typ index 2c05960..a058871 100644 --- a/examples/lipsum.typ +++ b/examples/lipsum.typ @@ -2,6 +2,8 @@ #import "../src/template.typ": dhbw-template #let config = ( + lang: "de", + region: "de", author: ( name: "Sven Vogel", semester: 4, @@ -20,7 +22,7 @@ kind: "T2000", summary: "", abstract: "", - keywods: ( "IT", "PROFINET" ), + keywords: ( "IT", "PROFINET" ), bibliography: bibliography("refs.yml"), glossary: ( ( @@ -33,12 +35,12 @@ ( key: "potato", short: "potato", - // "plural" will be used when "short" should be pluralized plural: "potatoes", desc: [#lorem(10)], group: "Begriffe" ), - ) + ), + appendices: include "appendix.typ" )) #show: doc => dhbw-template(config: config, doc: doc) diff --git a/src/pages/abstract.typ b/src/pages/abstract.typ index 68c991a..291561a 100644 --- a/src/pages/abstract.typ +++ b/src/pages/abstract.typ @@ -1,3 +1,10 @@ +// .--------------------------------------------------------------------------. +// | Abstract | +// '--------------------------------------------------------------------------' + +// Author: Sven Vogel +// Edited: 28.06.2024 +// License: MIT #let new_abstract(config) = context [ diff --git a/src/pages/appendix.typ b/src/pages/appendix.typ new file mode 100644 index 0000000..2b897e8 --- /dev/null +++ b/src/pages/appendix.typ @@ -0,0 +1,32 @@ + +#let show-appendix(config: dictionary) = context { + counter(heading).update(0) + + let title = if text.lang == "en" { + "Appendix" + } else { + "Anhang" + } + + // 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: [appendix]) + + if "appendices" in config.thesis { + pagebreak(weak: true) + + config.thesis.appendices + } +} diff --git a/src/pages/outline.typ b/src/pages/outline.typ index a7fd4ed..f978ad7 100644 --- a/src/pages/outline.typ +++ b/src/pages/outline.typ @@ -59,6 +59,23 @@ indent: auto) } +#let render_appendix_outline() = context { + if query(heading.where(supplement: [appendix])).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: [appendix]), + title: heading(level: 3, title), + indent: auto) + } +} + + #let new_outline() = { show outline.entry.where( level: 1, @@ -73,5 +90,7 @@ render_raw_outline() + render_appendix_outline() + render_heading_outline() } \ No newline at end of file diff --git a/src/style.typ b/src/style.typ index 59d7067..a79072f 100644 --- a/src/style.typ +++ b/src/style.typ @@ -64,10 +64,12 @@ let current-page = here().page() if current-page == 1{ [] - } else if query().first().location().page() <= current-page { + } else if query().first().location().page() > current-page { + numbering("I", nums.pos().first()) + } else if query().first().location().page() >= current-page { numbering("1 / 1", ..nums) } else { - numbering("I", nums.pos().first()) + numbering("a", nums.pos().first()) } }, header: context { @@ -138,3 +140,12 @@ #body ] + +#let end_styled(config: dictionary, body: content) = [ + + #set heading(numbering: "1.") + + #let thesis = config.thesis + + #body +] diff --git a/src/template.typ b/src/template.typ index 82a916f..0bd2d64 100644 --- a/src/template.typ +++ b/src/template.typ @@ -10,7 +10,13 @@ // start of template pages and styles #let dhbw-template(config: dictionary, doc: content) = [ - #import "style.typ": global_styled_doc, prelude_styled, content_styled + #import "style.typ": global_styled_doc, prelude_styled, content_styled, end_styled + + // 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: [ @@ -21,12 +27,16 @@ #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 - #set text(lang: "de", region: "de") + // 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 #prelude_styled(config: config, body: [ #pagebreak(weak: true) #new_declaration_of_authorship(config) @@ -44,24 +54,37 @@ #new_abstract(config) ]) + // 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) #print-glossary(config.thesis.glossary) #pagebreak(weak: true) + #counter(page).update(1) + // mark end of prelude #metadata("prelude terminate") #content_styled(config: config, body: [ // code of document follows here #doc + ]) + #metadata("content terminate") + + #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) ]) ]) ] \ No newline at end of file