refactored example folder to template

This commit is contained in:
Sven Vogel 2024-07-01 16:02:42 +02:00
parent 968f63be78
commit ca5448e9d3
17 changed files with 184 additions and 143 deletions

BIN
assets/thumbnail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -1,9 +0,0 @@
= Ein Text im Anhang
#label("Anhang-A")
#lorem(50)
== Noch mehr Text im Anhang
#lorem(50)

View File

View File

@ -1,115 +0,0 @@
#import "../src/template.typ": dhbw-template
#let config = (
lang: "de",
region: "de",
author: (
name: "Sven Vogel",
semester: 4,
program: "Informationstechnik",
course: "TINF22IT2",
faculty: "Technik",
university: "DHBW Mannheim",
company: "ABB AG",
supervisor: "Florian Miedniak",
matriculation-number: 1191225),
thesis: (
title: "Konfiguration & Integration von PROFINET",
subtitle: "für die AC500 SPS",
submission-date: "20. März 2024",
timeframe: "1. Januar 2023 - 20. März 2024",
kind: "T2000",
summary: "",
abstract: "",
keywords: ( "IT", "PROFINET" ),
bibliography: bibliography("refs.yml"),
glossary: (
(
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].]
),
(
key: "potato",
short: "potato",
plural: "potatoes",
desc: [#lorem(10)]
),
),
appendices: include "appendix.typ"
))
#show: doc => dhbw-template(config: config, doc: doc)
= Lorem Ipsum
#lorem(25)
@oidc
#lorem(100)
@Anhang-A
== Lorem Ipsum 2
#lorem(200)
@texbook
= Lorem Ipsum 3
#lorem(15)
$
angle.l a, b angle.r &= arrow(a) dot arrow(b) \
&= a_1 b_1 + a_2 b_2 + ... a_n b_n \
&= sum_(i=1)^n a_i b_i.
$
#figure(image("digitaldog.jpg", height: 480pt), caption: [ Some image caption ])
#figure(
table(
columns: 2,
"Hello", "World"),
caption: [ Some table ])
#pagebreak()
#figure(
```rust
use std::env;
use std::fs::OpenOptions;
use std::io::Write;
fn main() {
// Get the file path from the environment variable
let file_path = match env::var("OUTPUT_FILE") {
Ok(path) => path,
Err(_) => {
eprintln!("Error: OUTPUT_FILE environment variable is not set");
return;
}
};
// Open the file in append mode, create it if it doesn't exist
let mut file = match OpenOptions::new()
.append(true)
.create(true)
.open(&file_path)
{
Ok(file) => file,
Err(e) => {
eprintln!("Error opening file {}: {}", file_path, e);
return;
}
};
// Write "Hello, World" to the file
if let Err(e) = writeln!(file, "Hello, World") {
eprintln!("Error writing to file: {}", e);
} else {
println!("Successfully appended 'Hello, World' to {}", file_path);
}
}
```, caption: [Some code])

View File

@ -1,6 +0,0 @@
texbook:
type: book
title: The {TeX} Book
author: Knuth, Donald E.
date: 1986
publisher: Addison-Wesley Professional

View File

@ -6,5 +6,3 @@
// Author: Sven Vogel
// Edited: 27.06.2024
// License: MIT

View File

@ -8,10 +8,12 @@
// License: MIT
// start of template pages and styles
#let dhbw-template(config: dictionary, doc: content) = [
#let dhbw-template(config: dictionary, body) = [
#import "style.typ": global_styled_doc, content_styled, end_styled
#let doc = body
// set document properties
#set document(
author: config.author.name,
@ -47,6 +49,9 @@
#pagebreak(weak: true)
#new_prerelease_note(config)
#pagebreak(weak: true)
#new_abstract(config)
#pagebreak(weak: true)
#new_outline()
@ -61,9 +66,6 @@
#print-glossary(config.thesis.glossary)
#pagebreak(weak: true)
#new_abstract(config)
#pagebreak(weak: true)
#counter(page).update(1)

View File

@ -33,7 +33,7 @@
#if text.lang == "de" [
darf weder als Ganzes noch in Auszügen Personen außerhalb des Prüfungsprozesses und des Evalua-tionsverfahrens zugänglich gemacht werden, sofern keine anderslautende Genehmigung der Ausbildungsstätte vorliegt.
] else if text.lang = "en" [
] else if text.lang == "en" [
may not be made accessible to persons outside the examination process and the evaluation procedure, either as a whole or in excerpts, unless otherwise authorized by the training institution.
]

View File

@ -36,7 +36,7 @@
#if text.lang == "de" [
handelt es sich _nicht_ um die fertige Fassung. Das Dokument kann Inhaltliche-, Grammatikalische- sowie Format-Fehler enthalten. Das Dokument ist im Rahmen der Aufgabenstellung von Seiten der #author.university nicht zur Bewertung freigegeben und ein anderer Verwendungszweck als eine Vorschau ist nicht gestattet.
] else if text.lang == "en" [
is _not_ the final version. The document may contain content, grammatical and format errors. The document is not released for evaluation by #author.university within the scope of the assignment and any use other than a preview is not permitted.
is not the final version. The document may contain errors in content, grammar and formatting. The document may not be released for evaluation to #author.university as part of the assignment, and any use other than a preview is not permitted.
]
#v(1em)

