Skip to content

Commit 0ce0e14

Browse files
committed
efter-plugget:0.1.0
1 parent e11dc53 commit 0ce0e14

File tree

9 files changed

+294
-0
lines changed

9 files changed

+294
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.pdf
2+
*.txt
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Lab report, essay and exam template for Typst
2+
3+
## Example document
4+
5+
```bash
6+
# Generate new report based on template.
7+
typst init @preview/efter-plugget
8+
```
9+
10+
![Example lab report](inc/thumbnail.png)
11+
12+
## Logo
13+
14+
The default logo used 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.
24.2 KB
Loading
197 KB
Loading
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
#import "@preview/latex-lookalike:0.1.4"
2+
3+
#import "@preview/nth:1.0.1": nth
4+
5+
// This function gets your whole document as its `body` and formats it as a lab
6+
// report.
7+
#let template(
8+
logo: image("/inc/default_logo.png", width: 4.3cm),
9+
title: "Lab report",
10+
sub-title: none,
11+
short-title: none,
12+
course-name: none,
13+
course-code: none,
14+
course-part: none,
15+
lab-name: none,
16+
author: none,
17+
lab-partners: none,
18+
lab-supervisor: none,
19+
lab-group: none,
20+
lab-date: none,
21+
22+
// Report contents.
23+
body,
24+
) = {
25+
// Set document metadata.
26+
set document(title: title)
27+
28+
// Set page size and margins.
29+
set page(
30+
paper: "a4",
31+
margin: (x: 2.5cm, top: 3.1cm, bottom: 3.55cm),
32+
header: {
33+
grid(
34+
columns: (2fr, 1fr, 2fr),
35+
align: (left, center, right),
36+
inset: (bottom: 5pt),
37+
// left
38+
course-code,
39+
// middle
40+
short-title,
41+
//right
42+
author,
43+
grid.hline(stroke: 0.4pt),
44+
)
45+
},
46+
)
47+
48+
// Set default font.
49+
set text(font: "New Computer Modern")
50+
51+
// Style outline, headings, lists and quotes using the style of LaTeX.
52+
show: latex-lookalike.style
53+
54+
// Style links and citations.
55+
let linkblue = rgb(66, 93, 178)
56+
show link: it => {
57+
set text(fill: linkblue) if type(it.dest) == str // style external links
58+
it
59+
}
60+
show cite: set text(fill: linkblue)
61+
62+
// raw figures
63+
show figure.where(kind: raw): set figure.caption(position: top)
64+
65+
show figure: outer => {
66+
let alignment = left
67+
if outer.kind == table or outer.kind == raw {
68+
alignment = center
69+
}
70+
show figure.caption: it => align(
71+
alignment,
72+
[
73+
#strong[#it.supplement #context it.counter.display(it.numbering)#it.separator]
74+
#it.body
75+
]
76+
)
77+
outer
78+
}
79+
80+
set bibliography(title: "References")
81+
82+
// === [ Front matter ] =====================================================
83+
84+
// --- [ Front page ] -------------------------------------------------------
85+
86+
page(
87+
numbering: none,
88+
header: none,
89+
margin: (x: 1.55cm, top: 3.1cm, bottom: 3.55cm),
90+
)[
91+
#grid(
92+
columns: (5.10cm, 1fr),
93+
gutter: 3pt,
94+
grid.vline(x: 1, stroke: 0.4pt + black),
95+
// left cell (logo)
96+
logo,
97+
// right cell (title)
98+
block(height: 100%, inset: 2.1em)[
99+
#v(6.1cm)
100+
#if course-name != none { text(size: 1.2em)[ #course-name \ ] }
101+
#if course-code != none { text(size: 1.2em)[ (#course-code) ] }
102+
103+
// title
104+
#text(size: 2.1em, weight: "bold", title)
105+
106+
// subtitle
107+
#if sub-title != none { v(-1.5em) + text(size: 1.5em, weight: "bold", sub-title) }
108+
109+
// date
110+
#text(size: 1.2em, {
111+
let today = datetime.today()
112+
nth(today.display("[day padding:none]"))
113+
today.display(" [month repr:long] [year]")
114+
})
115+
116+
#v(1fr)
117+
118+
#let cells = ()
119+
#if course-name != none {
120+
cells.push([Course:])
121+
cells.push([#course-name])
122+
}
123+
#if course-part != none {
124+
cells.push([Course part:])
125+
cells.push([#course-part])
126+
}
127+
#if lab-name != none {
128+
cells.push([Lab:])
129+
cells.push([#lab-name])
130+
}
131+
#if author != none {
132+
cells.push([Author:])
133+
cells.push([#author])
134+
}
135+
#if lab-partners != none {
136+
cells.push([Lab partner(s):])
137+
cells.push([#lab-partners.join(", ", last: " and ")])
138+
}
139+
#if lab-supervisor != none {
140+
cells.push([Lab supervisor:])
141+
cells.push([#lab-supervisor])
142+
}
143+
#if lab-group != none {
144+
cells.push([Lab group:])
145+
cells.push([#lab-group])
146+
}
147+
#if lab-date != none {
148+
cells.push([Lab date:])
149+
cells.push([#lab-date])
150+
}
151+
#block(inset: 0.4em)[
152+
#grid(
153+
columns: (auto, 1fr),
154+
gutter: 10pt,
155+
..cells,
156+
)
157+
]
158+
],
159+
)
160+
]
161+
162+
pagebreak(weak: true)
163+
164+
// --- [ Table of contents ] ------------------------------------------------
165+
166+
set page(numbering: "i")
167+
counter(page).update(1)
168+
169+
outline()
170+
pagebreak(weak: true)
171+
172+
173+
// --- [ Main matter ] ------------------------------------------------------
174+
175+
set page(numbering: "1")
176+
counter(page).update(1)
177+
178+
body
179+
}
24.2 KB
Loading
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@book{2020_molecular_biology_principles_of_genome_function_craig,
2+
title={Molecular biology: principles of genome function},
3+
author={Craig, Nancy and Green, Rachel and Cohen-Fix, Orna and Greider, Carol and Storz, Gisela and Wolberger, Cynthia},
4+
year={2020},
5+
publisher={Oxford University Press}
6+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#import "@preview/efter-plugget:0.1.0"
2+
3+
#show: efter-plugget.template.with(
4+
logo: image("inc/logo.png", width: 4.3cm),
5+
title: highlight[Lab 1 -- Experiment],
6+
short-title: highlight("Lab 1"),
7+
course-name: highlight("Course Name"),
8+
course-code: highlight("AA1234"),
9+
//course-part: "",
10+
lab-name: highlight("Experiment"),
11+
author: highlight("Jane Rue"),
12+
lab-partners: (highlight("John Doe"),),
13+
//lab-supervisor: "",
14+
lab-group: highlight("Group 1"),
15+
lab-date: datetime.today().display(), // "2025-06-29"
16+
)
17+
18+
// === [ quote ] ===============================================================
19+
20+
#quote(
21+
block: true,
22+
attribution: [anonymous],
23+
)[
24+
#emph["Chemistry is all around us."]
25+
]
26+
27+
// === [ Introduction ] ========================================================
28+
29+
= Introduction
30+
31+
This lab covers #highlight([foo])
32+
33+
== Purpose
34+
35+
#lorem(10)
36+
37+
== Theory
38+
39+
#lorem(10) @2020_molecular_biology_principles_of_genome_function_craig
40+
41+
$ "H" + "O" #sym.arrow.not "H"_(2)"O" $
42+
43+
$ 2"H"_2 + 2"O" #sym.arrow 2"H"_(2)"O" $
44+
45+
== Equations used in the lab
46+
47+
#lorem(10)
48+
49+
#pagebreak(weak: true)
50+
51+
// === [ Methods ] =============================================================
52+
53+
= Methods
54+
55+
#lorem(10)
56+
57+
#pagebreak(weak: true)
58+
59+
// === [ Results ] =============================================================
60+
61+
= Results
62+
63+
#lorem(10)
64+
65+
#pagebreak(weak: true)
66+
67+
// === [ Discussion ] ==========================================================
68+
69+
= Discussion
70+
71+
#lorem(10)
72+
73+
#pagebreak(weak: true)
74+
75+
// === [ Bibliography ] ========================================================
76+
77+
#bibliography("references.bib")
78+
79+
#pagebreak(weak: true)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[package]
2+
name = "efter-plugget"
3+
version = "0.1.0"
4+
entrypoint = "src/lib.typ"
5+
authors = ["Robin Eklind"]
6+
license = "0BSD"
7+
description = "Lab report, essay and exam template for Typst."
8+
exclude = ["inc"]
9+
repository = "https://github.com/mewmew/efter-plugget"
10+
11+
[template]
12+
path = "template"
13+
entrypoint = "report.typ"
14+
thumbnail = "inc/thumbnail.png"

0 commit comments

Comments
 (0)