typst/tests/typ/layout/pad.typ
Laurenz 1ee1d078e2 Fatal errors
- Makes errors fatal, so that a phase is only reached when all previous phases were error-free
- Parsing still recovers and can produce multiple errors
- Evaluation fails fast and can thus produce only a single error (except for parse errors due to an import)
- The single error that could occur during execution is removed for now
- Removes Value::Error variant
2021-07-30 18:49:19 +02:00

35 lines
660 B
Typst

// 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]