View File

@ -127,11 +127,6 @@
]
#let content_styled(config: dictionary, body: content) = [
// setup equate for sub equation labeling
#import "@preview/equate:0.2.0": equate
#show: equate.with(breakable: true, sub-numbering: true)
#set math.equation(numbering: "(1.1)")
#set heading(numbering: "1.")
#let thesis = config.thesis

12
template/abstract.typ Normal file
View File

@ -0,0 +1,12 @@
// English summary "abstract" is content of this block:
#let abstract = [
#lorem(100)
]
// Other languages abstract translation is content of this block:
// NOTE: An abstract is required in case the thesis is not written primarily in english
// if writing in english (and the language is set to "en") this can be let empty or set to none
#let summary = [
#lorem(100)
]

9
template/appendix.typ Normal file
View File

@ -0,0 +1,9 @@
= Raw data
#label("Anhang-A")
#lorem(50)
== More raw data
#lorem(50)

View File

Before

Width:  |  Height:  |  Size: 244 KiB

After

Width:  |  Height:  |  Size: 244 KiB

15
template/glossary.typ Normal file
View File

@ -0,0 +1,15 @@
#let glossary = (
(
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].]
),
(
key: "potato",
short: "potato",
plural: "potatoes",
desc: [#lorem(10)]
),
)

112
template/main.typ Normal file
View File

@ -0,0 +1,112 @@
#import "../src/lib.typ": dhbw-template
#import "glossary.typ": glossary
#import "abstract.typ": abstract, summary
#show: dhbw-template.with(
config: (
lang: "en",
region: "en",
author: (
name: "Sven Vogel",
semester: 4,
program: "Informationtechnology",
course: "TINF19IT1",
faculty: "Technik",
university: "DHBW Mannheim",
company: "ABB AG",
supervisor: "Benny Goodman",
matriculation-number: 123456789),
thesis: (
title: "Unofficial ABB/DHBW Typst template",
subtitle: "for reports and thesises",
submission-date: "23rd march 2020",
timeframe: "1st january 2020 - 20th march 2020",
kind: "T2000",
summary: summary,
abstract: abstract,
keywords: ( "IT", "other stuff" ),
bibliography: bibliography("refs.bib"),
glossary: glossary,
appendices: include "appendix.typ")))
#import "@preview/wrap-it:0.1.0": wrap-content
= Lorem Ipsum
#lorem(25)
@oidc
#lorem(100)
@Anhang-A
== Lorem Ipsum 2
#lorem(200)
@einstein
= Lorem Ipsum 3
#lorem(15)
$
angle.l a, b angle.r &= arrow(a) dot arrow(b) \
&= a_1 b_1 + a_2 b_2 + ... a_n b_n \
&= sum_(i=1)^n a_i b_i.
$
#lorem(140)
#wrap-content(
figure(image("assets/digitaldog.jpg", width: 200pt), caption: [ Some image caption ]),
lorem(200))
#figure(
table(
columns: 2,
"Hello", "World"),
caption: [ Some table ])
#pagebreak()
#figure(
```rust
use std::env;
use std::fs::OpenOptions;
use std::io::Write;
fn main() {
// Get the file path from the environment variable
let file_path = match env::var("OUTPUT_FILE") {
Ok(path) => path,
Err(_) => {
eprintln!("Error: OUTPUT_FILE environment variable is not set");
return;
}
};
// Open the file in append mode, create it if it doesn't exist
let mut file = match OpenOptions::new()
.append(true)
.create(true)
.open(&file_path)
{
Ok(file) => file,
Err(e) => {
eprintln!("Error opening file {}: {}", file_path, e);
return;
}
};
// Write "Hello, World" to the file
if let Err(e) = writeln!(file, "Hello, World") {
eprintln!("Error writing to file: {}", e);
} else {
println!("Successfully appended 'Hello, World' to {}", file_path);
}
}
```, caption: [Some code])
= Conclusion
#lorem(320)

12
template/refs.bib Normal file
View File

@ -0,0 +1,12 @@
@article{einstein,
author = "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]",
journal = "Annalen der Physik",
volume = "322",
number = "10",
pages = "891--921",
year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004",
keywords = "physics"
}

16
typst.toml Normal file
View File

@ -0,0 +1,16 @@
[package]
name = "dhbw-abb-typst-template"
version = "0.1.0"
entrypoint = "src/template.typ"
authors = ["Sven Vogel <sven.vogel1@de.abb.com>"]
license = "MIT"
description = "Unoffical typst DHBW/ABB template for use as thesis and report works"
repository = "https://git.montehaselino.de/DHBW/dhbw-abb-typst-template"
keywords = ["dhbw", "abb", "thesis"]
categories = ["paper", "thesis", "report"]
exclude = ["examples"]
[template]
path = "template"
entrypoint = "main.typ"
thumbnail = "assets/thumbnail.png"