2023-11-29 19:41:06 -05:00
|
|
|
#import "/templates/main.typ": settings, font
|
|
|
|
|
2024-03-30 15:01:38 -04:00
|
|
|
#import "@preview/unify:0.5.0": num, qty, unit
|
|
|
|
// percentage error quantity
|
|
|
|
// (because both unify and metro currently can't parse percentages)
|
|
|
|
#let pq(nb, un, pe) = {
|
|
|
|
return $(num(nb) plus.minus qty(pe, "%")) unit(un)$
|
|
|
|
}
|
|
|
|
|
2024-03-30 15:59:04 -04:00
|
|
|
// chemistry
|
2024-11-10 12:38:42 -05:00
|
|
|
#import "@preview/whalogen:0.2.0": ce
|
2024-03-30 15:01:38 -04:00
|
|
|
|
2024-03-22 18:47:53 -04:00
|
|
|
// this used to be an alias to styled tablex
|
|
|
|
#let tablef = table.with(
|
2023-11-09 20:58:39 -05:00
|
|
|
align: center + horizon,
|
2024-03-22 18:47:53 -04:00
|
|
|
stroke: (x: none, y: 0.1em),
|
|
|
|
inset: (y: 0.75em)
|
2023-11-09 20:58:39 -05:00
|
|
|
)
|
2023-11-29 19:41:06 -05:00
|
|
|
|
|
|
|
#let appendices(body) = {
|
|
|
|
// https://github.com/typst/typst/issues/806
|
|
|
|
|
|
|
|
pagebreak()
|
|
|
|
counter(heading).update(0)
|
|
|
|
counter("appendices").update(1)
|
|
|
|
|
|
|
|
text(size: 18pt, weight: "black", "Appendices", font: font )
|
|
|
|
v(8pt)
|
|
|
|
line(length: 100%, stroke: 1pt + rgb("#555555"))
|
|
|
|
v(5%, weak: true)
|
|
|
|
|
|
|
|
set heading(numbering: (..nums) => {
|
|
|
|
let vals = nums.pos()
|
|
|
|
let value = "ABCDEFGHIJ".at(vals.at(0) - 1)
|
|
|
|
if vals.len() == 1 {
|
|
|
|
if settings.lang == "fr" {
|
|
|
|
return "Appendice " + value + ":"
|
|
|
|
} else if settings.lang == "en" {
|
|
|
|
return "Appendix " + value + ":"
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return value + "." + nums.pos().slice(1).map(str).join(".")
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
set heading(supplement: "Appendice") if settings.lang == "fr"
|
|
|
|
set heading(supplement: "Appendix") if settings.lang == "en"
|
|
|
|
|
|
|
|
body
|
|
|
|
}
|
2024-01-17 19:20:37 -05:00
|
|
|
|
|
|
|
#let numbered_eq = (body) => {
|
|
|
|
set math.equation(numbering: "(1)")
|
|
|
|
body
|
|
|
|
}
|
2024-09-20 20:44:26 -04:00
|
|
|
|
|
|
|
// theorems, definitions, example environments
|
2024-11-08 15:26:46 -05:00
|
|
|
#import "@preview/ctheorems:1.1.3": *
|
2024-09-20 20:44:26 -04:00
|
|
|
// use `#show: thmrules` at the beginning of documents
|
|
|
|
|
|
|
|
#let theorem = thmbox("theorem", "Theorem", fill: rgb("#eeffee"))
|
|
|
|
#let corollary = thmplain(
|
|
|
|
"corollary",
|
|
|
|
"Corollary",
|
|
|
|
base: "theorem",
|
|
|
|
titlefmt: strong
|
|
|
|
)
|
|
|
|
#let definition = thmbox("definition", "Definition", inset: (x: 1.2em, top: 1em, bottom: 1em), stroke: 1pt + black)
|
|
|
|
|
|
|
|
#let example = thmbox("example", "Example").with(numbering: none)
|
|
|
|
#let proof = thmproof("proof", "Proof")
|