-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.typ
More file actions
50 lines (50 loc) · 962 Bytes
/
utils.typ
File metadata and controls
50 lines (50 loc) · 962 Bytes
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
#let question-id=counter("question")
#show ref: it=>{
let target=query(it.target).first()
if type(target)!=content or target.func()!=metadata or target.value!="question" {
it
} else {
let sup=it.supplement
if sup==auto {
sup=[Q]
}
let num=numbering("1",..question-id.at(locate(it.target)))
link(it.target)[#sup#num]
}
}
#let question(
tag:"",
category:black,//red,blue,black
question:[],
answer:[],
)={
question-id.step()
context text(fill:category,weight:"semibold")[
【Q#question-id.display()】
#label(tag)
]
question
parbreak()
text(fill:category,weight:"bold")[【解】]
answer
}
#let ref(id)=context link(
label(id),
text(font:"Noto Serif")[【Q#question-id.at(query(label(id)).first().location()).first()】]
)
#let comment(body)={
set text(
font:"Zhuque Fangsong (technical preview)",
)
set par(
first-line-indent:(
amount:2em,
all:true
),
)
body
}
#let subst(body)={
set text(fill:purple)
body
}