refactored content into multiple files

This commit is contained in:
Sven Vogel 2024-03-30 18:40:06 +01:00
parent aab64c8e89
commit 410742999a
10 changed files with 299 additions and 174 deletions

46
src/content/audition.typ Normal file
View File

@ -0,0 +1,46 @@
// ====================================================
//
// AUDITION OF WORK
//
// Author: Sven Vogel
// License: MIT
// Edited: 29.03.2024
//
// This file binds and styles pages about:
// - title
// - declaration of indipendence
// - confidential clause
// - gender note
// - working packages
// - abstract
// ====================================================
#import "../prelude.typ" as prelude
#set heading(numbering: none)
#set page(numbering: "I.", footer: "")
#include "../pages/title.typ"
#include "../pages/declaration-of-indipendence.typ"
#include "../pages/confidential-clause.typ"
#set page(
binding: left,
header-ascent: 2em,
header: locate(loc => {
table(columns: (1fr, auto),
align: (left, right),
stroke: none,
inset: (top: 0pt, bottom: 0.5em, left: 0pt, right: 0pt),
text(size: prelude.to_pt(prelude.format.font-size), prelude.info.titel),
text(size: prelude.to_pt(prelude.format.font-size), counter(page).display("I.")),
table.hline()
)
}),
footer: ""
)
#include "../pages/gender-note.typ"
#include "../pages/working-packages.typ"
#include "../pages/abstract.typ"

View File

@ -0,0 +1,39 @@
// ====================================================
//
// BIBLIOGRAPHY
//
// Author: Sven Vogel
// License: MIT
// Edited: 29.03.2024
//
// This file binds and styles bibliography of this work
// ====================================================
#import "../prelude.typ" as prelude
#set heading(numbering: none)
// function for filtering out all heading which are not of level 1
#let filter_heading(heading) = {
heading.level == 1
}
#set page(
header: locate(loc => {
align(left, context [
#let current_heading = query(selector(heading).after(here())).filter(filter_heading).first()
#current_heading.body
])
v(-2em)
align(right, counter(page).display("1"))
v(-1em)
line(length: 100%)
}),
)
// load bibliography and add it to the document
#bibliography(
style: "ieee",
"../../conf/bibliography.bib"
)

116
src/content/outline.typ Normal file
View File

@ -0,0 +1,116 @@
// ====================================================
//
// OUTLINE
//
// Author: Sven Vogel
// License: MIT
// Edited: 29.03.2024
//
// This file binds and styles the outline of this document
// ====================================================
#import "../prelude.typ" as prelude
#set page(
binding: left,
header-ascent: 2em,
header: locate(loc => {
table(columns: (1fr, auto),
align: (left, right),
stroke: none,
inset: (top: 0pt, bottom: 0.5em, left: 0pt, right: 0pt),
text(size: prelude.to_pt(prelude.format.font-size), prelude.info.titel),
text(size: prelude.to_pt(prelude.format.font-size), counter(page).display("I.")),
table.hline()
)
}),
footer: ""
)
#let heading_outline_title = if prelude.format.language == "de" [
Inhaltsverzeichnis
] else if prelude.format.language == "en" [
Table of contents
] else [
#panic("no translation for language: ", prelude.format.language)
]
#outline(title: heading_outline_title, indent: auto)
#pagebreak()
#let image_outline_title = if prelude.format.language == "de" [
Abbildungsverzeichnis
] else if prelude.format.language == "en" [
List of figures
] else [
#panic("no translation for language: ", prelude.format.language)
]
#outline(
title: image_outline_title,
target: figure.where(kind: image),
)
#pagebreak()
#let table_outline_title = if prelude.format.language == "de" [
Tabellensverzeichnis
] else if prelude.format.language == "en" [
List of tables
] else [
#panic("no translation for language: ", prelude.format.language)
]
#outline(
title: table_outline_title,
target: figure.where(kind: table),
)
#pagebreak()
#let raw_outline_title = if prelude.format.language == "de" [
Quelltextverzeichnis
] else if prelude.format.language == "en" [
Table of source code
] else [
#panic("no translation for language: ", prelude.format.language)
]
#outline(
title: raw_outline_title,
target: figure.where(kind: raw),
)
#pagebreak()
// for creating glossary
#import "@preview/glossarium:0.2.6": make-glossary, print-glossary, gls, glspl
#show: make-glossary
#if prelude.format.language == "de" [
= Glossar
] else if prelude.format.language == "en" [
= Glossary
] else [
#panic("no translation for language: ", prelude.format.language)
]
// read all entries from config file
#let glossary = yaml("../../conf/glossary.yaml")
// destination array
#let glossary_entries = ()
// parse TOML entries into correct format
#if glossary.glossary != none {
for entry in glossary.glossary {
let short = entry.at("short", default: none)
let long = entry.at("long", default: none)
let desc = entry.at("desc", default: none)
if short == none {
panic("Key of glossary term must be specified")
}
glossary_entries.push((key: short, short: short, long: long, desc: desc))
}
}
#print-glossary(glossary_entries)

