typst/tests/typ/layout/pad.typ
2021-11-16 10:41:30 +01:00

30 lines
556 B
XML

// 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 #pad(left: 10pt)[A] there
---
// Pad can grow.
#pad(left: 10pt, right: 10pt)[PL #h(1fr) 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%)[]