dhbw-abb-typst-template/src/lib.typ

117 lines
3.2 KiB
Plaintext
Raw Normal View History

2024-06-27 13:57:04 +00:00
// .--------------------------------------------------------------------------.
// | Template of DHBW thesis |
// '--------------------------------------------------------------------------'
// Author: Sven Vogel
// Edited: 27.06.2024
// License: MIT
2024-08-12 16:09:14 +00:00
#import "conf.typ": validate-config, default-config
#import "branding.typ": *
#import "style.typ": global_styled_doc, content_styled, end_styled
#import "glossary.typ": glossary
#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/preface.typ": new-preface
#import "pages/appendix.typ": show-appendix
#let group-break() = {
2024-07-08 11:49:04 +00:00
[#pagebreak()]
}
2024-08-12 16:07:44 +00:00
#let inline-color(color, content) = {
box(
stroke: 1pt + ABB-GRAY-05,
radius: 2pt,
inset: (left: 2pt, right: 2pt),
outset: (top: 4pt, bottom: 4pt),
fill: ABB-GRAY-06,
[#box(fill: rgb(color), radius: 2pt, inset: 0pt, width: 0.75em, height: 0.75em) #text(
font: default-config.style.code.font,
size: default-config.style.code.size,
content,
)],
)
}
// start of template pages and styles
#let dhbw-template(config, body) = [
#let config = validate-config(config)
2024-07-01 14:02:42 +00:00
#let doc = body
2024-06-27 13:57:04 +00:00
// 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,
2024-08-12 16:09:14 +00:00
title: config.thesis.title,
)
2024-06-27 13:57:04 +00:00
2024-07-01 11:50:54 +00:00
// configure text locale
#set text(
lang: config.lang,
2024-08-12 16:09:14 +00:00
region: config.region,
)
2024-06-28 09:54:30 +00:00
2024-06-27 13:57:04 +00:00
// preppend title page
2024-07-01 10:13:57 +00:00
#new_title_page(config)
2024-06-28 09:54:30 +00:00
2024-07-01 11:50:54 +00:00
// prelude includes: title, declaration of authorship, confidentiality statement, outline and abstract
// these will have roman page numbers
2024-07-01 12:46:32 +00:00
#new_declaration_of_authorship(config)
#new_confidentiality_statement_page(config)
#if config.draft {
new_prerelease_note(config)
}
2024-07-01 14:02:42 +00:00
#new_abstract(config)
2024-07-04 13:09:05 +00:00
#new-preface(config)
2024-07-01 12:46:32 +00:00
#new_outline()
2024-06-27 13:57:04 +00:00
2024-08-12 16:07:44 +00:00
// glossary is built inline here because the links must be
2024-07-01 11:50:54 +00:00
// exposed to the entire document
2024-07-08 11:49:04 +00:00
#import "glossarium.typ": *
2024-07-01 10:13:57 +00:00
#show: make-glossary
#pagebreak(weak: true)
2024-07-01 12:46:32 +00:00
2024-07-01 14:17:54 +00:00
#if "glossary" in config.thesis and config.thesis.glossary != none {
print-glossary(
2024-08-14 09:57:27 +00:00
show-all: true,
disable-back-references: true,
2024-07-08 11:49:04 +00:00
enable-group-pagebreak: true,
2024-08-12 16:09:14 +00:00
glossary(config.thesis.glossary),
)
2024-07-01 12:46:32 +00:00
2024-07-01 14:17:54 +00:00
pagebreak(weak: true)
2024-08-12 16:07:44 +00:00
}
#counter(page).update(1)
2024-07-01 10:13:57 +00:00
2024-07-01 11:50:54 +00:00
// mark end of prelude
2024-07-01 10:13:57 +00:00
#metadata("prelude terminate") <end-of-prelude>
#content_styled(config, doc)
2024-07-01 10:13:57 +00:00
2024-07-01 11:50:54 +00:00
#metadata("content terminate") <end-of-content>
#end_styled(config)[
2024-07-01 11:50:54 +00:00
// add bibliography if set
#if "bibliography" in config.thesis and config.thesis.bibliography != none {
2024-07-01 10:13:57 +00:00
pagebreak(weak: true)
counter(page).update(1)
2024-07-01 10:13:57 +00:00
set bibliography(style: "ieee")
config.thesis.bibliography
}
2024-07-01 11:50:54 +00:00
// appendix
#show-appendix(config: config)
]
]
2024-08-12 16:07:44 +00:00
]