Skip to content

Instantly share code, notes, and snippets.

@jakobrs
Created September 14, 2023 08:45
Show Gist options
  • Save jakobrs/c93e3671296abaef7c288a4a29995c46 to your computer and use it in GitHub Desktop.
Save jakobrs/c93e3671296abaef7c288a4a29995c46 to your computer and use it in GitHub Desktop.
#let template(
title: none,
font: "New Computer Modern",
authors: (),
date: none,
show-outline: false,
body
) = {
show link: text.with(blue)
set text(12pt, lang: "nb")
set text(font: font)
// set text(font: "Comic Neue")
set page(numbering: "1/1")
show heading: it => {
if it.level > 2 {
parbreak()
text(11pt, weight: "regular", it.body)
} else {
it
}
}
set par(justify: true)
align(center, text(1.2em, strong(title)))
if authors.len() > 0 {
align(center, stack(dir: ltr, spacing: 1.5cm, ..authors))
}
if date == auto {
let norwegian_month_name = (
none,
"januar",
"februar",
"mars",
"april",
"mai",
"juni",
"juli",
"august",
"septemper",
"oktober",
"november",
"desember",
)
let norwegian_datetime_display(dt) = [#dt.day(). #norwegian_month_name.at(dt.month()) #dt.year()]
// align(center, datetime.today().display("[day padding:none]. [month repr:long] [year]"))
align(center, norwegian_datetime_display(datetime.today()))
} else if date != none {
align(center, date)
}
if show-outline {
v(0.5cm)
block(inset: (x: 0.5cm), outline(indent: 1em))
v(1cm)
}
// #show math.equation.where(block: true): it => block(inset: (left: 0.85cm), align(right, it))
body
}
#let tall = v(1.5em)
#let implies = box(inset: (x: 10pt), scale(x: 150%, sym.arrow.r.double.long))
// #let eop = h(1fr) + emoji.cake
#let eop = h(1fr) + sym.square
#let eop-prev = style(s => place(dy: -measure(eop, s).height, eop))
#let accent = green
#let lemma(name, code, body) = block(
inset: (x: 8pt, y: 6pt),
width: 100%,
fill: accent.lighten(97%),
stroke: (left: 1pt + accent),
[
#box(
outset: (x: 2pt, bottom: 7pt),
// width: 100%,
stroke: (bottom: 1pt + accent),
[*#name* (#code)]
)
#body
]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment