diff --git a/src/conf.typ b/src/conf.typ index 02b6303..b9e1328 100644 --- a/src/conf.typ +++ b/src/conf.typ @@ -104,7 +104,15 @@ } else if val == none or type(val) == type(update_val) { base.insert(key, update_val) } else { - panic("missmatched dictionary entry `" + key + "` type: expected `" + type(val) + "` got `" + type(update_val) + "`") + panic( + "missmatched dictionary entry `" + + key + + "` type: expected `" + + type(val) + + "` got `" + + type(update_val) + + "`", + ) } } else { base.insert(key, val) diff --git a/src/glossarium.typ b/src/glossarium.typ index 9db2172..4d37ef2 100644 --- a/src/glossarium.typ +++ b/src/glossarium.typ @@ -59,8 +59,13 @@ SOFTWARE.*/ let textLink = if display != none { [#display] } else if ( - is_first or long == true - ) and entlong != [] and entlong != "" and long != false { + ( + is_first or long == true + ) + and entlong != [] + and entlong != "" + and long != false + ) { [#entlong (#entry.short#suffix)] } else { [#entry.short#suffix] @@ -108,8 +113,13 @@ SOFTWARE.*/ } let textLink = if ( - is_first or long == true - ) and entlong != [] and entlong != "" and long != false { + ( + is_first or long == true + ) + and entlong != [] + and entlong != "" + and long != false + ) { [#entlong (#short)] } else { [#short] @@ -128,9 +138,11 @@ SOFTWARE.*/ // show rule to make the references for glossarium #let make-glossary(body) = { show ref: r => { - if r.element != none and r.element.func() == figure and r - .element - .kind == __glossarium_figure { + if ( + r.element != none + and r.element.func() == figure + and r.element.kind == __glossarium_figure + ) { // call to the general citing function gls(str(r.target), suffix: r.citation.supplement) } else { @@ -197,6 +209,7 @@ SOFTWARE.*/ #let hasLong = long != "" and long != [] #let hasDesc = desc != "" and desc != [] + #set align(left) #block( below: 1.5em, width: 100%, @@ -229,16 +242,15 @@ SOFTWARE.*/ ) .values .map(x => { - let page-numbering = x.page-numbering() - if page-numbering == none { - page-numbering = "1" - } - link(x)[#numbering( - page-numbering, - ..counter(page).at(x), - )] + let page-numbering = x.page-numbering() + if page-numbering == none { + page-numbering = "1" } - ) + link(x)[#numbering( + page-numbering, + ..counter(page).at(x), + )] + }) .join(", ") } ], diff --git a/src/glossary.typ b/src/glossary.typ index d6d674c..fbbce7b 100644 --- a/src/glossary.typ +++ b/src/glossary.typ @@ -43,14 +43,18 @@ if "desc" in v { assert( type(v.desc) == str, - message: "The description of glossary entry `" + k + "` is not a string", + message: "The description of glossary entry `" + + k + + "` is not a string", ) } if "group" in v { assert( type(v.group) == str, - message: "The optional group of glossary entry `" + k + "` is not a string", + message: "The optional group of glossary entry `" + + k + + "` is not a string", ) } else { let acronym_group = if config.lang == "de" { @@ -89,11 +93,13 @@ } } - return processed_glossary.pairs().map(((key, entry)) => ( - key: key, - short: entry.short, - long: eval(entry.at("long", default: ""), mode: "markup"), - desc: eval(entry.at("desc", default: ""), mode: "markup"), - group: entry.at("group", default: ""), - )) + return processed_glossary + .pairs() + .map(((key, entry)) => ( + key: key, + short: entry.short, + long: eval(entry.at("long", default: ""), mode: "markup"), + desc: eval(entry.at("desc", default: ""), mode: "markup"), + group: entry.at("group", default: ""), + )) } diff --git a/src/lib.typ b/src/lib.typ index 812412d..a861ed9 100644 --- a/src/lib.typ +++ b/src/lib.typ @@ -126,7 +126,9 @@ config, context [ // add bibliography if set - #if "bibliography" in config.thesis and config.thesis.bibliography != none { + #if ( + "bibliography" in config.thesis and config.thesis.bibliography != none + ) { pagebreak(weak: true) counter(page).update(1) set bibliography( diff --git a/src/pages/confidentiality-statement.typ b/src/pages/confidentiality-statement.typ index c655082..b5dedb1 100644 --- a/src/pages/confidentiality-statement.typ +++ b/src/pages/confidentiality-statement.typ @@ -50,13 +50,24 @@ set align(horizon) grid( - // set width of columns - // we need two, so make both half the page width - columns: (50%, 50%), - row-gutter: 0.75em, - align(left, {line(length: 6cm)}), - align(left, {line(length: 6cm)}), - align(left, if text.lang == "de" [ Ort, Datum ] else if text.lang == "en" [ Place, Date ] else { panic("no translation for language: ", text.lang) }), - align(left, if text.lang == "de" [ Unterschrift ] else if text.lang == "en" [ Signature ] else { panic("no translation for language: ", text.lang) })) + // set width of columns + // we need two, so make both half the page width + columns: (50%, 50%), + row-gutter: 0.75em, + align(left, { line(length: 6cm) }), + align(left, { line(length: 6cm) }), + align( + left, + if text.lang == "de" [ Ort, Datum ] else if text.lang == "en" [ + Place, Date + ] else { panic("no translation for language: ", text.lang) }, + ), + align( + left, + if text.lang == "de" [ Unterschrift ] else if text.lang == "en" [ + Signature + ] else { panic("no translation for language: ", text.lang) }, + ) + ) } ) diff --git a/src/pages/declaration-of-authorship.typ b/src/pages/declaration-of-authorship.typ index 4438d43..1e62bae 100644 --- a/src/pages/declaration-of-authorship.typ +++ b/src/pages/declaration-of-authorship.typ @@ -52,13 +52,24 @@ set align(horizon) grid( - // set width of columns - // we need two, so make both half the page width - columns: (50%, 50%), - row-gutter: 0.75em, - align(left, {line(length: 6cm)}), - align(left, {line(length: 6cm)}), - align(left, if text.lang == "de" [ Ort, Datum ] else if text.lang == "en" [ Place, Date ] else { panic("no translation for language: ", text.lang) }), - align(left, if text.lang == "de" [ Unterschrift ] else if text.lang == "en" [ Signature ] else { panic("no translation for language: ", text.lang) })) + // set width of columns + // we need two, so make both half the page width + columns: (50%, 50%), + row-gutter: 0.75em, + align(left, { line(length: 6cm) }), + align(left, { line(length: 6cm) }), + align( + left, + if text.lang == "de" [ Ort, Datum ] else if text.lang == "en" [ + Place, Date + ] else { panic("no translation for language: ", text.lang) }, + ), + align( + left, + if text.lang == "de" [ Unterschrift ] else if text.lang == "en" [ + Signature + ] else { panic("no translation for language: ", text.lang) }, + ) + ) } ) diff --git a/src/pages/outline.typ b/src/pages/outline.typ index e650f21..09174e0 100644 --- a/src/pages/outline.typ +++ b/src/pages/outline.typ @@ -18,9 +18,12 @@ show outline.entry: it => { link(it.element.location())[ #v(12pt, weak: true) - #text(weight: "regular", it.body) + #it.prefix() + #[:] + #h(0.5em) + #text(weight: "regular", it.body()) #box(width: 1fr, it.fill) - #[ #it.page] + #[ #it.page()] ] } diff --git a/src/pages/titlepage.typ b/src/pages/titlepage.typ index eae556a..c260eed 100644 --- a/src/pages/titlepage.typ +++ b/src/pages/titlepage.typ @@ -21,14 +21,27 @@ if config.style.header.logo-image == none { // error } else if config.style.header.logo-image.len() > 0 { - align(left, image(config.style.header.logo-image, height: config.style.header.logo-height)) + align( + left, + image( + config.style.header.logo-image, + height: config.style.header.logo-height, + ), + ) } else { - align(left, image("../res/DHBW.svg", height: config.style.header.logo-height)) + align( + left, + image("../res/DHBW.svg", height: config.style.header.logo-height), + ) }, // right align logo of DHBW if config.style.header.logo-image.len() > 0 { - align(right, image("../res/DHBW.svg", height: config.style.header.logo-height)) - }) + align( + right, + image("../res/DHBW.svg", height: config.style.header.logo-height), + ) + } + ) #set align(center) @@ -108,20 +121,20 @@ .authors .slice(i * 3, i * 3 + cols) .map(author => par([ - #if author.at("name", default: none) != none { - text(size: 1.25em, author.name) - linebreak() - } - #if author.at("company", default: none) != none { - text(size: 1em, author.company) - linebreak() - } - #if author.at("contact", default: none) != none { - text(size: 1em, author.contact) - linebreak() - } - #str(author.matriculation-number), #author.course - ]))) + #if author.at("name", default: none) != none { + text(size: 1.25em, author.name) + linebreak() + } + #if author.at("company", default: none) != none { + text(size: 1em, author.company) + linebreak() + } + #if author.at("contact", default: none) != none { + text(size: 1em, author.contact) + linebreak() + } + #str(author.matriculation-number), #author.course + ]))) } ] @@ -135,18 +148,21 @@ align( bottom, grid( - // set width of columns - // we need two, so make both half the page width - columns: (60%, 40%), - align(left, if text.lang == "de" [ - Unterschrift des betrieblichen Betreuers - ] else if text.lang == "en" [ - Signature of the company supervisor - ] else [ - #context panic("no translation for language: ", text.lang) - ] + // set width of columns + // we need two, so make both half the page width + columns: (60%, 40%), + align( + left, + if text.lang == "de" [ + Unterschrift des betrieblichen Betreuers + ] else if text.lang == "en" [ + Signature of the company supervisor + ] else [ + #context panic("no translation for language: ", text.lang) + ], + ), + align(right, { line(length: 6cm) }) ), - align(right, {line(length: 6cm)})), ) } diff --git a/src/style.typ b/src/style.typ index 4ac3150..1c659ee 100644 --- a/src/style.typ +++ b/src/style.typ @@ -166,10 +166,10 @@ .map(make_row) .flatten() .map(c => if c.has("text") and c.text == "" { - v(1em) - } else { - c - }) + v(1em) + } else { + c + }) ) }, ) @@ -193,13 +193,15 @@ // change the display supplement according to the text langugae // based on: https://github.com/typst/typst/issues/3273 - show figure.where(kind: raw): set figure(supplement: context { - if text.lang == "de" { - "Quelltext" - } else { - "Listing" - } - }) + show figure.where(kind: raw): set figure( + supplement: context { + if text.lang == "de" { + "Quelltext" + } else { + "Listing" + } + }, + ) // APA style table set table( @@ -245,9 +247,9 @@ header-ascent: style.header.content-padding, footer-descent: style.header.content-padding, margin: ( - top: style.page.margin.top + style.header.underline-top-padding + style - .header - .content-padding, + top: style.page.margin.top + + style.header.underline-top-padding + + style.header.content-padding, bottom: style.page.margin.bottom + style.footer.content-padding, left: style.page.margin.left, right: style.page.margin.right, @@ -256,15 +258,13 @@ 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 { + } else if ( + query().first().location().page() >= current-page + ) { numbering("1", nums.pos().first()) } else { numbering("a", nums.pos().first()) @@ -277,10 +277,14 @@ #if page-number == 1 { [] - } else if query().first().location().page() > page-number { + } else if ( + query().first().location().page() > page-number + ) { set align(center) numbering("I", page-counter) - } else if query().first().location().page() >= page-number { + } else if ( + query().first().location().page() >= page-number + ) { numbering( "1 / 1", page-counter, @@ -296,13 +300,11 @@ if current-page == 1 { // logo moved to content - } else if query() - .first() - .location() - .page() >= current-page and query() - .first() - .location() - .page() < current-page + 1 { + } else if ( + query().first().location().page() >= current-page + and query().first().location().page() + < current-page + 1 + ) { let heading = currentH() heading.at(0) diff --git a/template/main.typ b/template/main.typ index 8048297..32c73c0 100644 --- a/template/main.typ +++ b/template/main.typ @@ -45,7 +45,7 @@ ) )) -#import "@preview/wrap-it:0.1.0": wrap-content +#import "@preview/wrap-it:0.1.1": wrap-content = Lorem Ipsum