From 78f96f844bc54c5385c1efda0b5faad3c49fa79b Mon Sep 17 00:00:00 2001 From: Laurenz Date: Mon, 10 Jul 2023 18:16:59 +0200 Subject: Basic floating placement --- tests/ref/layout/place-float-auto.png | Bin 0 -> 3331 bytes tests/ref/layout/place-float-figure.png | Bin 0 -> 132015 bytes tests/typ/layout/place-float-auto.typ | 19 +++++++++++++++++++ tests/typ/layout/place-float-figure.typ | 21 +++++++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 tests/ref/layout/place-float-auto.png create mode 100644 tests/ref/layout/place-float-figure.png create mode 100644 tests/typ/layout/place-float-auto.typ create mode 100644 tests/typ/layout/place-float-figure.typ (limited to 'tests') diff --git a/tests/ref/layout/place-float-auto.png b/tests/ref/layout/place-float-auto.png new file mode 100644 index 00000000..f2e4ee92 Binary files /dev/null and b/tests/ref/layout/place-float-auto.png differ diff --git a/tests/ref/layout/place-float-figure.png b/tests/ref/layout/place-float-figure.png new file mode 100644 index 00000000..2cecb5ff Binary files /dev/null and b/tests/ref/layout/place-float-figure.png differ diff --git a/tests/typ/layout/place-float-auto.typ b/tests/typ/layout/place-float-auto.typ new file mode 100644 index 00000000..799c9fc7 --- /dev/null +++ b/tests/typ/layout/place-float-auto.typ @@ -0,0 +1,19 @@ +// Test floating placement. + +--- +#set page(height: 140pt) +#set place(clearance: 5pt) +#lorem(6) +#place(auto, float: true, rect[A]) +#place(auto, float: true, rect[B]) +#place(auto, float: true, rect[C]) +#place(auto, float: true, rect[D]) + +--- +// Error: 2-20 automatic positioning is only available for floating placement +// Hint: 2-20 you can enable floating placement with `place(float: true, ..)` +#place(auto)[Hello] + +--- +// Error: 2-45 floating placement must be `auto`, `top`, or `bottom` +#place(center + horizon, float: true)[Hello] diff --git a/tests/typ/layout/place-float-figure.typ b/tests/typ/layout/place-float-figure.typ new file mode 100644 index 00000000..7256a4eb --- /dev/null +++ b/tests/typ/layout/place-float-figure.typ @@ -0,0 +1,21 @@ +// Test floating figures. + +--- +#set page(height: 250pt, width: 150pt) + += Introduction +#lorem(10) #footnote[Lots of Latin] + +#figure( + placement: bottom, + caption: [A glacier #footnote[Lots of Ice]], + image("/files/glacier.jpg", width: 80%), +) + +#lorem(40) + +#figure( + placement: top, + caption: [An important], + image("/files/diagram.svg", width: 80%), +) -- cgit v1.2.3