Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modern-whs-assignment:0.2.0 #1776

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions packages/preview/modern-whs-assignment/0.2.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# WHS Assignment Template

![Title page](thumbnail.png)

This **unofficial** template can be used to write in [Typst](https://github.com/typst/typst) with the corporate design of the [Westfälische Hochschule](https://www.w-hs.de/).

#### Disclaimer

Please ask your supervisor if you are allowed to use typst and this template for your thesis or other documents.
Note that this template is not checked by the Westfälische Hochschule for correctness.
Thus, this template does not guarantee completeness or correctness.

## Usage

Create a new typst project based on this template locally.
```bash
typst init @preview/modern-whs-assignment
cd modern-whs-assignment
```

Or create a project on the typst web app based on this template.

## Configuration

The package can be configured where it is initialized. The configuration is done in the `meta.typ` file.

```typst
#show: whs-assignment.with(
meta.title,
meta.author,
meta.submission-date,
meta.keywords,
meta.course,
meta.lecturer,
meta.bibliography,
)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= Einleitung
14 changes: 14 additions & 0 deletions packages/preview/modern-whs-assignment/0.2.0/example/main.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#import "meta.typ" as meta
#import "@preview/modern-whs-assignment:0.2.0": *

#show: whs-assignment.with(
meta.title,
meta.author,
meta.submission-date,
meta.keywords,
meta.course,
meta.lecturer,
meta.bibliography,
)

#include "chapters/01_introduction.typ"
7 changes: 7 additions & 0 deletions packages/preview/modern-whs-assignment/0.2.0/example/meta.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#let title = "Titel"
#let author = "Max Mustermann"
#let course = "Algorithmen und Datenstrukturen"
#let lecturer = "Prof. Dr.-Ing. Max Mustermann"
#let submission-date = datetime.today()
#let keywords = ("GIT", "Algorithmen", "Datenstrukturen")
#let bibliography = bibliography.with("references.bib")
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
169 changes: 169 additions & 0 deletions packages/preview/modern-whs-assignment/0.2.0/template/lib.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
#import "@preview/codly:1.2.0": *
#import "@preview/codly-languages:0.1.7": *

#import "util.typ": *
#import "partial/title.typ" as title-page

#let whs-assignment(
title,
author,
submission-date,
keywords,
course,
lecturer,
bibliography,
body,
) = {
// Global Settings
set text(lang: "de", size: 12pt)
set text(ligatures: false)
set text(font: "TeX Gyre Heros")

// Set fonts
show raw: set text(font: "Fira Code")
show math.equation: set text(font: "New Computer Modern Math")

// Set pdf meta
set document(
title: title,
author: author,
date: submission-date,
keywords: keywords,
)

// Set numbering mode
set math.equation(numbering: "(1)")
set heading(numbering: "1.1")
set outline(indent: auto)

// Set citation style
set cite(style: "iso-690-author-date")

// Heading spacing
show heading.where(level: 1): set block(above: 1.95em, below: 1em)
show heading.where(level: 2): set block(above: 1.85em, below: 1em)
show heading.where(level: 3): set block(above: 1.75em, below: 1em)
show heading.where(level: 4): set block(above: 1.55em, below: 1em)

show: codly-init.with()
codly(languages: codly-languages, zebra-fill: none)

// ------ Cover ------

title-page.title(
title,
author,
submission-date,
course,
lecturer,
)

// ------ Content ------

set page(numbering: "I", number-align: right)
counter(page).update(1)

// Table of contents.
show outline.entry: it => link(
it.element.location(),
[#it.indented(it.prefix(), it.inner()) #v(12pt, weak: true)],
)
set outline.entry(fill: repeat[.])
show outline.entry.where(level: 1): it => {
v(18pt, weak: true)
if it.at("label", default: none) == <modified-entry> {
// prevent infinite recursion
if it.element.supplement.text == "Abschnitt" {
strong(it)
} else {
it
}
} else {
if it.element.supplement.text == "Abschnitt" {
[#outline.entry(
it.level,
it.element,
fill: "",
) <modified-entry>]
} else {
[#outline.entry(
it.level,
it.element,
fill: "",
) <modified-entry>]
}
}
}

outline()

pagebreak(weak: false)

// --- Main Chapters ---

set page(
header: grid(
columns: (1fr, 1fr),
inset: (
x: 0pt,
y: 7pt,
),
align(left)[_ #title _],
align(right)[#image("images/logo.png", width: 30%)],
grid.hline()
),
)

set page(numbering: "1", number-align: right)
counter(page).update(1)

set par(justify: true)

body

// --- Appendixes ---

set page(header: [])

// restart page numbering using roman numbers
set page(numbering: "I", number-align: right)
counter(page).update(1)

[= Verzeichnisse]

show heading: it => [
#it.body
]

show outline.entry: it => link(
it.element.location(),
[#it.indented(it.prefix(), it.inner()) #v(15pt, weak: true)],
)
set outline.entry(fill: repeat[.])

// --- Bibliography ---
set par(leading: 0.7em, first-line-indent: 0em, justify: true)
heading(outlined: false, numbering: none)[Literaturverzeichnis]
bibliography(
title: none,
style: "partial/iso690-author-date-de.csl",
)

// List of figures.
outline(
title: [Abbildungsverzeichnis #v(15pt, weak: true)],
target: figure.where(kind: image),
)

// List of tables.
outline(
title: [Tabellenverzeichnis #v(15pt, weak: true)],
target: figure.where(kind: table),
)

// List of code.
outline(
title: [Codeverzeichnis #v(15pt, weak: true)],
target: figure.where(kind: "code"),
)
}
Loading
Loading