summaryrefslogtreecommitdiff
path: root/tests/typ/layout/pad.typ
blob: 3729761a843fdc2eb5a3e3ad9186593a05389f52 (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
// Test the `pad` function.

---
// Use for indentation.
#pad(left: 10pt, [Indented!])

// All sides together.
#rect(fill: conifer,
  pad(10pt, right: 20pt,
    rect(width: 20pt, height: 20pt, fill: rgb("eb5278"))
  )
)

Hi #box(pad(left: 10pt)[]) there

---
#let pad(body) = pad(left: 10pt, right: 10pt, body)

// Pad inherits expansion behaviour from stack ....
#pad[PL #align(right)[PR]]

// ... block ...
#block(pad[PL #align(right)[PR]])

// ... and box.
#box(pad[PL #align(right)[PR]])

---
// Test that the pad node doesn't consume the whole region.
#page(height: 6cm)
#align(left)[Before]
#pad(10pt, image("../../res/tiger.jpg"))
#align(right)[After]

---
// Test that padding adding up to 100% does not panic.
#pad(50%)[]