typst-templates/libs.typ

50 lines
1.2 KiB
Plaintext
Raw Normal View History

2023-11-29 19:41:06 -05:00
#import "/templates/main.typ": settings, font
2023-11-29 19:17:12 -05:00
#import "@preview/metro:0.1.0": units, prefixes, num
2023-12-07 20:44:58 -05:00
#import units: *
#import prefixes: *
2024-01-10 21:27:29 -05:00
#import "@preview/tablex:0.0.6": tablex, rowspanx, colspanx
2023-11-09 20:58:39 -05:00
#let tablef = tablex.with(
align: center + horizon,
auto-vlines: false
)
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
}