diff --git a/.gitignore b/.gitignore index 7322f9a..efd937c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,8 @@ tudapub*.pdf example_*.pdf test*.pdf -!example_tudapub.pdf \ No newline at end of file +!example_tudapub.pdf + +.vscode +.DS_Store +.venv \ No newline at end of file diff --git a/common/colorutil.typ b/common/colorutil.typ new file mode 100644 index 0000000..77ef841 --- /dev/null +++ b/common/colorutil.typ @@ -0,0 +1,23 @@ +#let calc-color-component(srgb) = { + if srgb <= 0.03928 { + return srgb / 12.92 + } else { + return calc.pow((srgb + 0.055) / 1.055, 2.4) + } +} + +#let calc-relative-luminance(color) = { + let rgb_color = rgb(color.to-hex()) + let components = rgb_color.components(alpha: false) + + let r_srgb = float(components.at(0)) + let b_srgb = float(components.at(1)) + let g_srgb = float(components.at(2)) + return calc-color-component(r_srgb) * 0.2126 + calc-color-component(b_srgb) * 0.0722 + calc-color-component(g_srgb) * 0.7152 +} + +#let calc-contrast(rl1, rl2) = { + let l1 = calc.max(rl1, rl2) + let l2 = calc.min(rl1, rl2) + return (l1 + 0.05) / (l2 + 0.05) +} \ No newline at end of file diff --git a/common/dictutil.typ b/common/dictutil.typ new file mode 100644 index 0000000..54090be --- /dev/null +++ b/common/dictutil.typ @@ -0,0 +1,8 @@ +#let overwrite-dict(new, base) = { + for key in base.keys() { + if key in new { + base.insert(key, new.at(key)) + } + } + return base +} \ No newline at end of file diff --git a/common/headings.typ b/common/headings.typ index a8536cc..98562e8 100644 --- a/common/headings.typ +++ b/common/headings.typ @@ -1,4 +1,6 @@ -#import "props.typ": tud_heading_line_thin_stroke +#import "props.typ": tud_heading_line_thin_stroke, tud_header_line_height + +#let tud_body_line_height = tud_header_line_height / 2 #let tud-heading-with-lines( heading_margin_before: 0mm, @@ -42,4 +44,49 @@ v(10pt) ) ] +} + +#let tuda-section-lines(above: 1.8em, below: 1.2em, ruled: true, body) = { + block( + width: 100%, + inset: 0mm, + outset: 0mm, + above: above, + below: below, + { + set block(spacing: 0.2em) + if ruled { + line(length: 100%, stroke: tud_body_line_height) + } + body + if ruled { + line(length: 100%, stroke: tud_body_line_height) + } + } + ) +} + + +/// Creates a section similar to headers +/// But does not add other text or a counter. +/// ``` +/// #tuda-section("Lorem ipsum") +/// ``` +/// - title (str): The title of this section +#let tuda-section(title) = { + tuda-section-lines(text(title, font: "Roboto", weight: "bold", size: 11pt)) +} + +/// Creates a subsection similar to level 2 headers. +/// But does not add other text or a counter. +/// ``` +/// #tuda-subsection("Lorem ipsum") +/// ``` +/// - title (str): The title of this subsection +#let tuda-subsection(title) = { + tuda-section-lines(above: 1.4em, below: 1em, text(title, font: "Roboto", weight: "regular", size: 11pt)) +} + +#let tuda-subsection-unruled(title) = { + tuda-section-lines(above: 1.4em, below: 1em, ruled: false, text(title, font: "Roboto", weight: "regular", size: 11pt)) } \ No newline at end of file diff --git a/common/props.typ b/common/props.typ index f4147f1..ec1e4e4 100644 --- a/common/props.typ +++ b/common/props.typ @@ -2,7 +2,9 @@ #let tud_heading_line_thin_stroke = 0.75pt - +#let tud_header_line_height = 1.2pt +#let tud_inner_page_margin_top = 22pt +#let tud_title_logo_height = 22mm #let tud_page_margin_title_page = ( @@ -31,4 +33,11 @@ left: 25mm, right: 25mm, bottom: 15mm - 1mm // should be 20mm according to guidelines +) + +#let tud_exercise_page_margin = ( + top: 15mm, + left: 15mm, + right: 15mm, + bottom: 20mm, ) \ No newline at end of file diff --git a/common/tudacolors.typ b/common/tudacolors.typ index 925180a..e0d211d 100644 --- a/common/tudacolors.typ +++ b/common/tudacolors.typ @@ -52,4 +52,55 @@ "9d": "961C26", "10d": "732054", "11d": "4C226A", +) + +#let text_colors = ( + "0a": black, + "0b": white, + "0c": white, + "0d": white, + "1a": white, + "1b": white, + "1c": white, + "1d": white, + "2a": white, + "2b": white, + "2c": white, + "2d": white, + "3a": white, + "3b": white, + "3c": white, + "3d": white, + "4a": black, + "4b": white, + "4c": white, + "4d": white, + "5a": black, + "5b": black, + "5c": black, + "5d": white, + "6a": black, + "6b": black, + "6c": white, + "6d": white, + "7a": black, + "7b": black, + "7c": white, + "7d": white, + "8a": white, + "8b": white, + "8c": white, + "8d": white, + "9a": white, + "9b": white, + "9c": white, + "9d": white, + "10a": white, + "10b": white, + "10c": white, + "10d": white, + "11a": white, + "11b": white, + "11c": white, + "11d": white ) \ No newline at end of file diff --git a/scripts/publish.py b/scripts/publish.py index 1a472f5..a5c4dba 100644 --- a/scripts/publish.py +++ b/scripts/publish.py @@ -5,6 +5,7 @@ import shutil import pathlib import re +import sys @@ -29,6 +30,10 @@ /common/ /assets/ +.DS_Store +.venv +.vscode + """ # template folder names @@ -56,7 +61,7 @@ description='Copies this repo to typst local packages or locally cloned typst-packages while not copying the ignored files.' ) parser.add_argument('--local', action='store_true', - help='copy to $HOME/.local/share/typst/packages/local//.99') + help='copy to $TYPST_PACKAGE_ROOT/typst/packages/local//.99') parser.add_argument('--clean-dist-folder-force', action='store_true', help='Delete the contents of the destinatio folder before copying without asking. ') parser.add_argument('--universe', type=str, @@ -75,7 +80,15 @@ exit(0) if args.local: - copy_dest_dir = str(pathlib.Path.home()) + "/.local/share/typst/packages/local/" + if sys.platform.startswith("linux"): + copy_dest_dir = str(pathlib.Path.home()) + "/.local/share/typst/packages/local/" + elif sys.platform.startswith("win32"): + copy_dest_dir = os.getenv("APPDATA") + "/typst/packages/local/" + elif sys.platform.startswith("darwin"): + copy_dest_dir = str(pathlib.Path.home()) + "/Library/Application Support/typst/packages/local/" + else: + print('Error: Unsupported platform') + exit(0) elif args.universe is not None: copy_dest_dir = args.universe + '/packages/preview/' @@ -134,7 +147,7 @@ def copy_template(copy_dest_dir, template_folder_name = 'tudapub'): /templates_examples/*/logos/* !/templates_examples/*/logos/*.sh /templates_examples/*/fonts/* - !/template_examples/*/fonts/*.sh + !/templates_examples/*/fonts/*.sh """) diff --git a/templates/tudaexercise/preview/tudaexercise_prev-1.png b/templates/tudaexercise/preview/tudaexercise_prev-1.png index dffdc9d..9cc1e2e 100644 Binary files a/templates/tudaexercise/preview/tudaexercise_prev-1.png and b/templates/tudaexercise/preview/tudaexercise_prev-1.png differ diff --git a/templates/tudaexercise/preview/tudaexercise_prev_darkmode.png b/templates/tudaexercise/preview/tudaexercise_prev_darkmode.png new file mode 100644 index 0000000..626045a Binary files /dev/null and b/templates/tudaexercise/preview/tudaexercise_prev_darkmode.png differ diff --git a/templates/tudaexercise/template/lib.typ b/templates/tudaexercise/template/lib.typ index d7b55d1..197af89 100644 --- a/templates/tudaexercise/template/lib.typ +++ b/templates/tudaexercise/template/lib.typ @@ -1,3 +1,4 @@ -#import "tudaexercise.typ": tuda-exercise -#import "common/tudacolors.typ": tuda_colors +#import "tudaexercise.typ": tudaexercise +#import "common/headings.typ": tuda-section, tuda-subsection +#import "common/tudacolors.typ": tuda_colors, text_colors as tuda_text_colors #import "common/props.typ": * \ No newline at end of file diff --git a/templates/tudaexercise/template/locales.typ b/templates/tudaexercise/template/locales.typ new file mode 100644 index 0000000..81b51fa --- /dev/null +++ b/templates/tudaexercise/template/locales.typ @@ -0,0 +1,11 @@ +#let dict_de = ( + sheet: "Übungsblatt", + task: "Aufgabe", + locale: "ger" +) + +#let dict_en = ( + sheet: "Sheet", + task: "Task", + locale: "eng" +) \ No newline at end of file diff --git a/templates/tudaexercise/template/title.typ b/templates/tudaexercise/template/title.typ new file mode 100644 index 0000000..5a0c6f3 --- /dev/null +++ b/templates/tudaexercise/template/title.typ @@ -0,0 +1,103 @@ +#import "common/format.typ": format-date + +#let tuda-make-title( + inner_page_margin_top, + title_rule, + accent_color, + on_accent_color, + text_color, + colorback, + logo_element, + logo_height, + info, + dict +) = { + let text_on_accent_color = if colorback { + on_accent_color + } else { + text_color + } + + let text_inset = if colorback { + (left:3mm) + } else { + () + } + + let stroke = (paint: text_color, thickness: title_rule / 2) + + v(-inner_page_margin_top + 0.2mm) // would else draw over header + + box( + fill: if colorback {accent_color}, + width: 100%, + outset: 0pt, + { + // line creates a paragraph spacing + set par(spacing: 4pt) + v(logo_height / 2) + grid( + columns: (1fr, auto), + box(inset: (y:3mm),{ + set text(font: "Roboto", weight: "bold", size: 12pt, fill: text_on_accent_color) + grid(row-gutter: 1em, + inset: text_inset, + if info.title != none { + text(info.title, size: 20pt) + }, + if info.subtitle != none { + info.subtitle + }, + if info.author != none { + if type(info.author) == array { + for author in info.author { + author + linebreak() + } + } else { + info.author + } + } + ) + + v(.5em) + } + ), + { + if logo_element != none { + move( + dx: 6mm, + { + set image(height: logo_height) + logo_element + } + ) + } + } + ) + v(6pt) + line(length: 100%, stroke: stroke) + if info.term != none or info.date != none or info.sheetnumber != none { + set text(fill: text_on_accent_color) + grid( + inset: text_inset, + row-gutter: 0.4em, + if info.term != none { + info.term + }, + if info.date != none { + if type(info.date) == datetime { + format-date(info.date, dict.locale) + } else { + info.date + } + }, + if info.sheetnumber != none { + dict.sheet + " " + str(info.sheetnumber) + } + ) + line(length: 100%, stroke: stroke) + } + } + ) +} \ No newline at end of file diff --git a/templates/tudaexercise/template/tudaexercise.typ b/templates/tudaexercise/template/tudaexercise.typ index ca13d3f..64c1090 100644 --- a/templates/tudaexercise/template/tudaexercise.typ +++ b/templates/tudaexercise/template/tudaexercise.typ @@ -1,238 +1,242 @@ -#import "common/tudacolors.typ": tuda_colors -#import "common/props.typ": * -#import "common/util.typ": * -#import "common/footnotes.typ": * -#import "common/headings.typ": * -#import "common/page_components.typ": * +#import "common/tudacolors.typ": tuda_colors, text_colors +#import "common/props.typ": tud_exercise_page_margin, tud_header_line_height, tud_inner_page_margin_top, tud_title_logo_height +#import "common/headings.typ": tuda-section, tuda-subsection, tuda-subsection-unruled +#import "common/util.typ": check-font-exists +#import "common/colorutil.typ": calc-relative-luminance, calc-contrast +#import "common/dictutil.typ": overwrite-dict +#import "title.typ": * +#import "locales.typ": * + +#let design_defaults = ( + accentcolor: "0b", + colorback: true, + darkmode: false +) + +/// The heart of this template. +/// Usage: +/// ``` +/// #show: tudaexercise.with() +/// ``` +/// +/// - language ("eng", "ger"): The language for dates and certain keywords +/// - margins (dictionary): The page margins, possible entries: `top`, `left`, `bottom`, `right` +/// - headline (array): Currently not supported. Should be used to configure the headline. +/// - paper (str): The type of paper to be used. Currently only a4 is supported. +/// - logo (content): The tuda logo as an image to be used in the title. +/// - info (dictionary): Info about the document mostly used in the title. +/// - design (dictionary): Options for the design of the template. Possible entries: `accentcolor`, `colorback` and `darkmode` +/// - show_title (bool): Whether to show a title or not +/// - subtask ("ruled", "plain"): How subtasks are shown +/// - body (content): +#let tudaexercise( + language: "eng", -#import "@preview/i-figured:0.2.3" + margins: tud_exercise_page_margin, + headline: ("title", "name", "id"), -#let tuda-exercise( - title: [Title], - exercise-number: 1, + paper: "a4", - // The code of the accentcolor. - // A list of all available accentcolors is in the list tuda_colors - accentcolor: "9c", + logo: none, + + info: ( + title: none, + // Currently not supported + header_title: none, + subtitle: none, + author: none, + term: none, + date: none, + sheetnumber: none, + ), - // Size of the main text font - fontsize: 10pt,//10.909pt, //11pt, + design: design_defaults, - // Currently just a4 is supported - paper: "a4", + show_title: true, - // Author name as text, e.g "Albert Author" - author: "An Author", + subtask: "ruled", - // Date of submission as string - data: datetime( - year: 2023, - month: 10, - day: 4, - ), + body +) = { + if paper != "a4" { + panic("currently just a4 paper is supported") + } - // language for correct hyphenation - language: "eng", + let margins = overwrite-dict(margins, tud_exercise_page_margin) + let design = overwrite-dict(design, design_defaults) - // Set the margins of the content pages. - // The title page is not affected by this. - // Some example margins are defined in 'common/props.typ': - // - tud_page_margin_small // same as title page margin - // - tud_page_margin_big - // E.g. margin: ( - // top: 30mm, - // left: 31.5mm, - // right: 31.5mm, - // bottom: 56mm - // ), - margin: tud_page_margin_small, - - show-extended-header: true, + let text_color = if design.darkmode { + white + } else { + black + } - body + let background_color = if design.darkmode { + rgb(29,31,33) + } else { + white + } -) = context { - // checks - //assert(tuda_colors.keys().contains(accentcolor), "accentcolor unknown") - //assert.eq(paper, "a4", "currently just a4 is supported as paper size") - //[#paper] + let accent_color = if type(design.accentcolor) == color { + design.accentcolor + } else if type(design.accentcolor) == str { + rgb(tuda_colors.at(design.accentcolor)) + } else { + panic("Unsupported color format. Either pass a color code as a string or pass an actual color.") + } - // vars - let accentcolor_rgb = tuda_colors.at(accentcolor) - let heading_line_spacing = 4.4pt - let heading_margin_before = 12pt - let heading_3_margin_before = 12pt - let font-default = "XCharter" + let text_on_accent_color = if type(design.accentcolor) == str { + text_colors.at(design.accentcolor) + } else { + let lum = calc-relative-luminance(design.accentcolor) + if calc-contrast(lum, 0) > calc-contrast(lum, 1) { + black + } else { + white + } + } + state("tud_design").update(( + text_color: text_color, + background_color: background_color, + accent_color: accent_color, + text_on_accent_color: text_on_accent_color + )) + + set line(stroke: text_color) + + let ruled_subtask = if subtask == "ruled" { + true + } else if subtask == "plain" { + false + } else { + panic("Only 'ruled' and 'plain' are supported subtask options") + } + + let meta_document_title = if info.subtitle != none and info.title != none { + [#info.subtitle #sym.dash.em #info.title] + } else if info.title != none { + info.title + } else if info.subtitle != none { + info.subtitle + } else { + none + } - // Set document metadata. set document( - title: title, - author: author + title: meta_document_title, + author: if info.author != none { + info.author + } else { + () + } ) - // Set the default body font. set par( justify: true, //leading: 4.7pt//0.42em//4.7pt // line spacing - leading: 4.8pt//0.42em//4.7pt // line spacing + leading: 4.8pt,//0.42em//4.7pt // line spacing + spacing: 1.1em ) - show par: set block(below: 1.1em) // was 1.2em - - + set text( - font: font-default, - size: fontsize, + font: "XCharter", + size: 10.909pt, fallback: false, - lang: language, kerning: true, ligatures: false, - //spacing: 92% // to make it look like the latex template - //spacing: 84% // to make it look like the latex template - spacing: 91% // to make it look like the latex template + spacing: 91%, // to make it look like the latex template, + fill: text_color ) - if paper != "a4" { - panic("currently just a4 as paper is supported") + let dict = if language == "eng" { + dict_en + } else if language == "ger" { + dict_de + } else { + panic("Unsupported language") } - - - - /////////////////////////////////////// - // page setup - // with header and footer - let header = tud-header( - accentcolor_rgb: accentcolor_rgb, - content: if show-extended-header { - set text( - font: font-default, - size: fontsize - ) - v(2.5mm) - stack( - [Exercise #title], - v(2mm), - [Last Name, First Name: ], - v(2.5mm), - line(length: 100%, stroke: tud_heading_line_thin_stroke), - ) + set heading(numbering: (..numbers) => { + if info.sheetnumber != none { + numbering("1.1a", info.sheetnumber, ..numbers) + } else { + numbering("1a", ..numbers) } - ) + }) - let footer = [ - #text( - font: "Roboto", - stretch: 100%, - fallback: false, - weight: "regular", - size: 10pt - )[ - #set align(right) - // context needed for page counter for typst >= 0.11.0 - #context [ - #let counter_disp = counter(page).display() - #counter_disp - ] - ] - ] - - let header_height = measure(header).height - let footer_height = measure(footer).height - - // inner page margins (from header to text and text to footer) - let inner_page_margin_top = 5mm //0pt//20pt //3mm - let inner_page_margin_bottom = 30pt - - - - - - //////////////////////////// - // content page setup - let content_page_margin_full_top = margin.top + inner_page_margin_top + 1*header_height - - - /////////////////////////////////////// - // headings - set heading( - numbering: (..numbers) => { - [#exercise-number.] - numbering("1 a", ..numbers) + show heading: it => { + if not it.outlined or it.numbering == none { + it + return + } + let c = counter(heading).display(it.numbering) + if it.level == 1 { + tuda-section(dict.task + " " + c + ": " + it.body) + } else if it.level == 2 { + if ruled_subtask { + tuda-subsection(c + ") " + it.body) + } else { + tuda-subsection-unruled(c + ") " + it.body) + } + } else { + it } - ) - show heading.where( - ): it => { - assert(it.level <= 2) - - let title-prefix = if it.level <= 1 {"Taks "} else {""} - tud-heading-with-lines( - heading_margin_before: heading_margin_before, - heading_line_spacing: heading_line_spacing, - text-size: 10pt, - text-prefix: title-prefix, - counter-suffix: if it.level > 1 {")"} else {":"}, - text-weight: if it.level > 1 {"regular"} else {"bold"}, - it - ) - } - - - - /////////////////////////////////////// - // configure footnotes - set footnote.entry( - separator: line(length: 40%, stroke: 0.5pt) + let identbar = rect( + fill: accent_color, + width: 100%, + height: 4mm ) - // somehow broken: - //show footnote.entry: it => tud-footnote(it) - - - /////////////////////////////////////// - // Display font checks - check-font-exists("Roboto") - check-font-exists("XCharter") - - - - - /////////////////////////////////////// - // Content pages - - // body has different margins than title page - // @todo some bug seems to insert an empty page at the end when content (title page) appears before this second 'set page' - set page( - margin: ( - left: margin.left, //15mm, - right: margin.right, //15mm, - top: margin.top + inner_page_margin_top + 1*header_height, // 15mm - bottom: margin.bottom + inner_page_margin_bottom + footer_height //20mm - ), - // header - header: header, - // don't move header up -> so that upper side is at 15mm from top - header-ascent: inner_page_margin_top,//0%, - // footer - footer: footer, - footer-descent: inner_page_margin_bottom //footer_height // @todo + let header_frontpage = grid( + rows: auto, + row-gutter: 1.4mm + 0.25mm, + identbar, + line(length: 100%, stroke: tud_header_line_height), ) - // disable heading outlined for outline - set heading(outlined: false) + context { + let height_header = measure(header_frontpage).height + + set page( + paper: paper, + numbering: "1", + number-align: right, + margin: ( + top: margins.top + tud_inner_page_margin_top + height_header, + bottom: margins.bottom, + left: margins.left, + right: margins.right + ), + header: header_frontpage, + header-ascent: tud_inner_page_margin_top, + footer: none, + footer-descent: 0mm, + fill: background_color + ) - // restart page counter - counter(page).update(1) - // restart heading counter - counter(heading).update(0) + if show_title { + tuda-make-title( + tud_inner_page_margin_top, + tud_header_line_height, + accent_color, + text_on_accent_color, + text_color, + design.colorback, + logo, + tud_title_logo_height, + info, + dict + ) + } + check-font-exists("Roboto") + check-font-exists("XCharter") - // enable heading outlined for body - set heading(outlined: true) + body + } - // Display the paper's contents. - body -} +} \ No newline at end of file diff --git a/templates/tudaexercise/typst.toml b/templates/tudaexercise/typst.toml index d5b5557..570d7f6 100644 --- a/templates/tudaexercise/typst.toml +++ b/templates/tudaexercise/typst.toml @@ -2,15 +2,15 @@ name = "athena-tu-darmstadt-exercise" version = "0.1.0" entrypoint = "template/lib.typ" -authors = ["JeyRunner "] +authors = ["JeyRunner ", "FussballAndy "] license = "MIT" description = "Exercise template for TU Darmstadt (Technische Universität Darmstadt)." repository = "https://github.com/JeyRunner/tuda-typst-templates" keywords = ["TU Darmstadt", "Technische Universität Darmstadt", "Exercise"] -categories = ["exercise"] -exclude = ["tests", "example_tudapub.pdf", "example_tudapub.typ"] +categories = ["layout"] +compiler = "0.12.0" [template] path = "example" entrypoint = "main.typ" -thumbnail = "preview/tudaexercise_prev-01.png" +thumbnail = "preview/tudaexercise_prev-1.png" diff --git a/templates_examples/tudaexercise/main.typ b/templates_examples/tudaexercise/main.typ index f80b41e..3c87147 100644 --- a/templates_examples/tudaexercise/main.typ +++ b/templates_examples/tudaexercise/main.typ @@ -1,36 +1,103 @@ +#import "@local/athena-tu-darmstadt-exercise:0.1.0": tudaexercise, tuda-section, tuda-subsection -#import "@local/athena-tu-darmstadt-exercise:0.1.0": * - -#show: tuda-exercise.with( - title: [ - TUDaThesis - ], - exercise-number: 5, - author: "Albert Author", - accentcolor: "9c", +#show: tudaexercise.with( language: "eng", + info: ( + title: "Usage of TUDaExercise", + subtitle: "A small guide.", + author: "Andreas", + term: "Summer semester 2042", + date: datetime.today(), + sheetnumber: 5 + ), + logo: image("logos/tuda_logo.svg"), ) +#set enum(spacing: 1em, numbering: "1.", indent: 5pt) + += Most basic usage + +The easiest way is by using `typst init` like on this templates universe page. But here is everything broken down: + +== Add to typst ++ Import the package: `#import "@preview/athena-tu-darmstadt-exercise:0.1.0": *` + ++ Apply the template using `#show: tudaexercise.with()` + +== Fonts +The template requires the following fonts: Roboto and XCharter. Typst right now does not allow fonts to be installed as packages so you will either need to install them locally or configure Typst and co. to use the fonts. + +For more info: \ +https://github.com/JeyRunner/tuda-typst-templates?tab=readme-ov-file#logo-and-font-setup + +== Logo +Similarly as the logo is protected and Typst does not have a folder for global resources you will need to setup the logo manually. You will need to download the logo and convert it into a pdf. Then pass the `logo: image()` option to this package. The height of the logo will automatically be set to 22mm. + += Configuring the title +All options of the title can be controlled using the `info` dictionary: + +``` +info: ( + title: "The big title", + subtitle: "The smaller title below", + author: "The author, can also be an array of authors", + term: "The current term aka. semester", + date: "The current date, mostly appreciated as typst builtin datetime type", + sheetnumber: 0 // The current sheetnumber +) +``` +The options can also be left empty. Then their corresponding item will not appear. + +You might notice that there also is a `header_title` option. This option is not currently used as headlines are not yet implemented. + +If you do not want to have a the title block you can also set `show_title` to `false`. + +#pagebreak() + += Design + +You can control the design using the following options of the `design` dictionary: + +``` +design: ( + accentcolor: "0b", // either be color code of the TUDa coloring scheme or a typst color object + colorback: true, // whether the title should have the accent color as background, + darkmode: false, // If you like a dark background +) +``` + +Furthermore using the `tud_design` state you get a dictionary with the following colors used by the template: ` text_color, background_color, accent_color, text_on_accent_color`. + +Note that changing any of these values will have no effect on the template. See it as read-only. + +If you do not like lines around subtasks you can pass `subtask: "plain"` to not show the lines. += More options +The leftover options are `language` to control the language of certain keywords (can either be `"ger"` or `"eng"`) and `margins` which is a dictionary controlling the page margins. There are also the options `paper` which currently only supports `"a4"` and `headline` which currently is unsupported. += Creating tasks +Creating tasks is fairly easy. You simply write +``` += Title of your task +``` +Similarly subtasks are created using +``` +== Title of your subtask +``` -// test content -= First Chapter -A first demo chapter. +#tuda-subsection("Sections") +If you want to create a unnumbered section you can use the `tuda-section` or `tuda-subsection` functions accordingly. Simply pass the section title as a string. +``` +#tuda-subsection("Sections") +``` -== Some Basic Elements -This text contains two#footnote[The number two can also be written as 2.] footnotes#footnote[This is a first footnote. \ It has a second line.]. += Currently not supported features from the LaTeX template and the why -== Figures -The following @fig_test represents a demo Figure. -#figure( - rect(inset: 20pt, fill: gray)[ - Image - ], - caption: [The figure caption.] -) ++ Points -- This would require a state and make declaring tasks far more complex than just using headings, although technically the points can also be written manually into the function title. ++ Solutions -- The problem here is that enabling whether solutions should be shown form within a template requires states which are pretty costly. However you can implement them rather easily. ++ Headline -- This sadly can't be implemented manually as the core problem here comes from how Typst page margins and context work. There would be a workaround of just placing the title over the headline to mimic the frontpage. diff --git a/templates_examples/tudaexercise/refs.bib b/templates_examples/tudaexercise/refs.bib deleted file mode 100644 index d00dad3..0000000 --- a/templates_examples/tudaexercise/refs.bib +++ /dev/null @@ -1,9 +0,0 @@ -@online{TUDaGuideline, - title={Das Bild der TU Darmstadt}, - subtitle={Corporate Design Handbuch}, - edition={3}, - month={06}, - year={2011}, - url={https://www.intern.tu-darmstadt.de/media/medien_stabsstelle_km/services/medien_cd/das_bild_der_tu_darmstadt.pdf}, - urldate={2020-05-01} -} \ No newline at end of file