31
src/content/preface.typ Normal file
View File

@ -0,0 +1,31 @@
// ====================================================
//
// PREFACE
//
// Author: Sven Vogel
// License: MIT
// Edited: 29.03.2024
//
// This file binds and styles the preface of this document
// ====================================================
#import "../prelude.typ" as prelude
#set page(
binding: left,
header-ascent: 2em,
header: locate(loc => {
table(columns: (1fr, auto),
align: (left, right),
stroke: none,
inset: (top: 0pt, bottom: 0.5em, left: 0pt, right: 0pt),
text(size: prelude.to_pt(prelude.format.font-size), prelude.info.titel),
text(size: prelude.to_pt(prelude.format.font-size), counter(page).display("I.")),
table.hline()
)
}),
footer: ""
)
#include "../pages/preface.typ"

View File

@ -1,13 +1,29 @@
#import "prelude.typ" as prelude
// ------------------------------------------
// Set page geometry and PDF meta data
// ------------------------------------------
// set page geometry:
// paper format of A4
// top margin is 2cm (blank space) + 2em (header) + 1em (spacing)
#set page(
margin: (left: 3cm, right: 2cm, top: 2cm + 2em, bottom: 2cm),
margin: (left: 3cm, right: 2cm, top: 2cm + 3em, bottom: 2cm),
paper: "a4",
)
// set PDF meta information
#set document(
author: prelude.info.autor,
date: datetime.today(),
keywords: prelude.info.stichwörter
)
// ------------------------------------------
// Configure fonts and headings
// ------------------------------------------
// set global text parameter
#set text(
font: prelude.format.font-familty,
@ -38,8 +54,7 @@
alternates: prelude.format.ligratures,
discretionary-ligatures: prelude.format.ligratures,
lang: prelude.format.language,
weight: "regular",
baseline: 1em
weight: "regular"
)
#show heading.where(level: 2): set text(
@ -64,6 +79,10 @@
weight: "regular"
)
// ------------------------------------------
// Setup paragraphs
// ------------------------------------------
// use block element as paragraph
// set block settings for every paragraph
#show par: set block(
@ -77,191 +96,48 @@
first-line-indent: prelude.to_cm(prelude.format.first-line-indent)
)
// set PDF meta information
#set document(
author: prelude.info.autor,
date: datetime.today(),
keywords: prelude.info.stichwörter
)
// ------------------------------------------
// Start of content
// ------------------------------------------
#set heading(numbering: none)
#set page(numbering: "I.", footer: "")
#include "pages/title.typ"
#include "pages/declaration-of-indipendence.typ"
#include "pages/confidential-clause.typ"
#set page(
binding: left,
header-ascent: 1em,
header: locate(loc => {
text(size: 12pt)[
#prelude.info.titel
#v(-2em)
#align(right, counter(page).display("I."))
#v(-1em)
#line(length: 100%)
]
}),
footer: ""
)
#include "pages/gender-note.typ"
#include "pages/working-packages.typ"
#let heading_outline_title = if prelude.format.language == "de" [
Inhaltsverzeichnis
] else if prelude.format.language == "en" [
Table of contents
] else [
#panic("no translation for language: ", prelude.format.language)
]
#outline(title: heading_outline_title, indent: auto)
#pagebreak()
#let image_outline_title = if prelude.format.language == "de" [
Abbildungsverzeichnis
] else if prelude.format.language == "en" [
List of figures
] else [
#panic("no translation for language: ", prelude.format.language)
]
#outline(
title: "Abbildungsverzeichnis",
target: figure.where(kind: image),
)
#pagebreak()
#let table_outline_title = if prelude.format.language == "de" [
Tabellensverzeichnis
] else if prelude.format.language == "en" [
List of tables
] else [
#panic("no translation for language: ", prelude.format.language)
]
#outline(
title: table_outline_title,
target: figure.where(kind: table),
)
#pagebreak()
#let raw_outline_title = if prelude.format.language == "de" [
Quelltextverzeichnis
] else if prelude.format.language == "en" [
Table of source code
] else [
#panic("no translation for language: ", prelude.format.language)
]
#outline(
title: raw_outline_title,
target: figure.where(kind: raw),
)
#pagebreak()
// for creating glossary
#import "@preview/glossarium:0.2.6": make-glossary, print-glossary, gls, glspl
#show: make-glossary
#if prelude.format.language == "de" [
= Glossar
] else if prelude.format.language == "en" [
= Glossary
] else [
#panic("no translation for language: ", prelude.format.language)
]
// read all entries from config file
#let glossary = yaml("../conf/glossary.yaml")
// destination array
#let glossary_entries = ()
// parse TOML entries into correct format
#if glossary.glossary != none {
for entry in glossary.glossary {
let short = entry.at("short", default: none)
let long = entry.at("long", default: none)
let desc = entry.at("desc", default: none)
if short == none {
panic("Key of glossary term must be specified")
}
glossary_entries.push((key: short, short: short, long: long, desc: desc))
}
}
#print-glossary(glossary_entries)
#pagebreak()
#include "content/audition.typ"
#include "content/preface.typ"
#include "content/outline.typ"
// reset page counter
#counter(page).update(0)
= Abteilung
#counter(page).update(1)
#set heading(numbering: "1.")
// start numbering pages with numeric digits
#set page(numbering: "1.")
#let filter_heading(heading) = {
heading.level == 1
}
#set page(
binding: left,
header-ascent: 1em,
header-ascent: 2em,
header: locate(loc => {
align(left, context [
#let current_heading = query(selector(heading).after(here())).filter(filter_heading).first()
#let heading_depth = counter(heading).get().at(0) + 1
#heading_depth
#h(0.25cm)
#current_heading.body
])
v(-2em)
align(right, counter(page).display("1"))
v(-1em)
line(length: 100%)
let current_heading = query(selector(heading).after(here())).filter(filter_heading).first()
let heading_depth = counter(heading).get().at(0) + 1
table(columns: (1fr, auto),
align: (left, right),
stroke: none,
inset: (top: 0pt, bottom: 0.5em, left: 0pt, right: 0pt),
text(size: prelude.to_pt(prelude.format.font-size))[#heading_depth #current_heading.body],
text(size: prelude.to_pt(prelude.format.font-size), counter(page).display("1")),
table.hline()
)
}),
footer: ""
)
#set page(numbering: "1.")
#include "pages/introduction.typ"
= Kapitel
// ------------------------------------------
// Actual work pages follow here
// ------------------------------------------
== Überschrift 2
#pagebreak()
#lorem(200)
= Kapitel 2
=== Überschrift 3
#lorem(50)
#pagebreak()
#set heading(numbering: none)
#set page(
header: locate(loc => {
align(left, context [
#let current_heading = query(selector(heading).after(here())).filter(filter_heading).first()
#current_heading.body
])
v(-2em)
align(right, counter(page).display("1"))
v(-1em)
line(length: 100%)
}),
)
#bibliography(
style: "ieee",
"../conf/bibliography.bib"
)
#include "content/bibliography.typ"

View File

@ -28,7 +28,10 @@
// subtitle
#prelude.subtitle(prelude.info.untertitel)
#set align(left)
#v(1cm)
#prelude.largetext()[
#if prelude.format.language == "de" [
selbständig verfasst und keine anderen als die angegebenen Quellen und Hilfsmittel benutzt habe.

View File

@ -21,5 +21,3 @@
#panic("no translation for language: ", prelude.format.language)
]
]
#pagebreak()

View File

@ -0,0 +1,4 @@
#import "../prelude.typ" as prelude
= Einleitung

10
src/pages/preface.typ Normal file
View File

@ -0,0 +1,10 @@
#import "../prelude.typ" as prelude
= Vorwort
= Firmengeschichte
= Das Unternehmen ABB
= Abteilung

View File

@ -68,6 +68,7 @@
#if prelude.format.language == "de" [
#table(
columns: 2,
column-gutter: 1cm,
align: left,
stroke: none,
@ -92,6 +93,7 @@
] else if prelude.format.language == "en" [
#table(
columns: 2,
column-gutter: 1cm,
align: left,
stroke: none,