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

optimal-ovgu-thesis:0.1.0 #563

Merged
merged 8 commits into from
May 17, 2024
Merged
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
23 changes: 23 additions & 0 deletions packages/preview/optimal-ovgu-thesis/0.1.0/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
MIT License

Copyright (c) 2024 Valentin Rieß

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

This license does not apply to the logos of the Faculty of Computer Science (FIN) and SAP UCC Magdeburg, which are included here for illustrative purposes only and are subject to their own copyright.
59 changes: 59 additions & 0 deletions packages/preview/optimal-ovgu-thesis/0.1.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
This template was created for a master thesis at the faculty of computer science (FIN), but should work as well for other faculties.

## File structure
```
.
├── assets // Images, CSV-Files, etc.
│ └── figure // Image files
│ └── optimal-ovgu-thesis
├── chapter // Content
│ ├── 01-Einleitung.typ
│ ├── ...
│ └── 99-Appendix.typ
├── expose.typ // Exposé template
├── metadata.typ // Metadata and template config
├── thesis.bib // Bibliography (e.g. generated by Zotero + Better BibTex)
└── thesis.typ // Thesis template
```

## Logos on the title page
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the logo assets intentionally part of the template that will be cloned into the user's project rather than part of the package, so that they can easily be swapped? If they are always the same, it might be user-friendlier to just ship them behind the scenes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that was intentional for exact this reason to make it easier for users to swap them out. But I am unsure if it's correct license wise or if it'd be better to just provide links for the users to download them themselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just contacted the office at ovgu and asked for the license permission

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, let me know once this is ready for merging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the logo assets with questionable licenses. This should be ready now @laurmaedje . Thanks for reviewing it!

The header- and organisation-logo can be set in the `metadata.typ` file (see example below). There are two example logo files in `assets/figure/optimal-ovgu-thesis`. Please refer to [cd.ovgu.de](https://www.cd.ovgu.de/Fakult%C3%A4ten.html) for more information regarding the OvGU corporate design and for the signet and logo of your faculty.

Header logos are set in `metadata.typ`:
```typ
// Example 1: Use UCC logo as organisation-logo and the FIN faculty header as header-logo
#let organisation-logo = image("assets/figure/optimal-ovgu-thesis/ucc.svg", width: 2cm)
#let header-logo = image("assets/figure/optimal-ovgu-thesis/fin-de.svg", width: 100%)

// Example 2: Do not use logos at all
#let organisation-logo = none
#let header-logo = none
```

## Fonts
This template requires these two fonts to be installed on your system:
- New Computer Modern
- New Computer Modern Sans

### NixOS
In your `configuration.nix`:
```nix
fonts.packages = with pkgs; [
liberation_ttf # here are your other fonts (liberation is just an example)
] ++ texlive.newcomputermodern.pkgs; # ← New Computer Modern font
```

## Development
In case you want to contribute, check out the repo into a [typst package directory](https://github.com/typst/packages?tab=readme-ov-file#local-packages)

### Example for Linux:
Local package path: `~/.local/share/typst/packages/local/optimal-ovgu-thesis/0.1.0`

```sh
mkdir -p ~/.local/share/typst/packages/local/optimal-ovgu-thesis
cd ~/.local/share/typst/packages/local/optimal-ovgu-thesis
git clone git@github.com:v411e/optimal-ovgu-thesis.git
mv optimal-ovgu-thesis 0.1.0
```

This will make the package available locally, so you can use `typst init "@local/optimal-ovgu-thesis:0.1.0"` to create a test-project from the template.
20 changes: 20 additions & 0 deletions packages/preview/optimal-ovgu-thesis/0.1.0/abstract.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#import "components.typ": body-font, variable-pagebreak

#let oot-abstract(lang: "en", is-doublesided: none, body) = {
set text(lang: lang)

v(0.1fr)

align(center, text(
font: body-font,
1em,
weight: "semibold",
if lang == "de" [Zusammenfassung] else [Abstract],
))
linebreak()
text(body)

v(1fr)

variable-pagebreak(is-doublesided)
}
17 changes: 17 additions & 0 deletions packages/preview/optimal-ovgu-thesis/0.1.0/acknowledgement.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#import "components.typ": body-font, variable-pagebreak

#let oot-acknowledgement(heading: "Acknowledgements", is-doublesided: none, body) = {
set align(center)

v(0.1fr)

if heading.len() > 0 {
text(font: body-font, 1em, weight: "semibold", heading)
v(1em)
}

text(body)

v(1fr)
variable-pagebreak(is-doublesided)
}
32 changes: 32 additions & 0 deletions packages/preview/optimal-ovgu-thesis/0.1.0/components.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#let body-font = "New Computer Modern"
#let sans-font = "New Computer Modern Sans"

// This numbering function cuts of the first levels of a heading
// This is useful if the structure gets too deep
// Example with max-level = 3: [1.2.3.4.5.] → [4.5.]
#let number-until-with(max-level, schema) = (..numbers) => {
// self.pos() returns the captured positional arguments as an array.
if numbers.pos().len() <= max-level {
numbering(schema, ..numbers)
} else if numbers.pos().len() > max-level {
let reduced_numbers = numbers.pos().slice(max-level)
numbering(schema + ".", ..reduced_numbers)
}
}

