From 968f63be78153c02f1d9f7d0a6adf2c7d6de5bf7 Mon Sep 17 00:00:00 2001 From: teridax Date: Mon, 1 Jul 2024 14:46:32 +0200 Subject: [PATCH] fixed: outline including appendices --- examples/appendix.typ | 1 + examples/glossary.yml | 1 - examples/lipsum.typ | 7 +++---- src/pages/appendix.typ | 35 +++++++++++++++++++---------------- src/pages/outline.typ | 19 +++++++++++++------ src/style.typ | 8 +++----- src/template.typ | 29 ++++++++++++++++------------- 7 files changed, 55 insertions(+), 45 deletions(-) delete mode 100644 examples/glossary.yml diff --git a/examples/appendix.typ b/examples/appendix.typ index e600d52..370ade6 100644 --- a/examples/appendix.typ +++ b/examples/appendix.typ @@ -1,5 +1,6 @@ = Ein Text im Anhang +#label("Anhang-A") #lorem(50) diff --git a/examples/glossary.yml b/examples/glossary.yml deleted file mode 100644 index 8b13789..0000000 --- a/examples/glossary.yml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/examples/lipsum.typ b/examples/lipsum.typ index a058871..bc4de19 100644 --- a/examples/lipsum.typ +++ b/examples/lipsum.typ @@ -29,15 +29,13 @@ key: "oidc", short: "OIDC", long: "OpenID Connect", - desc: [OpenID is an open standard and decentralized authentication protocol promoted by the non-profit #link("https://en.wikipedia.org/wiki/OpenID#OpenID_Foundation")[OpenID Foundation].], - group: "Akronyme", + desc: [OpenID is an open standard and decentralized authentication protocol promoted by the non-profit #link("https://en.wikipedia.org/wiki/OpenID#OpenID_Foundation")[OpenID Foundation].] ), ( key: "potato", short: "potato", plural: "potatoes", - desc: [#lorem(10)], - group: "Begriffe" + desc: [#lorem(10)] ), ), appendices: include "appendix.typ" @@ -51,6 +49,7 @@ @oidc #lorem(100) +@Anhang-A == Lorem Ipsum 2 diff --git a/src/pages/appendix.typ b/src/pages/appendix.typ index 2b897e8..5359375 100644 --- a/src/pages/appendix.typ +++ b/src/pages/appendix.typ @@ -8,25 +8,28 @@ "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) + heading(level: 1, numbering: none, title) + v(-2em) + + // 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: title) + config.thesis.appendices } } diff --git a/src/pages/outline.typ b/src/pages/outline.typ index f978ad7..cb84f8b 100644 --- a/src/pages/outline.typ +++ b/src/pages/outline.typ @@ -55,21 +55,28 @@ pagebreak(weak: true) outline( + target: heading.where(supplement: [chapter]), title: heading(level: 3, title), indent: auto) } #let render_appendix_outline() = context { - if query(heading.where(supplement: [appendix])).len() > 0 { + let supplement = if text.lang == "en" { + [Appendix] + } else { + [Anhang] + } + + if query(heading.where(supplement: supplement)).len() > 0 { let title = if (text.lang == "de") { - "Anhangsverzeichnis" - } else if text.lang == "en" { - "Table of Appendices" - } + "Anhangsverzeichnis" + } else if text.lang == "en" { + "Table of Appendices" + } pagebreak(weak: true) outline( - target: heading.where(supplement: [appendix]), + target: heading.where(supplement: supplement), title: heading(level: 3, title), indent: auto) } diff --git a/src/style.typ b/src/style.typ index a79072f..2583fe8 100644 --- a/src/style.typ +++ b/src/style.typ @@ -32,6 +32,8 @@ font: "Montserrat", weight: "semibold") + #set heading(supplement: [chapter]) + // Set header spacing #show heading.where(level: 1): it => v(2em) + it + v(1em) #show heading.where(level: 2): it => v(1em) + it + v(0.5em) @@ -54,6 +56,7 @@ leading: 1em) #show link: set text(fill: red.darken(15%)) + #show ref: set text(fill: red.darken(15%)) #set heading(numbering: none) #set page( @@ -123,11 +126,6 @@ #body ] -#let prelude_styled(config: dictionary, body: content) = context [ - - #body -] - #let content_styled(config: dictionary, body: content) = [ // setup equate for sub equation labeling #import "@preview/equate:0.2.0": equate diff --git a/src/template.typ b/src/template.typ index 0bd2d64..5cab92b 100644 --- a/src/template.typ +++ b/src/template.typ @@ -10,7 +10,7 @@ // start of template pages and styles #let dhbw-template(config: dictionary, doc: content) = [ - #import "style.typ": global_styled_doc, prelude_styled, content_styled, end_styled + #import "style.typ": global_styled_doc, content_styled, end_styled // set document properties #set document( @@ -37,22 +37,18 @@ // 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) - #pagebreak(weak: true) - #new_confidentiality_statement_page(config) + #pagebreak(weak: true) + #new_declaration_of_authorship(config) - #pagebreak(weak: true) - #new_prerelease_note(config) + #pagebreak(weak: true) + #new_confidentiality_statement_page(config) - #pagebreak(weak: true) - #new_outline() + #pagebreak(weak: true) + #new_prerelease_note(config) - #pagebreak(weak: true) - #new_abstract(config) - ]) + #pagebreak(weak: true) + #new_outline() // glossary is built inline here because the links must be // exposed to the entire document @@ -60,7 +56,14 @@ #show: make-glossary #pagebreak(weak: true) + + #heading(supplement: [outline], "Glossar") + #print-glossary(config.thesis.glossary) + + #pagebreak(weak: true) + #new_abstract(config) + #pagebreak(weak: true) #counter(page).update(1)