diff --git a/packages/preview/nidaros-ntnu-thesis/0.1.0/LICENSE b/packages/preview/nidaros-ntnu-thesis/0.1.0/LICENSE new file mode 100644 index 0000000000..fe403136c6 --- /dev/null +++ b/packages/preview/nidaros-ntnu-thesis/0.1.0/LICENSE @@ -0,0 +1,16 @@ +MIT No Attribution + +Copyright 2026 Jan-Oivind Lima + +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. + +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/nidaros-ntnu-thesis/0.1.0/README.md b/packages/preview/nidaros-ntnu-thesis/0.1.0/README.md new file mode 100644 index 0000000000..8aca1ff2f7 --- /dev/null +++ b/packages/preview/nidaros-ntnu-thesis/0.1.0/README.md @@ -0,0 +1,86 @@ +# Nidaros NTNU Thesis + +Unofficial NTNU thesis template for Typst, based on the public visual structure of the NTNU LaTeX thesis template. The goal is to give students a compact Typst starting point with NTNU-like title pages, roman-numbered front matter, chapter openings, running headers, lists of figures/tables, references, and appendices. + +This project is not affiliated with, endorsed by, or maintained by NTNU. + +## Usage + +Start a new project from Typst Universe: + +```sh +typst init @preview/nidaros-ntnu-thesis:0.1.0 +``` + +Or import the template in an existing document: + +```typst +#import "@preview/nidaros-ntnu-thesis:0.1.0": * + +#show: ntnu-thesis.with( + title: [The title of your master's thesis], + author: "Your Name", +) +``` + +The generated `main.typ` shows the recommended structure: + +```typst +#title-page( + author: "Your Name", + title: "The title of your master's thesis", + subtitle: "Optional subtitle", + programme: "Master's thesis in Physics and Mathematics", + supervisor: "Supervisor Name", + co-supervisor: "Co-supervisor Name", + date: "June 2026", +) + +#front-matter[ + #front-chapter("Abstract")[Your abstract.] + #contents() +] + +#main-matter[ + = Introduction + Your thesis starts here. +] +``` + +## Logo + +The official NTNU logo is not bundled with this template. University logos and similar assets usually need explicit redistribution rights. If you have permission to use the logo in your own thesis, pass it as content from your project: + +```typst +#title-page( + logo: image("figures/ntnu-logo.png", width: 28%), +) +``` + +## Public API + +- `ntnu-thesis(..)[body]`: Applies global document, font, heading, figure, equation, paragraph, and link styles. +- `title-page(..)`: Creates the NTNU-like thesis title page. +- `front-matter[body]`: Starts roman-numbered front matter with centered footers. +- `front-chapter(title)[body]`: Creates unnumbered front matter chapters such as Abstract and Preface. +- `contents()`: Creates Contents, List of Figures, and List of Tables pages. +- `main-matter[body]`: Starts arabic-numbered main matter with running chapter headers. +- `references[body]`: Adds a references page wrapper. Put `#bibliography("bibliography.bib", title: "References", style: "ieee")` inside it. +- `appendices[body]`: Starts the appendix section. + +## Development + +This repository is intentionally small. Do not commit generated PDFs, LaTeX build artifacts, local editor files, or copyrighted assets without redistribution rights. + +To test the template locally before it is published, place or symlink the repository into Typst's local package path as: + +```text +{data-dir}/typst/packages/preview/nidaros-ntnu-thesis/0.1.0 +``` + +Then run: + +```sh +typst init @preview/nidaros-ntnu-thesis:0.1.0 +typst compile main.typ +``` diff --git a/packages/preview/nidaros-ntnu-thesis/0.1.0/lib.typ b/packages/preview/nidaros-ntnu-thesis/0.1.0/lib.typ new file mode 100644 index 0000000000..4716379f10 --- /dev/null +++ b/packages/preview/nidaros-ntnu-thesis/0.1.0/lib.typ @@ -0,0 +1,246 @@ +// Unofficial NTNU thesis template for Typst. + +#let chapter-word(n) = ( + "ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", + "SIX", "SEVEN", "EIGHT", "NINE", "TEN", +).at(n, default: str(n)) + +#let section-figure-number(n) = context { + let h = counter(heading).get() + if h.len() >= 2 { + numbering("1.1.1", h.at(0), h.at(1), n) + } else if h.len() >= 1 { + numbering("1.1", h.at(0), n) + } else { + numbering("1", n) + } +} + +#let chapter-equation-number(n) = context { + let h = counter(heading).get() + if h.len() >= 1 { + numbering("(1.1)", h.at(0), n) + } else { + numbering("(1)", n) + } +} + +#let dotfill() = box(width: 1fr, repeat([. ], gap: 0.33em)) + +#let running-chapter-header(short-title: none) = context { + let page-number = counter(page).get().first() + let page-label = counter(page).display("1") + let headings = query(heading.where(level: 1)) + let current-page = here().page() + let on-chapter-page = headings.any(it => it.location().page() == current-page) + + if on-chapter-page { + none + } else { + let before = query(heading.where(level: 1).before(here())) + if before.len() == 0 { + none + } else { + let current = before.last() + let title = if short-title == none { current.body } else { short-title } + let number = counter(heading).at(current.location()).first() + let mark = text(size: 10pt, [CHAPTER #number. #upper(title)]) + if calc.odd(page-number) { + grid(columns: (1fr, 1fr), mark, align(right, text(size: 10pt, page-label))) + } else { + grid(columns: (1fr, 1fr), text(size: 10pt, page-label), align(right, mark)) + } + } + } +} + +#let chapter-heading(it) = { + if it.numbering != none { + pagebreak(to: "odd") + place(bottom + center, text(size: 10pt, counter(page).display("1"))) + v(2.15cm) + context { + let n = counter(heading).at(it.location()).first() + line(length: 100%, stroke: 0.8pt) + align(right, text(size: 12pt, weight: "regular", [CHAPTER])) + v(-0.18cm) + align(right, text(size: 16.5pt, weight: "regular", chapter-word(n))) + v(-0.09cm) + line(length: 100%, stroke: 0.8pt) + v(0.44cm) + align(right, text(size: 17pt, weight: "regular", upper(it.body))) + v(0.68cm) + } + } else { + block(below: 1.2em, it.body) + } +} + +#let ntnu-thesis( + title: [NTNU thesis], + author: "Author", + body-font: "New Computer Modern", + mono-font: "DejaVu Sans Mono", + paper: "a4", + body, +) = { + set document(title: title, author: author) + set page( + paper: paper, + margin: (left: 1.5in, right: 1in, top: 1in, bottom: 1in), + ) + set text(font: body-font, size: 12pt, lang: "en") + set par(justify: true, leading: 0.55em, first-line-indent: 0pt) + set list(indent: 1.2em, body-indent: 0.4em) + set table(inset: (x: 0.6em, y: 0.55em), stroke: none) + set heading(numbering: "1.1.1.1") + set math.equation(numbering: chapter-equation-number) + set figure(numbering: section-figure-number) + + show raw: set text(font: mono-font, size: 10pt) + show link: set text(fill: rgb("#1b4f72")) + show heading.where(level: 1): chapter-heading + show heading.where(level: 2): it => block( + above: 1.15em, + below: 0.45em, + text(size: 14pt, weight: "bold", it), + ) + show heading.where(level: 3): it => block( + above: 0.85em, + below: 0.35em, + text(size: 12.5pt, weight: "bold", it), + ) + show heading.where(level: 4): it => block( + above: 0.75em, + below: 0.3em, + text(size: 12pt, weight: "bold", it), + ) + show figure.caption: set text(weight: "bold", size: 10pt) + show figure: set block(above: 1.0em, below: 1.0em) + + body +} + +#let title-page( + author: "Your Name", + title: "The title of your master's thesis should be written here", + subtitle: "Any undertitle is written here", + programme: "Master's thesis in Physics and Mathematics", + supervisor: "Supervisor Name", + co-supervisor: "Co-supervisor Name", + date: "June 2026", + university: "Norwegian University of Science and Technology", + faculty: "Faculty of Natural Sciences", + department: "Department of Physics", + logo: none, +) = { + set page( + paper: "a4", + margin: (left: 1.6in, right: 2in, top: 1in, bottom: 1in), + numbering: none, + header: none, + footer: none, + ) + v(1.5cm) + text(fill: gray, size: 14pt, author) + v(1cm) + text(weight: "bold", size: 17pt, title) + v(0.5cm) + text(size: 14pt, subtitle) + v(7cm) + programme + linebreak() + [Supervisor: #supervisor] + linebreak() + [Co-supervisor: #co-supervisor] + linebreak() + date + v(0.2cm) + university + linebreak() + faculty + linebreak() + department + v(0.55cm) + if logo == none { + text(size: 24pt, weight: "bold", [NTNU]) + } else { + logo + } + pagebreak() + pagebreak() +} + +#let front-matter(body) = { + set page( + paper: "a4", + margin: (left: 1.5in, right: 1in, top: 1in, bottom: 1in), + numbering: "i", + header: none, + footer: context align(center, text(size: 10pt, counter(page).display("i"))), + ) + set heading(numbering: none) + counter(page).update(1) + body +} + +#let front-chapter(title, body) = { + context place(bottom + center, text(size: 10pt, counter(page).display("i"))) + v(2.35cm) + align(right, text(size: 18pt, weight: "regular", upper(title))) + v(1.65cm) + body +} + +#let outline-page(title, target: heading, depth: 3) = { + v(2.45cm) + align(right, text(size: 18pt, weight: "regular", upper(title))) + v(1.9cm) + set outline(indent: auto, depth: depth) + show outline.entry.where(level: 1): set text(weight: "bold") + outline(title: none, target: target) +} + +#let contents() = { + outline-page("Contents", depth: 3) + pagebreak() + outline-page("List of Figures", target: figure.where(kind: image), depth: 1) + pagebreak() + outline-page("List of Tables", target: figure.where(kind: table), depth: 1) + pagebreak() +} + +#let main-matter(short-title: none, body) = { + pagebreak() + set page( + paper: "a4", + margin: (left: 1.5in, right: 1in, top: 1in, bottom: 1in), + numbering: "1", + header: running-chapter-header(short-title: short-title), + footer: none, + ) + set heading(numbering: "1.1.1.1") + counter(page).update(1) + counter(heading).update(0) + body +} + +#let references(body) = { + pagebreak(to: "odd") + body +} + +#let appendices(body) = { + set page( + paper: "a4", + margin: (left: 1.5in, right: 1in, top: 1in, bottom: 1in), + numbering: "1", + header: none, + footer: context align(center, text(size: 10pt, counter(page).display("1"))), + ) + pagebreak(to: "odd") + heading(numbering: none, outlined: true, text(size: 17pt, weight: "regular", [Appendices])) + set heading(numbering: none) + counter(figure).update(0) + body +} diff --git a/packages/preview/nidaros-ntnu-thesis/0.1.0/template/bibliography.bib b/packages/preview/nidaros-ntnu-thesis/0.1.0/template/bibliography.bib new file mode 100644 index 0000000000..6c6b336f00 --- /dev/null +++ b/packages/preview/nidaros-ntnu-thesis/0.1.0/template/bibliography.bib @@ -0,0 +1,6 @@ +@book{knuth1984texbook, + author = {Donald E. Knuth}, + title = {The TeXbook}, + year = {1984}, + publisher = {Addison-Wesley}, +} diff --git a/packages/preview/nidaros-ntnu-thesis/0.1.0/template/main.typ b/packages/preview/nidaros-ntnu-thesis/0.1.0/template/main.typ new file mode 100644 index 0000000000..56e8940958 --- /dev/null +++ b/packages/preview/nidaros-ntnu-thesis/0.1.0/template/main.typ @@ -0,0 +1,151 @@ +#import "@preview/nidaros-ntnu-thesis:0.1.0": * + +#show: ntnu-thesis.with( + title: [The title of your master's thesis], + author: "Your Name", +) + +#title-page( + author: "Your Name", + title: "The title of your master's thesis should be written here", + subtitle: "Any undertitle is written here", + programme: "Master's thesis in Physics and Mathematics", + supervisor: "Supervisor Name", + co-supervisor: "Co-supervisor Name", + date: "June 2026", + faculty: "Faculty of Natural Sciences", + department: "Department of Physics", + // logo: image("figures/ntnu-logo.png", width: 28%), +) + +#front-matter[ + #front-chapter("Abstract")[ + Write an abstract/summary of your thesis, and state your main findings here. + + A summary should be included in both English and a second language if this is applicable. + ] + + #pagebreak() + + #front-chapter("Preface")[ + Write the preface of your thesis here. You may include acknowledgements and thanks as part of your preface. + ] + + #pagebreak() + + #contents() + + #front-chapter("Abbreviations")[ + List abbreviations in alphabetic order: + + - *EDA* Exploratory Data Analysis + - *GNSS* Global Navigation Satellite System + - *NTNU* Norwegian University of Science and Technology + ] +] + +#main-matter(short-title: [The title])[ + = Introduction + + == Motivation + + This is the beginning of your thesis. Cite sources with `@knuth1984texbook` and reference figures with labels. + + == Project Description + + Typst lets you write chapters, sections, figures, equations, tables, citations, and references with compact markup. + + === Stakeholders + + Add your thesis text here. + + = Theory + + == Equations + + Numbered equations follow the current chapter: + + $ integral_0^1 x^2 dif x = 1 / 3 $ + + == Tables and Footnotes + + #figure( + table( + columns: 3, + [Feature], [Mean], [Std. dev.], + [Speed], [12.4], [2.1], + [Altitude], [108.0], [14.3], + ), + caption: [Dynamic feature statistics with outliers], + ) + + See @tab-stats for a compact table. + + == A Single Figure + + #figure( + rect(width: 70%, height: 5cm, stroke: 0.8pt, inset: 1em)[ + #align(center + horizon)[Figure placeholder] + ], + caption: [Illustration of latitude and longitude], + ) + + See @fig-latlong for a figure reference. + + == Citations + + This sentence cites @knuth1984texbook. + + = Methods + + == Section One + + Method text goes here. + + === Subsection One + + More method text goes here. + + === Subsection Two + + More method text goes here. + + == Section Two + + Add more thesis content here. + + = Results + + == More Figures + + #figure( + rect(width: 72%, height: 5cm, stroke: 0.8pt, inset: 1em)[ + #align(center + horizon)[Result figure placeholder] + ], + caption: [Trajectory angle], + ) + + = Discussion + + == Future Work + + Discuss limitations, implications, and future work. + + = Conclusions + + Conclude your thesis here. + + #references[ + #bibliography("bibliography.bib", title: "References", style: "ieee") + ] +] + +#appendices[ + = Github Repository + + Add appendix material here. + + = Sidenote Statistics + + Add additional tables, figures, or notes here. +] diff --git a/packages/preview/nidaros-ntnu-thesis/0.1.0/thumbnail.png b/packages/preview/nidaros-ntnu-thesis/0.1.0/thumbnail.png new file mode 100644 index 0000000000..fda63c600f Binary files /dev/null and b/packages/preview/nidaros-ntnu-thesis/0.1.0/thumbnail.png differ diff --git a/packages/preview/nidaros-ntnu-thesis/0.1.0/typst.toml b/packages/preview/nidaros-ntnu-thesis/0.1.0/typst.toml new file mode 100644 index 0000000000..4d34b15d72 --- /dev/null +++ b/packages/preview/nidaros-ntnu-thesis/0.1.0/typst.toml @@ -0,0 +1,18 @@ +[package] +name = "nidaros-ntnu-thesis" +version = "0.1.0" +entrypoint = "lib.typ" +authors = ["Jan-Oivind Lima <@Lima98>"] +license = "MIT-0" +description = "Master's thesis at NTNU." +repository = "https://github.com/Lima98/nidaros-ntnu-thesis" +keywords = ["NTNU", "Norwegian University of Science and Technology", "thesis", "master"] +categories = ["thesis"] +disciplines = [] +compiler = "0.14.0" +exclude = ["*.pdf"] + +[template] +path = "template" +entrypoint = "main.typ" +thumbnail = "thumbnail.png"