diff --git a/packages/preview/supercharged-dhbw/2.0.1/LICENSE b/packages/preview/supercharged-dhbw/2.0.1/LICENSE new file mode 100644 index 000000000..666b7f0ee --- /dev/null +++ b/packages/preview/supercharged-dhbw/2.0.1/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Danny Seidel + +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. diff --git a/packages/preview/supercharged-dhbw/2.0.1/README.md b/packages/preview/supercharged-dhbw/2.0.1/README.md new file mode 100644 index 000000000..ff9e9d72b --- /dev/null +++ b/packages/preview/supercharged-dhbw/2.0.1/README.md @@ -0,0 +1,197 @@ +# Supercharged DHBW + +Unofficial [Typst](https://typst.app/) template for DHBW students. + +You can see an example PDF [here](https://github.com/DannySeidel/typst-dhbw-template/blob/main/example.pdf). + +## Usage + +You can use this template in the Typst web app by clicking "Start from template" on the dashboard and searching for `supercharged-dhbw`. + +Alternatively, you can use the CLI to kick this project off using the command + +```shell +typst init @preview/supercharged-dhbw +``` + +Typst will create a new directory with all the files needed to get you started. + +## Fonts + +This template uses the following fonts: +- [Montserrat](https://fonts.google.com/specimen/Montserrat) +- [Open Sans](https://fonts.google.com/specimen/Open+Sans) + +If you want to use typst locally, you can download the fonts from the links above and install them on your system. +Otherwise, when using the web version add the fonts to your project. + +For further information on how to add fonts to your project, please refer to the [Typst documentation](https://typst.app/docs/reference/text/text/#parameters-font). + +## Used Packages + +This template uses the following packages: + +- [codelst](https://typst.app/universe/package/codelst): To create code snippets + +A more detailed explanation of the features can be found in the `main.typ` file. + +## Configuration +This template exports the `supercharged-dhbw` function with the following named arguments: + +`title (str*)`: Title of the document + +`authors (dictionary*)`: List of authors with the following named arguments (max. 6 authors when in the company or 8 authors when at DHBW): + + - name (str*): Name of the author + - student-id (str*): Student ID of the author + - course (str*): Course of the author + - course-of-studies (str*): Course of studies of the author + - company (dictionary): Company of the author (only needed when `at-university` is `false`) with the following named arguments: + - name (str*): Name of the company + - post-code (str): Post code of the company + - city (str*): City of the company + - country (str): Country of the company + +`abstract (content)`: Content of the abstract, it is recommended that you pass a variable containing the content or a function that returns the content + +`acronym-spacing (length)`: Spacing between the acronym and its long form (check the [Typst documentation](https://typst.app/docs/reference/layout/length/) for examples on how to provide parameters of type length), default is `5em` + +`acronyms (dictionary)`: Pass a dictionary containing the acronyms and their long forms (See the example in the `acronyms.typ` file) + +`appendix (content)`: Content of the appendix, it is recommended that you pass a variable containing the content or a function that returns the content + +`at-university* (bool)`: Whether the document is written at university or not, default is `false` + +`bibliography (content)`: Path to the bibliography file + +`bib-style (str)`: Style of the bibliography, default is `ieee` + +`city (str)`: City of the author (only needed when `at-university` is `true`) + +`confidentiality-statement-content (content)`: Provide a custom confidentiality statement + +`date (datetime* | array*)`: Provide a datetime object to display one date (e.g. submission date) or a array containing two datetime objects to display a date range (e.g. start and end date of the project), default is `datetime.today()` + +`date-format (str)`: Format of the displayed dates, default is `"[day].[month].[year]"` (for more information on possible formats check the [Typst documentation](https://typst.app/docs/reference/foundations/datetime/#format)) + +`language (str*)`: Language of the document which is either `en` or `de`, default is `en` + +`logo-left (content)`: Path to the logo on the left side of the title page (usage: image("path/to/image.png")), default is the `DHBW logo` + +`logo-right (content)`: Path to the logo on the right side of the title page (usage: image("path/to/image.png")), default is `no logo` + +`logo-size-ratio (str)`: Ratio between the right logo and the left logo height (left-logo:right-logo), default is `"1:1"` + +`numbering-alignment (alignment)`: Alignment of the page numbering (for possible options check the [Typst documentation](https://typst.app/docs/reference/layout/alignment/)), default is `center` + +`show-abstract (bool)`: Whether the abstract should be shown, default is `true` + +`show-acronyms (bool)`: Whether the list of acronyms should be shown, default is `true` + +`show-appendix (bool)`: Whether the appendix should be shown, default is `false` + +`show-code-snippets (bool)`: Whether the code snippets should be shown, default is `true` + +`show-confidentiality-statement (bool)`: Whether the confidentiality statement should be shown, default is `true` + +`show-declaration-of-authorship (bool)`: Whether the declaration of authorship should be shown, default is `true` + +`show-header (bool)`: Whether the header should be shown, default is `true` + +`show-list-of-figures (bool)`: Whether the list of figures should be shown, default is `true` + +`show-list-of-tables (bool)`: Whether the list of tables should be shown, default is `true` + +`show-table-of-contents (bool)`: Whether the table of contents should be shown, default is `true` + +`supervisor (dict*)`: Name of the supervisor at the university and/or company (e.g. supervisor: (company: "John Doe", university: "Jane Doe")) + + - company (str): Name of the supervisor at the company (note while the argument is optional at least one of the two arguments must be provided) + - university (str): Name of the supervisor at the university (note while the argument is optional at least one of the two arguments must be provided) + +`toc-depth (int)`: Depth of the table of contents, default is `3` + +`type-of-thesis (str)`: Type of the thesis, default is `none` (using this option reduces the maximum number of authors by 2 to 4 authors when in the company or 6 authors when at DHBW) + +`type-of-degree (str)`: Type of the degree, default is `none` (using this option reduces the maximum number of authors by 2 to 4 authors when in the company or 6 authors when at DHBW) + +`university (str*)`: Name of the university + +`university-location (str*)`: Campus or city of the university + +Behind the arguments the type of the value is given in parentheses. All arguments marked with `*` are required. + +## Acronyms + +### Functions + +This template provides the following functions to reference acronyms: + +`acr`: Reference an acronym in the text + +`acrpl`: Reference an acronym in the text in plural form + +`acrs`: Reference an acronym in the text in short form (e.g. `acr("API")` -> `API`) + +`acrspl`: Reference an acronym in the text in short form in plural form (e.g. `acrpl("API")` -> `APIs`) + +`acrl`: Reference an acronym in the text in long form (e.g. `acrl("API")` -> `Application Programming Interface`) + +`acrlpl`: Reference an acronym in the text in long form in plural form (e.g. `acrlpl("API")` -> `Application Programming Interfaces`) + +`acrf`: Reference an acronym in the text in full form (e.g. `acrf("API")` -> `Application Programming Interface (API)`) + +`acrfpl`: Reference an acronym in the text in full form in plural form (e.g. `acrfpl("API")` -> `Application Programming Interfaces (API)`) + +### Definition + +To define acronyms use a dictionary and pass it to the acronyms attribute of the template. The dictionary should contain the acronyms as keys and their long forms as values. + +```typst +#let acronyms = ( + API: "Application Programming Interface", + HTTP: "Hypertext Transfer Protocol", + REST: "Representational State Transfer", +) +``` + +To define the plural form of an acronym use a array as value with the first element being the singular form and the second element being the plural form. If you don't define the plural form, the template will automatically add an "s" to the singular form. + +```typst +#let acronyms = ( + API: ("Application Programming Interface", "Application Programming Interfaces"), + HTTP: ("Hypertext Transfer Protocol", "Hypertext Transfer Protocols"), + REST: ("Representational State Transfer", "Representational State Transfers"), +) +``` + +## Example + +If you want to change an existing project to use this template, you can add a show rule like this at the top of your file: + +```typst +#import "@preview/supercharged-dhbw:2.0.1": * + +#show: supercharged-dhbw.with( + title: "Exploration of Typst for the Composition of a University Thesis", + authors: ( + (name: "Max Mustermann", student-id: "7654321", course: "TIS21", course-of-studies: "IT-Security", company: ( + (name: "YXZ GmbH", post-code: "70435", city: "Stuttgart") + )), + (name: "Juan Pérez", student-id: "1234567", course: "TIM21", course-of-studies: "Mobile Computer Science", company: ( + (name: "ABC S.L.", post-code: "08005", city: "Barcelona", country: "Spain") + )), + ), + acronyms: acronyms, // displays the acronyms defined in the acronyms dictionary + at-university: false, // if true the company name on the title page and the confidentiality statement are hidden + bibliography: bibliography("sources.bib"), + date: datetime.today(), + language: "en", // en, de + supervisor: (company: "John Appleseed"), + university: "Cooperative State University Baden-Württemberg", + university-location: "Ravensburg Campus Friedrichshafen", + // for more options check the package documentation (https://typst.app/universe/package/supercharged-dhbw) +) + +// Your content goes here +``` \ No newline at end of file diff --git a/packages/preview/supercharged-dhbw/2.0.1/acronym-lib.typ b/packages/preview/supercharged-dhbw/2.0.1/acronym-lib.typ new file mode 100644 index 000000000..519fc90fa --- /dev/null +++ b/packages/preview/supercharged-dhbw/2.0.1/acronym-lib.typ @@ -0,0 +1,153 @@ +#let prefix = "acronym-state-" +#let acros = state("acronyms", none) + +#let init-acronyms(acronyms) = { + acros.update(acronyms) +} + +// Check if an acronym exists +#let is-valid(acr) = { + acros.display(acronyms => { + if acr not in acronyms { + panic(acr + " is not a key in the acronyms dictionary.") + return false + } + }) + return true +} + +// Display acronym as clickable link +#let display-link(acr, text) = { + if is-valid(acr) { + link(label("acronym-" + acr), text) + } +} + +// Display acronym +#let display(acr, text, link: true) = { + if link { + display-link(acr, text) + } else { + text + } +} + +// Display acronym in short form +#let acrs(acr, plural: false, link: true) = { + if plural { + display(acr, acr + "s", link: link) + } else { + display(acr, acr, link: link) + } +} +// Display acronym in short plural form +#let acrspl(acr, link: true) = { + acrs(acr, plural: true, link: link) +} + +// Display acronym in long form +#let acrl(acr, plural: false, link: true) = { + acros.display(acronyms => { + if is-valid(acr) { + let defs = acronyms.at(acr) + if type(defs) == "string" { + if plural { + display(acr, defs + "s", link: link) + } else { + display(acr, defs, link: link) + } + } else if type(defs) == "array" { + if defs.len() == 0 { + panic("No definitions found for acronym " + acr + ". Make sure it is defined in the dictionary passed to #init-acronyms(dict)") + } + if plural { + if defs.len() == 1 { + display(acr, defs.at(0) + "s", link: link) + } else if defs.len() == 2 { + display(acr, defs.at(1), link: link) + } else { + panic("Definitions should be arrays of one or two strings. Definition of " + acr + " is: " + type(defs)) + } + } else { + display(acr, defs.at(0), link: link) + } + } else { + panic("Definitions should be arrays of one or two strings. Definition of " + acr + " is: " + type(defs)) + } + } + }) +} +// Display acronym in long plural form +#let acrlpl(acr, link: true) = { + acrl(acr, plural: true, link: link) +} + +// Display acronym for the first time +#let acrf(acr, plural: false, link: true) = { + if plural { + display(acr, [#acrlpl(acr) (#acr\s)], link: link) + } else { + display(acr, [#acrl(acr) (#acr)], link: link) + } + state(prefix + acr, false).update(true) +} +// Display acronym in plural form for the first time +#let acrfpl(acr, link: true) = { + acrf(acr, plural: true, link: link) +} + +// Display acronym. Expands it if used for the first time +#let acr(acr, plural: false, link: true) = { + state(prefix + acr, false).display(seen => { + if seen { + if plural { + acrspl(acr, link: link) + } else { + acrs(acr, link: link) + } + } else { + if plural { + acrfpl(acr, link: link) + } else { + acrf(acr, link: link) + } + } + }) +} + +// Display acronym in the plural form. Expands it if used for the first time. +#let acrpl(acronym, link: true) = { + acr(acronym, plural: true, link: link) +} + +// Print an index of all the acronyms and their definitions. +#let print-acronyms(language, acronym-spacing) = { + heading(level: 1, outlined: false, numbering: none)[#if (language == "de") { + [Abkürzungsverzeichnis] + } else { + [List of Acronyms] + }] + + acros.display(acronyms=>{ + let acronym-keys = acronyms.keys() + + let max-width = 0pt + for acr in acronym-keys { + let result = measure(acr).width + + if (result > max-width) { + max-width = result + } + } + + let acr-list = acronym-keys.sorted() + + for acr in acr-list{ + grid( + columns: (max-width + 0.5em, auto), + gutter: acronym-spacing, + [*#acr#label("acronym-" + acr)*], [#acrl(acr, link: false)] + ) + } + }) +} \ No newline at end of file diff --git a/packages/preview/supercharged-dhbw/2.0.1/check-attributes.typ b/packages/preview/supercharged-dhbw/2.0.1/check-attributes.typ new file mode 100644 index 000000000..bfb65bf78 --- /dev/null +++ b/packages/preview/supercharged-dhbw/2.0.1/check-attributes.typ @@ -0,0 +1,202 @@ +#let check-attributes( + title, + authors, + language, + at-university, + type-of-thesis, + type-of-degree, + show-confidentiality-statement, + show-declaration-of-authorship, + show-table-of-contents, + show-acronyms, + show-list-of-figures, + show-list-of-tables, + show-code-snippets, + show-appendix, + show-abstract, + show-header, + numbering-alignment, + toc-depth, + acronym-spacing, + abstract, + appendix, + acronyms, + university, + university-location, + supervisor, + date, + city, + bibliography, + bib-style, + logo-left, + logo-right, + logo-size-ratio, + ) = { + if (title == none or title == "") { + panic("Title is missing. Specify a title in the 'title' attribute of the template.") + } + + let boolean-attributes = ( + at-university: at-university, + show-confidentiality-statement: show-confidentiality-statement, + show-table-of-contents: show-table-of-contents, + show-acronyms: show-acronyms, + show-declaration-of-authorship: show-declaration-of-authorship, + show-list-of-figures: show-list-of-figures, + show-list-of-tables: show-list-of-tables, + show-code-snippets: show-code-snippets, + show-appendix: show-appendix, + show-abstract: show-abstract, + show-header: show-header + ) + + for (key, attribute) in boolean-attributes { + if (type(attribute) != bool) { + panic("Attribute '" + key + "' is invalid. Specify 'true' or 'false' in the '" + key + "' attribute of the template.") + } + } + + let string-attributes = ( + university: university, + university-location: university-location, + ) + + for (key, attribute) in string-attributes { + if (type(attribute) != str or attribute.len() == 0) { + panic("Attribute '" + key + "' is missing. Specify a " + key + " in the '" + key + "' attribute of the template.") + } + } + + let optional-string-attributes = ( + type-of-thesis: type-of-thesis, + type-of-degree: type-of-degree, + bib-style: bib-style, + ) + + for (key, attribute) in optional-string-attributes { + if (attribute != none and (type(attribute) != str or attribute.len() == 0)) { + panic("Attribute '" + key + "' is invalid. Specify a string in the '" + key + "' attribute of the template.") + } + } + + if (authors == none or authors == ()) { + panic("Author is missing. Specify authors in the 'authors' attribute of the template.") + } + + let max-authors = if at-university { + 8 + } else { + 6 + } + + if ( + (type-of-thesis != none and type-of-thesis != "") or + (type-of-degree != none and type-of-degree != "") + ) { + max-authors -= 2 + } + + if (authors.len() > max-authors) { + panic("Too many authors. Specify a maximum of " + str(max-authors) + " authors in the 'authors' attribute of the template. To increase the maximum number of authors (max. 8), change one of the following attributes: 'at-university', 'type-of-thesis', 'type-of-degree'. (See the package documentation for more information.)") + } + + for author in authors { + if ( + "name" not in author or + author.name == none or + author.name == "" + ) { + panic("Author name is missing. Specify a name for each author in the 'authors' attribute of the template.") + } + + if ( + "student-id" not in author or + author.student-id == none or + author.student-id == "" + ) { + panic("Student ID of '" + author.name + "' is missing. Specify a student ID for each author in the 'authors' attribute of the template.") + } + + if ( + "course" not in author or + author.course == none or + author.course == "" + ) { + panic("Course of '" + author.name + "' is missing. Specify a course for each author in the 'authors' attribute of the template.") + } + + if ( + "course-of-studies" not in author or + author.course-of-studies == none or + author.course-of-studies == "" + ) { + panic("Course of studies of '" + author.name + "' is missing. Specify a course of studies for each author in the 'authors' attribute of the template.") + } + + if (at-university) { + if ("company" in author) { + panic("Company of '" + author.name + "' is not allowed. Remove the 'company' object from the author.") + } + + if (type(city) != str or city == "") { + panic("City is invalid. Specify a string containing a city in the 'city' attribute.") + } + } else { + if (type(city) == str) { + panic("Remove the City attribute. When 'at-university' is true the city inside the company object is used.") + } + + if ("company" not in author) { + panic("Author '" + author.name + "' is missing a company. Add the 'company' object to the author.") + } + } + } + + if (language != "en" and language != "de") { + panic("Language is invalid. Specify 'en' for English or 'de' for German in the 'language' attribute of the template.") + } + + if (type(numbering-alignment) != alignment) { + panic("Numbering alignment is invalid. Specify a alignment in the 'numbering-alignment' attribute of the template.") + } + + if (type(toc-depth) != int) { + panic("TOC depth is invalid. Specify an integer in the 'toc-depth' attribute of the template.") + } + + if (type(date) != datetime and (type(date) != array or date.len() != 2 or type(date.at(0)) != datetime or type(date.at(1)) != datetime)) { + panic("Date is invalid. Specify a datetime in the 'date' attribute of the template to display a specific date or use a array containing two datetime elements to display a date range.") + } + + let image-attributes = ( + logo-left: logo-left, + logo-right: logo-right + ) + + for (key, attribute) in image-attributes { + if (type(attribute) != content and attribute != none) { + panic("Attribute '" + key + "' is invalid. Specify an image in the '" + key + "' attribute of the template.") + } + } + + if (type(logo-size-ratio) != str or logo-size-ratio.len() == 0) { + panic("Logo size ratio is missing. Specify a ratio in the 'logo-size-ratio' attribute of the template.") + } + + let ratio = logo-size-ratio.split(":") + + if (ratio.len() != 2) { + panic("Invalid ratio. Specify a ratio in the format 'x:y' in the 'logo-size-ratio' attribute of the template.") + } + + if (type(bibliography) != content and bibliography != none) { + panic("Bibliography is invalid. Specify a bibliography in the 'bibliography' attribute of the template.") + } + + if (type(supervisor) != dictionary or + ("company" not in supervisor or supervisor.company == none or supervisor.company == "") and + ("university" not in supervisor or supervisor.university == none or supervisor.university == "") + ) { + panic("Supervisor(s) is/are invalid. Specify a supervisor either for the company and/or the university in the 'supervisor' attribute of the template.") + } +} \ No newline at end of file diff --git a/packages/preview/supercharged-dhbw/2.0.1/confidentiality-statement.typ b/packages/preview/supercharged-dhbw/2.0.1/confidentiality-statement.typ new file mode 100644 index 000000000..f73ec3f6b --- /dev/null +++ b/packages/preview/supercharged-dhbw/2.0.1/confidentiality-statement.typ @@ -0,0 +1,91 @@ +#let confidentiality-statement( + authors, + title, + confidentiality-statement-content, + university, + university-location, + date, + language, + many-authors, + date-format +) = { + v(2em) + text(size: 20pt, weight: "bold", if (language == "de") { + "Sperrvermerk" + } else { + "Confidentiality Statement" + }) + v(1em) + if (confidentiality-statement-content != none) { + confidentiality-statement-content + } else { + text(if (language == "de") { + "Die vorliegende Arbeit mit dem Titel" + } else { + "The Thesis on hand" + }) + v(1em) + align(center, + text(weight: "bold", title) + ) + v(1em) + let insitution + let companies + if (language == "de") { + if (authors.map(author => author.company.name).dedup().len() == 1) { + insitution = "Ausbildungsstätte" + } else { + insitution = "Ausbildungsstätten" + } + companies = authors.map(author => author.company.name).dedup().join(", ", last: " und ") + } else { + if (authors.map(author => author.company.name).dedup().len() == 1) { + insitution = "insitution" + } else { + insitution = "insitutions" + } + companies = authors.map(author => author.company.name).dedup().join(", ", last: " and ") + } + par(justify: true, [#if (language == "de") { + [enthält unternehmensinterne bzw. vertrauliche Informationen der #companies, ist deshalb mit einem Sperrvermerk versehen und wird ausschließlich zu Prüfungszwecken am Studiengang #authors.map(author => author.course-of-studies).dedup().join(" | ") der #university #university-location vorgelegt. + + Der Inhalt dieser Arbeit darf weder als Ganzes noch in Auszügen Personen außerhalb des Prüfungsprozesses und des Evaluationsverfahrens zugänglich gemacht werden, sofern keine anders lautende Genehmigung der #insitution (#companies) vorliegt.] + } else { + [contains internal respective confidential data of #companies. It is intended solely for inspection by the assigned examiner, the head of the #authors.map(author => author.course-of-studies).dedup().join(" | ") department and, if necessary, the Audit Committee at the #university #university-location. + + The content of this thesis may not be made available, either in its entirety or in excerpts, to persons outside of the examination process and the evaluation process, unless otherwise authorized by the training #insitution (#companies).] + }]) + } + + let end-date = if (type(date) == datetime) { + date + } else { + date.at(1) + } + + v(2em) + text([#if (language == "de") { + [#authors.map(author => author.company.city).dedup().join(", ", last: " und "), #end-date.display(date-format)] + } else { + [#authors.map(author => author.company.city).dedup().join(", ", last: " and "), #end-date.display(date-format)] + }]) + + v(0.5em) + if (many-authors) { + grid( + columns: (1fr, 1fr), + gutter: 20pt, + ..authors.map(author => { + v(3.5em) + line(length: 80%) + author.name + }) + ) + } else { + for author in authors { + v(4em) + line(length: 40%) + author.name + } + } +} \ No newline at end of file diff --git a/packages/preview/supercharged-dhbw/2.0.1/declaration-of-authorship.typ b/packages/preview/supercharged-dhbw/2.0.1/declaration-of-authorship.typ new file mode 100644 index 000000000..088612d06 --- /dev/null +++ b/packages/preview/supercharged-dhbw/2.0.1/declaration-of-authorship.typ @@ -0,0 +1,62 @@ +#let declaration-of-authorship(authors, title, date, language, many-authors, at-university, city, date-format) = { + pagebreak() + v(2em) + text(size: 20pt, weight: "bold", if (language == "de") { + "Selbstständigkeitserklärung" + } else { + "Declaration of Authorship" + }) + + v(1em) + + par(justify: true, [ + Gemäß Ziffer 1.1.13 der Anlage 1 zu §§ 3, 4 und 5 der Studien- und Prüfungsordnung für die Bachelorstudiengänge im Studienbereich Technik der Dualen Hochschule Baden- Württemberg vom 29.09.2017. Ich versichere hiermit, dass ich meine Arbeit mit dem Thema: + ]) + v(1em) + align(center, + text(weight: "bold", title) + ) + v(1em) + par(justify: true, [ + selbstständig verfasst und keine anderen als die angegebenen Quellen und Hilfsmittel benutzt habe. Ich versichere zudem, dass die eingereichte elektronische Fassung mit der gedruckten Fassung übereinstimmt. + ]) + + let end-date = if (type(date) == datetime) { + date + } else { + date.at(1) + } + + v(2em) + if (at-university) { + text([#city, #end-date.display(date-format)]) + } else { + let connection-string + if (language == "de") { + connection-string = " und " + } else { + connection-string = " and " + } + + text([#authors.map(author => author.company.city).dedup().join(", ", last: connection-string), #end-date.display(date-format)]) + } + + v(1em) + if (many-authors) { + grid( + columns: (1fr, 1fr), + gutter: 20pt, + ..authors.map(author => { + v(3.5em) + line(length: 80%) + author.name + }) + ) + } else { + for author in authors { + v(4em) + line(length: 40%) + author.name + } + } +} \ No newline at end of file diff --git a/packages/preview/supercharged-dhbw/2.0.1/dhbw.svg b/packages/preview/supercharged-dhbw/2.0.1/dhbw.svg new file mode 100644 index 000000000..4a9598b7a --- /dev/null +++ b/packages/preview/supercharged-dhbw/2.0.1/dhbw.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/packages/preview/supercharged-dhbw/2.0.1/example.pdf b/packages/preview/supercharged-dhbw/2.0.1/example.pdf new file mode 100644 index 000000000..f052de21f Binary files /dev/null and b/packages/preview/supercharged-dhbw/2.0.1/example.pdf differ diff --git a/packages/preview/supercharged-dhbw/2.0.1/lib.typ b/packages/preview/supercharged-dhbw/2.0.1/lib.typ new file mode 100644 index 000000000..f922cec1a --- /dev/null +++ b/packages/preview/supercharged-dhbw/2.0.1/lib.typ @@ -0,0 +1,328 @@ +#import "@preview/codelst:2.0.1": * +#import "acronym-lib.typ": init-acronyms, print-acronyms, acr, acrpl, acrs, acrspl, acrl, acrlpl, acrf, acrfpl +#import "titlepage.typ": * +#import "confidentiality-statement.typ": * +#import "declaration-of-authorship.typ": * +#import "check-attributes.typ": * + +// Workaround for the lack of an `std` scope. +#let std-bibliography = bibliography + +#let supercharged-dhbw( + title: none, + authors: (), + language: none, + at-university: none, + type-of-thesis: none, + type-of-degree: none, + show-confidentiality-statement: true, + show-declaration-of-authorship: true, + show-table-of-contents: true, + show-acronyms: true, + show-list-of-figures: true, + show-list-of-tables: true, + show-code-snippets: true, + show-appendix: false, + show-abstract: true, + show-header: true, + numbering-alignment: center, + toc-depth: 3, + acronym-spacing: 5em, + abstract: none, + appendix: none, + acronyms: none, + confidentiality-statement-content: none, + university: none, + university-location: none, + city: none, + supervisor: (:), + date: none, + date-format: "[day].[month].[year]", + bibliography: none, + bib-style: "ieee", + logo-left: image("dhbw.svg"), + logo-right: none, + logo-size-ratio: "1:1", + body, +) = { + // check required attributes + check-attributes( + title, + authors, + language, + at-university, + type-of-thesis, + type-of-degree, + show-confidentiality-statement, + show-declaration-of-authorship, + show-table-of-contents, + show-acronyms, + show-list-of-figures, + show-list-of-tables, + show-code-snippets, + show-appendix, + show-abstract, + show-header, + numbering-alignment, + toc-depth, + acronym-spacing, + abstract, + appendix, + acronyms, + university, + university-location, + supervisor, + date, + city, + bibliography, + bib-style, + logo-left, + logo-right, + logo-size-ratio, + ) + + // set the document's basic properties + set document(title: title, author: authors.map(author => author.name)) + let many-authors = authors.len() > 3 + + init-acronyms(acronyms) + + // define logo size with given ration + let left-logo-height = 2.4cm // left logo is always 2.4cm high + let right-logo-height = 2.4cm // right logo defaults to 1.2cm but is adjusted below + let logo-ratio = logo-size-ratio.split(":") + if (logo-ratio.len() == 2) { + right-logo-height = right-logo-height * (float(logo-ratio.at(1)) / float(logo-ratio.at(0))) + } + + // save heading and body font families in variables + let body-font = "Open Sans" + let heading-font = "Montserrat" + + // customize look of figure + set figure.caption(separator: [ --- ], position: bottom) + + // set body font family + set text(font: body-font, lang: language, 12pt) + show heading: set text(weight: "semibold", font: heading-font) + + //heading numbering + set heading(numbering: "1.") + + // set link style for links that are not acronyms + show link: it => if ( + str(it.dest) not in (acronyms.keys().map(acr => ("acronym-" + acr))) + ) { + text(fill: blue, it) + } else { + it + } + + show heading.where(level: 1): it => { + pagebreak() + v(2em) + it + v(1em) + } + show heading.where(level: 2): it => v(1em) + it + v(0.5em) + show heading.where(level: 3): it => v(0.5em) + it + v(0.25em) + + titlepage( + authors, + date, + heading-font, + language, + left-logo-height, + logo-left, + logo-right, + many-authors, + right-logo-height, + supervisor, + title, + type-of-degree, + type-of-thesis, + university, + university-location, + at-university, + date-format, + ) + + set page( + margin: (top: 8em, bottom: 8em), + header: { + if (show-header) { + grid( + columns: (1fr, auto), + align: (left, right), + gutter: 2em, + emph(align(center + horizon,text(size: 10pt, title))), + stack(dir: ltr, + spacing: 1em, + if logo-left != none { + set image(height: left-logo-height / 2) + logo-left + }, + if logo-right != none { + set image(height: right-logo-height / 2) + logo-right + } + ) + ) + v(-0.75em) + line(length: 100%) + } + } + ) + + // set page numbering to roman numbering + set page( + numbering: "I", + number-align: numbering-alignment, + ) + counter(page).update(1) + + if (not at-university and show-confidentiality-statement) { + confidentiality-statement( + authors, + title, + confidentiality-statement-content, + university, + university-location, + date, + language, + many-authors, + date-format + ) + } + + if (show-declaration-of-authorship) { + declaration-of-authorship( + authors, + title, + date, + language, + many-authors, + at-university, + city, + date-format + ) + } + + show outline.entry.where( + level: 1, + ): it => { + v(18pt, weak: true) + strong(it) + } + + context { + let elems = query(figure.where(kind: image), here()) + let count = elems.len() + + if (show-list-of-figures and count > 0) { + outline( + title: [#heading(level: 3)[#if (language == "de") { + [Abbildungsverzeichnis] + } else { + [List of Figures] + }]], + target: figure.where(kind: image), + ) + } + } + + context { + let elems = query(figure.where(kind: table), here()) + let count = elems.len() + + if (show-list-of-tables and count > 0) { + outline( + title: [#heading(level: 3)[#if (language == "de") { + [Tabellenverzeichnis] + } else { + [List of Tables] + }]], + target: figure.where(kind: table), + ) + } + } + + context { + let elems = query(figure.where(kind: raw), here()) + let count = elems.len() + + if (show-code-snippets and count > 0) { + outline( + title: [#heading(level: 3)[#if (language == "de") { + [Codeverzeichnis] + } else { + [Code Snippets] + }]], + target: figure.where(kind: raw), + ) + } + } + + if (show-table-of-contents) { + outline(title: [#if (language == "de") { + [Inhaltsverzeichnis] + } else { + [Table of Contents] + }], indent: auto, depth: toc-depth) + } + + if (show-acronyms and acronyms != none and acronyms.len() > 0) { + print-acronyms(language, acronym-spacing) + } + + set par(justify: true, leading: 1em) + set block(spacing: 2em) + + if (show-abstract and abstract != none) { + align(center + horizon, heading(level: 1, numbering: none)[Abstract]) + text(abstract) + } + + + // reset page numbering and set to arabic numbering + set page( + numbering: "1", + footer: context align(numbering-alignment, numbering( + "1 / 1", + ..counter(page).get(), + ..counter(page).at(), + )) + ) + counter(page).update(1) + + body + + [#metadata(none)] + // reset page numbering and set to alphabetic numbering + set page( + numbering: "a", + footer: context align(numbering-alignment, numbering( + "a", + ..counter(page).get(), + )) + ) + counter(page).update(1) + + // Display bibliography. + if bibliography != none { + set std-bibliography(title: [#if (language == "de") { + [Literatur] + } else { + [References] + }], style: bib-style) + bibliography + } + + if (show-appendix and appendix != none) { + heading(level: 1, numbering: none)[#if (language == "de") { + [Anhang] + } else { + [Appendix] + }] + appendix + } + +} \ No newline at end of file diff --git a/packages/preview/supercharged-dhbw/2.0.1/template/acronyms.typ b/packages/preview/supercharged-dhbw/2.0.1/template/acronyms.typ new file mode 100644 index 000000000..f7c4ab14a --- /dev/null +++ b/packages/preview/supercharged-dhbw/2.0.1/template/acronyms.typ @@ -0,0 +1,5 @@ +#let acronyms = ( + API: "Application Programming Interface", + HTTP: "Hypertext Transfer Protocol", + REST: "Representational State Transfer", +) \ No newline at end of file diff --git a/packages/preview/supercharged-dhbw/2.0.1/template/assets/ts.svg b/packages/preview/supercharged-dhbw/2.0.1/template/assets/ts.svg new file mode 100644 index 000000000..f5acd4ea8 --- /dev/null +++ b/packages/preview/supercharged-dhbw/2.0.1/template/assets/ts.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/supercharged-dhbw/2.0.1/template/main.typ b/packages/preview/supercharged-dhbw/2.0.1/template/main.typ new file mode 100644 index 000000000..d7dd86f2d --- /dev/null +++ b/packages/preview/supercharged-dhbw/2.0.1/template/main.typ @@ -0,0 +1,121 @@ +#import "@preview/supercharged-dhbw:2.0.1": * +#import "acronyms.typ": acronyms + +#show: supercharged-dhbw.with( + title: "Exploration of Typst for the Composition of a University Thesis", + authors: ( + (name: "Max Mustermann", student-id: "7654321", course: "TIS21", course-of-studies: "IT-Security", company: ( + (name: "YXZ GmbH", post-code: "70435", city: "Stuttgart") + )), + (name: "Juan Pérez", student-id: "1234567", course: "TIM21", course-of-studies: "Mobile Computer Science", company: ( + (name: "ABC S.L.", post-code: "08005", city: "Barcelona", country: "Spain") + )), + ), + acronyms: acronyms, // displays the acronyms defined in the acronyms dictionary + at-university: false, // if true the company name on the title page and the confidentiality statement are hidden + bibliography: bibliography("sources.bib"), + date: datetime.today(), + language: "en", // en, de + supervisor: (company: "John Appleseed"), + university: "Cooperative State University Baden-Württemberg", + university-location: "Ravensburg Campus Friedrichshafen", + // for more options check the package documentation (https://typst.app/universe/package/supercharged-dhbw) +) + +// Edit this content to your liking + += Introduction + +#lorem(100) + +#lorem(100) + +#lorem(100) + += Examples + +#lorem(30) + +== Acronyms + +Use the `acr` function to insert acronyms, which looks like this #acr("HTTP"). + +#acrlpl("API") are used to define the interaction between different software systems. + +#acrs("REST") is an architectural style for networked applications. + +== Lists + +Create bullet lists or numbered lists. + +- These bullet +- points +- are colored + ++ It also ++ works with ++ numbered lists! + +== Figures and Tables + +Create figures or tables like this: + +=== Figures + +#figure(caption: "Image Example", image(width: 4cm, "assets/ts.svg")) + +=== Tables + +#figure(caption: "Table Example", table( + columns: (1fr, auto, auto), + inset: 10pt, + align: horizon, + table.header( + [], [*Area*], [*Parameters*], + ), + text("cylinder.svg"), + $ pi h (D^2 - d^2) / 4 $, + [ + $h$: height \ + $D$: outer radius \ + $d$: inner radius + ], + text("tetrahedron.svg"), + $ sqrt(2) / 12 a^3 $, + [$a$: edge length] +)) + +== Code Snippets + +Insert code snippets like this: + +#figure(caption: "Codeblock Example", sourcecode[```typ +#show "ArtosFlow": name => box[ + #box(image( + "logo.svg", + height: 0.7em, + )) + #name +] + +This report is embedded in the +ArtosFlow project. ArtosFlow is a +project of the Artos Institute. +```]) + +== References + +Cite like this #cite(form: "prose", ). +Or like this @iso18004. + +You can also reference by adding `` with the desired name after figures or headings. + +For example this @table references the table on the previous page. + += Conclusion + +#lorem(100) + +#lorem(120) + +#lorem(80) \ No newline at end of file diff --git a/packages/preview/supercharged-dhbw/2.0.1/template/sources.bib b/packages/preview/supercharged-dhbw/2.0.1/template/sources.bib new file mode 100644 index 000000000..eb51cb4f7 --- /dev/null +++ b/packages/preview/supercharged-dhbw/2.0.1/template/sources.bib @@ -0,0 +1,6 @@ +@inproceedings{iso18004, + title = {{ISO/IEC 18004: Information technology -- Automatic identification and data capture techniques -- QR code bar code symbology specification}}, + booktitle = {ISO/IEC 18004:2000}, + author = {{International Organization for Standardization}}, + year = {2000}, +} \ No newline at end of file diff --git a/packages/preview/supercharged-dhbw/2.0.1/thumbnail.png b/packages/preview/supercharged-dhbw/2.0.1/thumbnail.png new file mode 100644 index 000000000..e111117c1 Binary files /dev/null and b/packages/preview/supercharged-dhbw/2.0.1/thumbnail.png differ diff --git a/packages/preview/supercharged-dhbw/2.0.1/titlepage.typ b/packages/preview/supercharged-dhbw/2.0.1/titlepage.typ new file mode 100644 index 000000000..ab0c48c14 --- /dev/null +++ b/packages/preview/supercharged-dhbw/2.0.1/titlepage.typ @@ -0,0 +1,250 @@ +#let titlepage( + authors, + date, + heading-font, + language, + left-logo-height, + logo-left, + logo-right, + many-authors, + right-logo-height, + supervisor, + title, + type-of-degree, + type-of-thesis, + university, + university-location, + at-university, + date-format, +) = { + if (many-authors) { + v(-1.5em) + } else { + v(-1em) + } + + // logos (optional) + stack(dir: ltr, + spacing: 1fr, + // Logo at top left if given + align(horizon, + if logo-left != none { + set image(height: left-logo-height) + logo-left + } + ), + + // Logo at top right if given + align(horizon, + if logo-right != none { + set image(height: right-logo-height) + logo-right + } + ) + ) + + if (many-authors) { + v(1fr) + } else { + v(1.5fr) + } + + // title + align(center, text(weight: "semibold", font: heading-font, 2em, title)) + + if (many-authors) { + v(0.5em) + } else { + v(1.5em) + } + + // type of thesis (optional) + if (type-of-thesis != none and type-of-thesis.len() > 0) { + align(center, text(weight: "semibold", 1.25em, type-of-thesis)) + v(0.5em) + } + + // type of degree (optional) + if (type-of-degree != none and type-of-degree.len() > 0) { + align(center, text(1em, [#if (language == "de") { + [für den Erwerb des] + } else { + [for the] + }])) + + v(-0.25em) + align(center, text(weight: "semibold", 1.25em, type-of-degree)) + } + v(1.5em) + + // course of studies + align(center, text(1.2em, [#if (language == "de") { + [aus dem Studiengang #authors.map(author => author.course-of-studies).dedup().join(" | ")] + } else { + [from the course of studies #authors.map(author => author.course-of-studies).dedup().join(" | ")] + }])) + + if (many-authors) { + v(0.75em) + } else { + v(1em) + } + + // university + align(center, text(1.2em, [#if (language == "de") { + [an der #university #university-location] + } else { + [at the #university #university-location] + }])) + + if (many-authors) { + v(0.8em) + } else { + v(3em) + } + + align(center, text(1em, if (language == "de") { + "von" + } else { + "by" + })) + + if (many-authors) { + v(0.8em) + } else { + v(2em) + } + + // authors + grid( + columns: 100%, + gutter: if (many-authors) { + 14pt + } else { + 18pt + }, + ..authors.map(author => align(center, { + text(weight: "medium", 1.25em, [#author.name]) + })) + ) + + if (many-authors) { + v(0.8em) + } else { + v(2em) + } + + // date + align(center, text(1.2em, if (type(date) == datetime) { + date.display(date-format) + } else { + [#date.at(0).display(date-format) -- #date.at(1).display(date-format)] + })) + + v(1fr) + + // author information + grid( + columns: (180pt, auto), + gutter: 11pt, + + // students + text(weight: "semibold", if (language == "de") { + [Matrikelnummer, Kurs:] + } else { + [Student ID, Course:] + }), + stack( + dir: ttb, + for author in authors { + text([#author.student-id, #author.course]) + linebreak() + } + ), + + // company + if (not at-university) { + text(weight: "semibold", if (language == "de") { + "Unternehmen:" + } else { + "Company:" + }) + }, + if (not at-university) { + stack( + dir: ttb, + for author in authors { + let company-address = "" + + // company name + if ( + "name" in author.company and + author.company.name != none and + author.company.name != "" + ) { + company-address+= author.company.name + } else { + panic("Author '" + author.name + "' is missing a company name. Add the 'name' attribute to the company object.") + } + + // company address (optional) + if ( + "post-code" in author.company and + author.company.post-code != none and + author.company.post-code != "" + ) { + company-address+= text([, #author.company.post-code]) + } + + // company city + if ( + "city" in author.company and + author.company.city != none and + author.company.city != "" + ) { + company-address+= text([, #author.company.city]) + } else { + panic("Author '" + author.name + "' is missing the city of the company. Add the 'city' attribute to the company object.") + } + + // company country (optional) + if ( + "country" in author.company and + author.company.country != none and + author.company.country != "" + ) { + company-address+= text([, #author.company.country]) + } + + company-address + linebreak() + } + ) + }, + + // supervisor + // company + if ("company" in supervisor) { + text(weight: "semibold", if (language == "de") { + "Betreuer im Unternehmen:" + } else { + "Supervisor in the Company:" + }) + }, + if ("company" in supervisor and type(supervisor.company) == str) { + text(supervisor.company) + }, + + // university + if ("university" in supervisor) { + text(weight: "semibold", if (language == "de") { + "Betreuer an der DHBW:" + } else { + "Supervisor at DHBW:" + }) + }, + if ("university" in supervisor and type(supervisor.university) == str) { + text(supervisor.university) + } + ) +} \ No newline at end of file diff --git a/packages/preview/supercharged-dhbw/2.0.1/typst.toml b/packages/preview/supercharged-dhbw/2.0.1/typst.toml new file mode 100644 index 000000000..d0b96393e --- /dev/null +++ b/packages/preview/supercharged-dhbw/2.0.1/typst.toml @@ -0,0 +1,16 @@ +[package] +name = "supercharged-dhbw" +version = "2.0.1" +entrypoint = "lib.typ" +authors = ["Danny Seidel <@DannySeidel>"] +license = "MIT" +description = "Unofficial Template for DHBW" +repository = "https://github.com/DannySeidel/typst-dhbw-template" +keywords = ["dhbw", "thesis"] +categories = ["paper", "thesis", "report"] +exclude = ["example.pdf"] + +[template] +path = "template" +entrypoint = "main.typ" +thumbnail = "thumbnail.png" \ No newline at end of file