// Small headings style
#let small-heading() = it => [
#set text(weight: "regular", style: "italic")
#it
]

#let variable-pagebreak = (is-doublesided) => {
// New chapters should start on the right page which is odd when printed double-sided
if is-doublesided {
pagebreak(weak: true, to: "odd")
} else {
pagebreak(weak: true)
}
}

#let author-fullname = (author) => author.name + " " + author.surname
69 changes: 69 additions & 0 deletions packages/preview/optimal-ovgu-thesis/0.1.0/disclaimer.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#import "components.typ": sans-font, variable-pagebreak

#let oot-disclaimer(
title: "",
international-title: "",
author: none,
city: " ",
is-doublesided: none,
lang: "en",
) = {
let heading = "Statement of authorship of the student"
if (lang == "de") {
heading = "Selbstständigkeitserklärung"
}

text(font: sans-font, size: 2em, weight: 700, heading)

line(start: (0pt, -1.5em), length: 100%)
[Thesis: #title]

if (international-title.len() > 0) {
[\ (#international-title)]
}

v(5mm)

grid(
columns: 2,
gutter: 1em,
[Name: #author.name],
[Surname: #author.surname],
[Date of birth: #author.date-of-birth],
[Matriculation no.: #author.matriculation-no],
)

v(5mm)

par(
first-line-indent: 0em,
)[
I herewith assure that I wrote the present thesis independently, that the thesis
has not been partially or fully submitted as graded academic work and that I
have used no other means than the ones indicated. I have indicated all parts of
the work in which sources are used according to their wording or to their
meaning.

\

I am aware of the fact that violations of copyright can lead to injunctive
relief and claims for damages of the author as well as a penalty by the law
enforcement agency.
]

v(15mm)

let signature-line = (length) => {
box(line(length: length, stroke: (dash: "loosely-dotted")))
}

grid(
columns: 2,
gutter: 0.5em,
column-gutter: 1fr,
city + ", " + signature-line(3cm),
" " + signature-line(5cm),
)

variable-pagebreak(is-doublesided)
}
47 changes: 47 additions & 0 deletions packages/preview/optimal-ovgu-thesis/0.1.0/expose.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#import "components.typ": body-font, sans-font, author-fullname

#let oot-expose = (
title: "",
author: none,
lang: "en",
document-type: "",
city: "",
date: "",
organisation: [],
body,
) => {
set document(title: title, author: author-fullname(author))
set page(
margin: (left: 30mm, right: 30mm, top: 27mm, bottom: 27mm),
numbering: "1",
number-align: center,
)

block(inset: 0cm)[
#set align(center)
#text(2em, weight: 700, "Exposé: " + document-type)
#par(leading: 0.6em)[
#text(1.6em, weight: 500, title)
]
#text(1.2em, weight: 500)[
#v(0.3em)
#author-fullname(author)
#v(0.3em)
#organisation
]
]

v(2em)

show par: set block(spacing: 1em)
set par(leading: 0.7em, justify: true, first-line-indent: 1em)

set text(font: body-font, size: 10pt, lang: lang)

show heading: set text(size: 11pt)

// Remove level 1 headings
show heading.where(level: 1): h => []

body
}
71 changes: 71 additions & 0 deletions packages/preview/optimal-ovgu-thesis/0.1.0/template.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#import "components.typ": body-font, sans-font, small-heading, number-until-with, variable-pagebreak, author-fullname
#import "titlepage.typ": oot-titlepage
#import "acknowledgement.typ": oot-acknowledgement
#import "abstract.typ": oot-abstract
#import "disclaimer.typ": oot-disclaimer
#import "expose.typ": oot-expose

#let optimal-ovgu-thesis(title: "", author: none, lang: "en", is-doublesided: none, body) = {
set document(title: title, author: author-fullname(author))
set page(
margin: (left: 30mm, right: 30mm, top: 27mm, bottom: 27mm),
numbering: "1",
number-align: center,
)

set text(font: body-font, size: 11pt, lang: lang)
show math.equation: set text(weight: 400)
show figure.caption: emph

show figure.where(kind: table): set figure.caption(position: top)

show figure.where(kind: raw): set figure.caption(position: top)

set table(stroke: gray)

show heading: set text(font: sans-font)
show heading.where(level: 1): h => [
#variable-pagebreak(is-doublesided)
#h
]

// Apply custom numbering to headings
set heading(numbering: number-until-with(3, "1.1"))

// Make nested headings apply small-heading style
show heading.where(level: 4) : small-heading()
show heading.where(level: 5) : small-heading()
show heading.where(level: 6) : small-heading()
show heading.where(level: 7) : small-heading()

show par: set block(spacing: 1em)
set par(
justify: true,
leading: 1em, // Set the space between lines in text
first-line-indent: 1em,
)

show raw.where(block: true): it => align(start, block(
fill: luma(250),
stroke: 0.6pt + luma(200),
inset: 8pt,
radius: 3pt,
width: 100%,
it,
))
show raw.where(block: true): set text(size: 8pt)
show raw.where(block: true): set par(leading: 0.6em)

// Table of contents
set outline(indent: 2em)
show outline: outline => [
#show heading: heading => [
#text(font: body-font, 1.5em, weight: 700, heading.body)
#v(15mm)
]
#outline
#variable-pagebreak(is-doublesided)
]

body
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading