-
Notifications
You must be signed in to change notification settings - Fork 14
/
common.typ
55 lines (47 loc) · 1.96 KB
/
common.typ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#import "@preview/cetz:0.2.2"
#import "@preview/tablex:0.0.8": tablex, cellx, colspanx, hlinex
#let monotext(..args) = text(font: "Anonymous Pro", fallback: false, ..args)
#let awesome-brands(..args) = text(font: "Font Awesome 6 Brands", fallback: false, ..args)
#let awesome(..args) = text(font: "Font Awesome 6 Free Solid", fallback: false, ..args)
#let color-box(icon: none, title: none, fgcolor: black, bgcolor: white, title-color: white, content) = [
#let radius = 5pt
#box(fill: bgcolor, stroke: 2pt + fgcolor, radius: radius)[
#block(breakable: false, width: 100%, fill: fgcolor, inset: (x: 16pt, y: 8pt), below: 0pt, radius: (top-left: radius, top-right: radius))[
#awesome(fill: title-color, icon)
#text(fill: title-color, weight: "bold")[#title]
]
#block(breakable: false, width: 100%, inset: 16pt)[#content]
]
]
#let caveat(content) = [
#color-box(content, icon: "\u{f05a}", title: "Caveat", fgcolor: rgb("#DC143C"), bgcolor: rgb("#FFE4E1"))
]
#let speculation(content) = [
#color-box(content, icon: "\u{f12e}", title: "Speculation", fgcolor: rgb("#467BA9"), bgcolor: rgb("#F0FFFF"))
]
#let warning(content) = [
#color-box(content, icon: "\u{f06a}", title: "Warning", fgcolor: rgb("#FFD700"), bgcolor: rgb("#FFFACD"), title-color: rgb("#505050"))
]
#let bit(content) = monotext(content)
#let bin(content) = monotext("0b" + content)
#let hex(content) = monotext("0x" + content)
#let hex-range(start, end) = monotext({"0x" + start + "-0x" + end})
#let unimpl-bit() = cellx(fill: rgb("#D3D3D3ff"))[]
#let reg-table(..args) = monotext(9pt)[
#tablex(
columns: (1fr, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr),
inset: 5pt,
align: center + horizon,
..args
)
]
#let reg-figure(caption: none, content) = [
#v(1cm)
#figure(
content,
caption: caption,
kind: "register",
supplement: [Register],
numbering: (..nums) => counter(heading).display((..hnums) => numbering("1", hnums.pos().at(1))) + "." + numbering("1", ..nums)
)
]