summaryrefslogtreecommitdiff
path: root/tests/typ/meta/query-figure.typ
blob: 0540d65a6ab05e7be9158094b0632ea76f75f685 (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
// Test a list of figures.

---
#set page(
  paper: "a7",
  numbering: "1 / 1",
  margin: (bottom: 1cm, rest: 0.5cm),
)

#set figure(numbering: "I")
#show figure: set image(width: 80%)

= List of Figures
#locate(it => {
  let elements = query(selector(figure).after(it), it)
  for it in elements [
    Figure
    #numbering(it.numbering,
      ..counter(figure).at(it.location())):
    #it.caption.body
    #box(width: 1fr, repeat[.])
    #counter(page).at(it.location()).first() \
  ]
})

#figure(
  image("/files/glacier.jpg"),
  caption: [Glacier melting],
)

#figure(
  rect[Just some stand-in text],
  kind: image,
  supplement: "Figure",
  caption: [Stand-in text],
)

#figure(
  image("/files/tiger.jpg"),
  caption: [Tiger world],
)