added: appendix

This commit is contained in:
Sven Vogel 2024-07-01 13:50:54 +02:00
parent 77d197c029
commit ac70aade96
8 changed files with 115 additions and 21 deletions

View File

@ -1,17 +1,9 @@
# Praxisbericht-Template-Typst # 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: ## Format
- Inhaltsverzeichnis All pages have a margin of 2.5cm between header/footer/content and the page border.
- Quelltextverzeichnis Header and footer do not overlap into this margin.
- Abbildungsverzechnis
- Tabellenverzeichnis Bibliography is formated with the IEEE style. Appendecies make use of the APA style.
- Literaturverzeichnis
- Glossar
- Abkürzungsverzeichnis
- Ligratures in code blöcken
- Diagramme
- Literatur
- Fußnoten
- Anhang

8
examples/appendix.typ Normal file
View File

@ -0,0 +1,8 @@
= Ein Text im Anhang
#lorem(50)
== Noch mehr Text im Anhang
#lorem(50)

View File

@ -2,6 +2,8 @@
#import "../src/template.typ": dhbw-template #import "../src/template.typ": dhbw-template
#let config = ( #let config = (
lang: "de",
region: "de",
author: ( author: (
name: "Sven Vogel", name: "Sven Vogel",
semester: 4, semester: 4,
@ -20,7 +22,7 @@
kind: "T2000", kind: "T2000",
summary: "", summary: "",
abstract: "", abstract: "",
keywods: ( "IT", "PROFINET" ), keywords: ( "IT", "PROFINET" ),
bibliography: bibliography("refs.yml"), bibliography: bibliography("refs.yml"),
glossary: ( glossary: (
( (
@ -33,12 +35,12 @@
( (
key: "potato", key: "potato",
short: "potato", short: "potato",
// "plural" will be used when "short" should be pluralized
plural: "potatoes", plural: "potatoes",
desc: [#lorem(10)], desc: [#lorem(10)],
group: "Begriffe" group: "Begriffe"
), ),
) ),
appendices: include "appendix.typ"
)) ))
#show: doc => dhbw-template(config: config, doc: doc) #show: doc => dhbw-template(config: config, doc: doc)

View File

@ -1,3 +1,10 @@
// .--------------------------------------------------------------------------.
// | Abstract |
// '--------------------------------------------------------------------------'
// Author: Sven Vogel
// Edited: 28.06.2024
// License: MIT
#let new_abstract(config) = context [ #let new_abstract(config) = context [

32
src/pages/appendix.typ Normal file
View File

@ -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
}
}

View File

@ -59,6 +59,23 @@
indent: auto) 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() = { #let new_outline() = {
show outline.entry.where( show outline.entry.where(
level: 1, level: 1,
@ -73,5 +90,7 @@
render_raw_outline() render_raw_outline()
render_appendix_outline()
render_heading_outline() render_heading_outline()
} }

View File

@ -64,10 +64,12 @@
let current-page = here().page() let current-page = here().page()
if current-page == 1{ if current-page == 1{
[] []
} else if query(<end-of-prelude>).first().location().page() <= current-page { } 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) numbering("1 / 1", ..nums)
} else { } else {
numbering("I", nums.pos().first()) numbering("a", nums.pos().first())
} }
}, },
header: context { header: context {
@ -138,3 +140,12 @@
#body #body
] ]
#let end_styled(config: dictionary, body: content) = [
#set heading(numbering: "1.")
#let thesis = config.thesis
#body
]

View File

@ -10,7 +10,13 @@
// start of template pages and styles // start of template pages and styles
#let dhbw-template(config: dictionary, doc: content) = [ #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 // apply global style to every element in the argument content
#global_styled_doc(config: config, body: [ #global_styled_doc(config: config, body: [
@ -21,12 +27,16 @@
#import "pages/prerelease-note.typ": new_prerelease_note #import "pages/prerelease-note.typ": new_prerelease_note
#import "pages/outline.typ": new_outline #import "pages/outline.typ": new_outline
#import "pages/abstract.typ": new_abstract #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 // preppend title page
#new_title_page(config) #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: [ #prelude_styled(config: config, body: [
#pagebreak(weak: true) #pagebreak(weak: true)
#new_declaration_of_authorship(config) #new_declaration_of_authorship(config)
@ -44,24 +54,37 @@
#new_abstract(config) #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 #import "@preview/glossarium:0.4.1": make-glossary, print-glossary, gls, glspl
#show: make-glossary #show: make-glossary
#pagebreak(weak: true) #pagebreak(weak: true)
#print-glossary(config.thesis.glossary) #print-glossary(config.thesis.glossary)
#pagebreak(weak: true) #pagebreak(weak: true)
#counter(page).update(1)
// mark end of prelude
#metadata("prelude terminate") <end-of-prelude> #metadata("prelude terminate") <end-of-prelude>
#content_styled(config: config, body: [ #content_styled(config: config, body: [
// code of document follows here // code of document follows here
#doc #doc
])
#metadata("content terminate") <end-of-content>
#end_styled(config: config, body: [
// add bibliography if set
#if config.thesis.bibliography != none { #if config.thesis.bibliography != none {
pagebreak(weak: true) pagebreak(weak: true)
set bibliography(style: "ieee") set bibliography(style: "ieee")
config.thesis.bibliography config.thesis.bibliography
counter(page).update(1)
} }
// appendix
#show-appendix(config: config)
]) ])
]) ])
] ]