summaryrefslogtreecommitdiff
path: root/tests/suite/model/ref.typ
blob: c8ff8067468fd0b60e8853c562b05a26c80a711a (plain) (blame)
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
56
57
58
59
60
61
62
63
64
65
66
67
// Test references.

--- ref-basic ---
#set heading(numbering: "1.")

= Introduction <intro>
See @setup.

== Setup <setup>
As seen in @intro, we proceed.

--- ref-label-missing ---
// Warning: 1-5 label `<foo>` does not exist in the document
@foo

--- ref-label-complex-missing ---
#set page(width: auto)

// Warning: 2-28 label `label("is;/"bad%//#")` does not exist in the document
#ref(label("is;\"bad%//#"))

--- ref-label-duplicate ---
= First <foo>
= Second <foo>

// Error: 1-5 label `<foo>` occurs multiple times in the document
@foo

--- ref-supplements ---
#set heading(numbering: "1.", supplement: [Chapter])
#set math.equation(numbering: "(1)", supplement: [Eq.])

= Intro
#figure(
  image("/assets/images/cylinder.svg", height: 1cm),
  caption: [A cylinder.],
  supplement: "Fig",
) <fig1>

#figure(
  image("/assets/images/tiger.jpg", height: 1cm),
  caption: [A tiger.],
  supplement: "Tig",
) <fig2>

$ A = 1 $ <eq1>

#set math.equation(supplement: none)
$ A = 1 $ <eq2>

@fig1, @fig2, @eq1, (@eq2)

#set ref(supplement: none)
@fig1, @fig2, @eq1, @eq2

--- ref-ambiguous ---
// Test ambiguous reference.
= Introduction <arrgh>

// Error: 1-7 label occurs in the document and its bibliography
@arrgh
#bibliography("/assets/bib/works.bib")

--- issue-4536-non-whitespace-before-ref ---
// Test reference with non-whitespace before it.
#figure[] <1>
#test([(#ref(<1>))], [(@1)])