1
0
ain48/docs/.template.typ
2026-06-01 18:33:05 +02:00

50 lines
1.7 KiB
Typst

#import "@preview/cetz:0.5.2"
#import "@preview/smartaref:0.1.0": cref
#import "@preview/libra:0.1.0": balance
#let conf(doc) = {
set page(paper: "a4", numbering: "1")
set text(
font: "Iosevka Etoile",
features: (cv47: 10),
weight: 400,
size: 12pt,
)
set par(justify: true)
set heading(numbering: "I.1")
show raw: set text(font: "Iosevka Slab", size: 1em / .8)
show title: align.with(center)
show strong: text.with(weight: 900)
set figure(numbering: "1", placement: auto)
show heading.where(level: 3): set heading(numbering: none)
show figure.caption: it => balance(box(width: 100%, {
it.supplement
[ ]
it.counter.display(it.numbering)
[ --- ]
it.body
}))
set raw(theme: "./gruvbox-white.tmTheme")
show raw.where(lang: "ain48"): set raw(syntaxes: "./ain48.sublime-syntax")
show raw.where(lang: "struct"): set raw(syntaxes: "./struct.sublime-syntax")
doc
}
#let byte_diag(..bytes, voff: 0) = {
import cetz.draw: *
for (i, b) in bytes.pos().enumerate() {
let j = 0
for (l, d) in b {
content((i * 12.5 + j + l / 2, 1 + voff), d)
j = j + l
line((i * 12.5 + j, voff), (i * 12.5 + j, 2 + voff), stroke: gray)
}
rect((i * 12.5, voff), (i * 12.5 + 12, 2 + voff))
for j in range(0, 13) {
line((i * 12.5 + j, .125 + voff), (i * 12.5 + j, -.125 + voff))
line((i * 12.5 + j, 2.125 + voff), (i * 12.5 + j, 1.875 + voff))
}
content((i * 12.5, voff + 2.25), anchor: "south-west")[11]
content((i * 12.5 + 12, voff + 2.25), anchor: "south-east")[0]
}
}