typst-templates/main.typ

92 lines
1.8 KiB
Plaintext
Raw Normal View History

2023-04-18 19:59:45 -04:00
// main template that everything inherits from
#let script-size = 12pt
#let footnote-size = 10pt
#let small-size = 9pt
#let normal-size = 12pt
#let large-size = 12pt
#let me = "dogeystamp"
#let font = "Roboto"
2023-04-29 18:51:42 -04:00
#let heading_font = "Roboto"
2023-04-18 19:59:45 -04:00
#let math_font = "Fira Math"
#let mono_font = "JetBrains Mono"
#let gen_title(
title: none,
) = {
// Set document metadata.
align(center, {
2023-04-29 18:51:42 -04:00
text(size: large-size, weight: "black", title, font: heading_font)
2023-04-18 19:59:45 -04:00
})
}
#let gen_authors(
authors: none,
) = {
if authors == none {
authors = (
(
name: me,
),
)
}
let names = authors.map(author => author.name)
let author-string = if authors.len() == 2 {
names.join(" and ")
} else {
names.join(", ", last: ", and ")
}
align(center, {
text(size: footnote-size, author-string)
v(25pt, weak: true)
})
}
// this template sets up the document
// but does not do things like title, authors, etc.
#let doc_template(
paper-size: "a4",
// Content to wrap
body,
) = {
2023-04-29 18:51:42 -04:00
set text(size: normal-size, font: font, weight: "light")
2023-05-13 12:18:51 -04:00
show link: body => text(fill: rgb("#777777"), weight: "bold", body)
2023-04-29 18:51:42 -04:00
show math.equation: eq => text(font: math_font, eq)
2023-05-27 11:51:50 -04:00
set table(inset: 10pt)
2023-04-29 18:51:42 -04:00
show heading: set text(font: heading_font, weight: "black")
show raw.where(block: true): txt => pad(
left: 0.5em,
block(
radius: 0.5em,
stroke: luma(230),
fill: luma(245),
pad(
left: 1em,
right: 1em,
top: 1em,
bottom: 1em,
txt
)
)
)
2023-04-18 19:59:45 -04:00
set page(
paper: paper-size,
)
set heading(numbering: "1.")
2023-05-20 10:11:34 -04:00
set list(indent: 5pt, body-indent: 5pt)
set enum(indent: 5pt, body-indent: 5pt)
2023-04-18 19:59:45 -04:00
// Configure paragraph properties.
2023-04-29 18:51:42 -04:00
set par(justify: true)
2023-04-18 19:59:45 -04:00
// Display the article's contents.
v(29pt, weak: true)
body
}