Refine modern template typography
This commit is contained in:
1 file changed
+34
-20
+34
-20
@@ -7,8 +7,9 @@
|
|||||||
warning: rgb("#E9724C"),
|
warning: rgb("#E9724C"),
|
||||||
error: rgb("#C5283D"),
|
error: rgb("#C5283D"),
|
||||||
|
|
||||||
text-font: ("Fira Sans", "Libertinus Serif"),
|
text-font: ("TeX Gyre Termes", "Libertinus Serif"),
|
||||||
math-font: ("Fira Math", "New Computer Modern Math"),
|
math-font: ("TeX Gyre Termes Math", "New Computer Modern Math"),
|
||||||
|
sans-font: ("Fira Sans", "Libertinus Serif"),
|
||||||
)
|
)
|
||||||
|
|
||||||
#let theme-state = state("homework-theme", default-theme)
|
#let theme-state = state("homework-theme", default-theme)
|
||||||
@@ -23,15 +24,12 @@
|
|||||||
#let doc-id = sys.inputs.at("doc-id", default: none)
|
#let doc-id = sys.inputs.at("doc-id", default: none)
|
||||||
|
|
||||||
|
|
||||||
#let task(
|
#let task(points: none, title, body) = context {
|
||||||
points: none,
|
|
||||||
title,
|
|
||||||
body,
|
|
||||||
) = context {
|
|
||||||
subtask-indent.update((0,))
|
subtask-indent.update((0,))
|
||||||
|
|
||||||
let theme = theme-state.get()
|
let theme = theme-state.get()
|
||||||
let text-color = theme.primary
|
let text-color = theme.primary
|
||||||
|
let header-font = theme.sans-font
|
||||||
let border-color = theme.primary
|
let border-color = theme.primary
|
||||||
let background-color = theme.secondary.transparentize(75%)
|
let background-color = theme.secondary.transparentize(75%)
|
||||||
let task-label = task-label-state.get()
|
let task-label = task-label-state.get()
|
||||||
@@ -59,7 +57,23 @@
|
|||||||
above: 0pt,
|
above: 0pt,
|
||||||
below: 0.05em,
|
below: 0.05em,
|
||||||
{
|
{
|
||||||
set text(fill: text-color, size: 1em)
|
{
|
||||||
|
show heading: none
|
||||||
|
|
||||||
|
heading(
|
||||||
|
level: 1,
|
||||||
|
numbering: none,
|
||||||
|
outlined: true,
|
||||||
|
bookmarked: true,
|
||||||
|
)[
|
||||||
|
#task-label #task-counter.display()
|
||||||
|
#if title != none and title != [] {
|
||||||
|
[ — #title]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
set text(fill: text-color, size: 1em, font: header-font)
|
||||||
|
|
||||||
[*#task-label #task-counter.display()*]
|
[*#task-label #task-counter.display()*]
|
||||||
|
|
||||||
@@ -90,7 +104,7 @@
|
|||||||
|
|
||||||
#let subtask(
|
#let subtask(
|
||||||
points: 0,
|
points: 0,
|
||||||
tight: false,
|
tight: true,
|
||||||
ignore-points: false,
|
ignore-points: false,
|
||||||
markers: ("(i)", "(a)"),
|
markers: ("(i)", "(a)"),
|
||||||
show-points: true,
|
show-points: true,
|
||||||
@@ -121,7 +135,10 @@
|
|||||||
numbering(marker, num)
|
numbering(marker, num)
|
||||||
},
|
},
|
||||||
if points != none and points > 0 and show-points {
|
if points != none and points > 0 and show-points {
|
||||||
metadata((type: "subtask-points", content: block(width: 7%, [#points P.])))
|
metadata((
|
||||||
|
type: "subtask-points",
|
||||||
|
content: block(width: 7%, text(font: theme-state.get().sans-font)[#points P.]),
|
||||||
|
))
|
||||||
|
|
||||||
content
|
content
|
||||||
} else { content },
|
} else { content },
|
||||||
@@ -137,10 +154,7 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#let hint(
|
#let hint(label: none, body) = context {
|
||||||
label: none,
|
|
||||||
body,
|
|
||||||
) = context {
|
|
||||||
let theme = theme-state.get()
|
let theme = theme-state.get()
|
||||||
let hint-label = if label != none and label != [] { label } else { hint-label-state.get() }
|
let hint-label = if label != none and label != [] { label } else { hint-label-state.get() }
|
||||||
|
|
||||||
@@ -158,7 +172,7 @@
|
|||||||
inset: (y: 0.75em, left: offset, right: 1em),
|
inset: (y: 0.75em, left: offset, right: 1em),
|
||||||
width: if in-subtask { 100% - 0.25em } else { 100% + offset },
|
width: if in-subtask { 100% - 0.25em } else { 100% + offset },
|
||||||
[
|
[
|
||||||
#text(size: 8pt, weight: 600, fill: theme.accent.darken(25%), hint-label) \
|
#text(size: 8pt, weight: 600, fill: theme.accent.darken(25%), text(font: theme.sans-font, hint-label)) \
|
||||||
#body
|
#body
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@@ -210,7 +224,7 @@
|
|||||||
|
|
||||||
set page(
|
set page(
|
||||||
margin: (y: 3.5cm, x: 2.5cm),
|
margin: (y: 3.5cm, x: 2.5cm),
|
||||||
numbering: (..c) => [*#c.at(0)* / #c.at(-1)],
|
numbering: (..c) => text(font: _theme.sans-font)[*#c.at(0)* / #c.at(-1)],
|
||||||
|
|
||||||
foreground: {
|
foreground: {
|
||||||
if show-datamatrix {
|
if show-datamatrix {
|
||||||
@@ -278,7 +292,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
header: {
|
header: {
|
||||||
set text(size: 8pt)
|
set text(size: 8pt, font: _theme.sans-font)
|
||||||
|
|
||||||
let _lines = (
|
let _lines = (
|
||||||
(professor, assistant).filter(x => x != none and x != []),
|
(professor, assistant).filter(x => x != none and x != []),
|
||||||
@@ -317,7 +331,7 @@
|
|||||||
|
|
||||||
set text(font: _theme.text-font)
|
set text(font: _theme.text-font)
|
||||||
show math.equation: set text(font: _theme.math-font)
|
show math.equation: set text(font: _theme.math-font)
|
||||||
show raw: set text(font: "Fira Code", size: 10pt)
|
show raw: set text(font: "Fira Code")
|
||||||
|
|
||||||
set footnote(numbering: "[1]")
|
set footnote(numbering: "[1]")
|
||||||
set footnote.entry(
|
set footnote.entry(
|
||||||
@@ -340,8 +354,8 @@
|
|||||||
it
|
it
|
||||||
} else { it }
|
} else { it }
|
||||||
|
|
||||||
show title: set text(fill: text-color, size: 1.05em)
|
show title: set text(fill: text-color, size: 1.05em, font: _theme.sans-font, weight: 800)
|
||||||
show heading: set text(fill: text-color)
|
show heading: set text(fill: text-color, font: _theme.sans-font)
|
||||||
|
|
||||||
v(0.5em)
|
v(0.5em)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user