diff --git a/packages/preview/efter-plugget/0.1.0/.gitignore b/packages/preview/efter-plugget/0.1.0/.gitignore new file mode 100644 index 0000000000..d62ddbb5be --- /dev/null +++ b/packages/preview/efter-plugget/0.1.0/.gitignore @@ -0,0 +1,2 @@ +*.pdf +*.txt diff --git a/packages/preview/efter-plugget/0.1.0/LICENSE b/packages/preview/efter-plugget/0.1.0/LICENSE new file mode 100644 index 0000000000..7ae8865914 --- /dev/null +++ b/packages/preview/efter-plugget/0.1.0/LICENSE @@ -0,0 +1,10 @@ +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE +FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/packages/preview/efter-plugget/0.1.0/README.md b/packages/preview/efter-plugget/0.1.0/README.md new file mode 100644 index 0000000000..fc9aa80bcc --- /dev/null +++ b/packages/preview/efter-plugget/0.1.0/README.md @@ -0,0 +1,18 @@ +# Lab report, essay and exam template for Typst + +## Example document + +```bash +# Generate new report based on template. +typst init @preview/efter-plugget +``` + +![Example lab report](inc/thumbnail.png) + +## Logo + +The default logo used in the template is the [Stockholm University logotype](https://medarbetare.su.se/en/our-su/communicate-su/graphic-profile/logotype). It is goverened by copyright. Replace it with the logo of your University. + +## Etymology + +The package is named _"Efter plugget"_ in tribute of a Swedish song about finishing Uni. diff --git a/packages/preview/efter-plugget/0.1.0/inc/default_logo.png b/packages/preview/efter-plugget/0.1.0/inc/default_logo.png new file mode 100644 index 0000000000..723d820900 Binary files /dev/null and b/packages/preview/efter-plugget/0.1.0/inc/default_logo.png differ diff --git a/packages/preview/efter-plugget/0.1.0/inc/thumbnail.png b/packages/preview/efter-plugget/0.1.0/inc/thumbnail.png new file mode 100644 index 0000000000..46a2325dae Binary files /dev/null and b/packages/preview/efter-plugget/0.1.0/inc/thumbnail.png differ diff --git a/packages/preview/efter-plugget/0.1.0/src/lib.typ b/packages/preview/efter-plugget/0.1.0/src/lib.typ new file mode 100644 index 0000000000..3a97dbbf4c --- /dev/null +++ b/packages/preview/efter-plugget/0.1.0/src/lib.typ @@ -0,0 +1,197 @@ +#import "@preview/latex-lookalike:0.1.4" +#import "@preview/hallon:0.1.2" + +#import "@preview/nth:1.0.1": nth + +// template formats the document as a lab report, essay or exam. +#let template( + logo: image("/inc/default_logo.png"), + title: "Lab report", + subtitle: none, + page-header-title: none, + course-name: none, + course-code: none, + course-part: none, + lab-name: none, + authors: none, + lab-partners: none, + lab-supervisor: none, + lab-group: none, + lab-date: none, + + // Report contents. + body, +) = { + // Set document metadata. + set document(title: title) + + // support both array and string type for authors. + let authors-str = authors + if type(authors) == array { + authors-str = authors.join(", ", last: " and ") + } + + // Set page size and margins. + set page( + paper: "a4", + margin: (x: 2.5cm, top: 3.1cm, bottom: 3.55cm), + header: { + grid( + columns: (2fr, 1fr, 2fr), + align: (left, center, right), + inset: (bottom: 5pt), + // left + course-code, + // middle + page-header-title, + //right + authors-str, + grid.hline(stroke: 0.4pt), + ) + }, + ) + + // Set default font. + set text(font: "New Computer Modern") + + // Style outline, headings, lists and quotes using the style of LaTeX. + show: latex-lookalike.style + + // Style links and citations. + let linkblue = blue + show ref: set text(fill: linkblue) + show cite: set text(fill: linkblue) + + // Place table and listing captions at top. + show figure.where(kind: table): set figure.caption(position: top) + show figure.where(kind: raw): set figure.caption(position: top) + + // Style figures and subfigures. + show: hallon.style-figures + + // Set title of bibliography. + set bibliography(title: "References") + + // === [ Frontmatter ] ====================================================== + + // --- [ Front page ] ------------------------------------------------------- + + page( + numbering: none, + header: none, + margin: (x: 1.55cm, top: 3.1cm, bottom: 3.55cm), + )[ + #grid( + columns: (5.10cm, 1fr), + gutter: 3pt, + grid.vline(x: 1, stroke: 0.4pt + black), + // left cell (logo) + { + set image(width: 4.3cm) + logo + }, + // right cell (title) + block(height: 100%, inset: 2.1em)[ + #v(6.1cm) + #if course-name != none { text(size: 1.2em)[ #course-name \ ] } + #if course-code != none { text(size: 1.2em)[ (#course-code) ] } + + // title + #text(size: 2.1em, weight: "bold", title) + + // subtitle + #if subtitle != none { v(-1.5em) + text(size: 1.5em, weight: "bold", subtitle) } + + // date + #text(size: 1.2em, { + let today = datetime.today() + nth(today.display("[day padding:none]")) + today.display(" [month repr:long] [year]") + }) + + #v(1fr) + + #let cells = () + #if course-name != none { + cells.push([Course:]) + cells.push([#course-name]) + } + #if course-part != none { + cells.push([Course part:]) + cells.push([#course-part]) + } + #if lab-name != none { + cells.push([Lab:]) + cells.push([#lab-name]) + } + #if authors != none { + // support both array and string type for authors. + if type(authors) != array { + cells.push([Author:]) + cells.push([#authors]) + } else { + if authors.len() > 1 { + cells.push([Authors:]) + } else { + cells.push([Author:]) + } + cells.push([#authors.join(", ", last: " and ")]) + } + } + #if lab-partners != none { + // support both array and string type for lab partners. + if type(lab-partners) != array { + cells.push([Lab partner:]) + cells.push([#lab-partners]) + } else { + if lab-partners.len() > 1 { + cells.push([Lab partners:]) + } else { + cells.push([Lab partner:]) + } + cells.push([#lab-partners.join(", ", last: " and ")]) + } + } + #if lab-supervisor != none { + cells.push([Lab supervisor:]) + cells.push([#lab-supervisor]) + } + #if lab-group != none { + cells.push([Lab group:]) + cells.push([#lab-group]) + } + #if lab-date != none { + cells.push([Lab date:]) + cells.push([#lab-date]) + } + #block(inset: 0.4em)[ + #grid( + columns: (auto, 1fr), + gutter: 10pt, + ..cells, + ) + ] + ], + ) + ] + + pagebreak(weak: true) + + // --- [ Table of contents ] ------------------------------------------------ + + set page(numbering: "i") + counter(page).update(1) + + outline() + pagebreak(weak: true) + + // Style all links after outline. + show link: set text(fill: linkblue) + + // --- [ Main matter ] ------------------------------------------------------ + + set page(numbering: "1") + counter(page).update(1) + + body +} diff --git a/packages/preview/efter-plugget/0.1.0/template/inc/logo.png b/packages/preview/efter-plugget/0.1.0/template/inc/logo.png new file mode 100644 index 0000000000..723d820900 Binary files /dev/null and b/packages/preview/efter-plugget/0.1.0/template/inc/logo.png differ diff --git a/packages/preview/efter-plugget/0.1.0/template/references.bib b/packages/preview/efter-plugget/0.1.0/template/references.bib new file mode 100644 index 0000000000..962fda339c --- /dev/null +++ b/packages/preview/efter-plugget/0.1.0/template/references.bib @@ -0,0 +1,6 @@ +@book{2020_molecular_biology_principles_of_genome_function_craig, + title={Molecular biology: principles of genome function}, + author={Craig, Nancy and Green, Rachel and Cohen-Fix, Orna and Greider, Carol and Storz, Gisela and Wolberger, Cynthia}, + year={2020}, + publisher={Oxford University Press} +} diff --git a/packages/preview/efter-plugget/0.1.0/template/report.typ b/packages/preview/efter-plugget/0.1.0/template/report.typ new file mode 100644 index 0000000000..4bce25e876 --- /dev/null +++ b/packages/preview/efter-plugget/0.1.0/template/report.typ @@ -0,0 +1,120 @@ +#import "@preview/efter-plugget:0.1.0" + +#let todo = highlight + +// hallon is an optional library for subfigures. +#import "@preview/hallon:0.1.2": subfigure +// cellpress is an optional library for Cell Press table style. +#import "@preview/cellpress-unofficial:0.1.0" as cellpress: toprule, midrule, bottomrule +// smartaref is an optional library for handling consecutive references. +#import "@preview/smartaref:0.1.0": cref, Cref + +#show: efter-plugget.template.with( + logo: image("inc/logo.png"), + title: todo[Lab 1 -- Stem Cells], + subtitle: todo[An investigation into the effects of morphogens on differentiation], + page-header-title: todo("Lab 1"), + course-name: todo("Course Name"), + course-code: todo("AA1234"), + //course-part: "", + lab-name: todo("Stem cell differentiation"), + authors: todo("Jane Rue"), + lab-partners: (todo("John Doe"), todo("Eve Smith")), + //lab-supervisor: "", + lab-group: todo("Group 1"), + lab-date: datetime.today().display(), // "2025-09-19" +) + +#show: cellpress.style-table + +// === [ quote ] =============================================================== + +#quote( + block: true, + attribution: [anonymous], +)[ + #emph["Chemistry is all around us."] +] + +// === [ Introduction ] ======================================================== + += Introduction + +#lorem(35) + +== Purpose + +#lorem(10) + +== Theory + +#lorem(10) @2020_molecular_biology_principles_of_genome_function_craig + +#pagebreak(weak: true) + +// === [ Methods ] ============================================================= + += Methods + +#lorem(10) + +#pagebreak(weak: true) + +// === [ Results ] ============================================================= + += Results + +#lorem(10) + +As seen in #cref[@subfig-foo @subfig-bar] ... + +#figure( + grid( + columns: 2, + gutter: 1em, + subfigure( + rect(fill: aqua), // image("/inc/foo.png"), + caption: lorem(3), + label: + ), + subfigure( + rect(fill: teal), // image("/inc/bar.png"), + caption: lorem(3), + label: + ), + ), + gap: 1em, + caption: lorem(5), +) + +The results of the experiment are presented in @tbl-bar ... + +#figure( + caption: lorem(5), + table( + columns: 3, + toprule(), + table.header[*foo*][*bar*][*baz*], + midrule(), + [a], [b], [c], + [a], [b], [c], + [a], [b], [c], + bottomrule(), + ), +) + +#pagebreak(weak: true) + +// === [ Discussion ] ========================================================== + += Discussion + +#lorem(10) + +#pagebreak(weak: true) + +// === [ Bibliography ] ======================================================== + +#bibliography("references.bib") + +#pagebreak(weak: true) diff --git a/packages/preview/efter-plugget/0.1.0/typst.toml b/packages/preview/efter-plugget/0.1.0/typst.toml new file mode 100644 index 0000000000..1b52fc7687 --- /dev/null +++ b/packages/preview/efter-plugget/0.1.0/typst.toml @@ -0,0 +1,15 @@ +[package] +name = "efter-plugget" +version = "0.1.0" +entrypoint = "src/lib.typ" +authors = ["Robin Eklind"] +license = "0BSD" +description = "Lab report, essay and exam template for Typst." +repository = "https://github.com/mewmew/efter-plugget" +categories = ["report"] +exclude = ["/inc"] + +[template] +path = "template" +entrypoint = "report.typ" +thumbnail = "inc/thumbnail.png"