From e25389a85e2c4bb7bab5f5d68ab148395704960d Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 25 Sep 2024 10:26:41 +0200 Subject: New flow layout, with multi-column floats (#5017) --- tests/ref/block-fr-height-auto-width.png | Bin 0 -> 1069 bytes tests/ref/block-fr-height-first-child.png | Bin 0 -> 149 bytes tests/ref/block-fr-height-multiple.png | Bin 0 -> 152 bytes tests/ref/block-fr-height.png | Bin 0 -> 167 bytes tests/ref/block-sticky-alone.png | Bin 0 -> 166 bytes tests/ref/block-sticky-colbreak.png | Bin 0 -> 283 bytes tests/ref/block-sticky-many.png | Bin 0 -> 570 bytes tests/ref/block-sticky.png | Bin 0 -> 469 bytes tests/ref/box-fr-width.png | Bin 0 -> 464 bytes tests/ref/box-width-fr.png | Bin 464 -> 0 bytes tests/ref/colbreak-weak.png | Bin 0 -> 197 bytes tests/ref/figure-placement.png | Bin 0 -> 2302 bytes tests/ref/footnote-block-at-end.png | Bin 0 -> 620 bytes tests/ref/footnote-break-across-pages-block.png | Bin 0 -> 1296 bytes tests/ref/footnote-break-across-pages-float.png | Bin 0 -> 1399 bytes tests/ref/footnote-break-across-pages-nested.png | Bin 0 -> 1320 bytes tests/ref/footnote-break-across-pages.png | Bin 5424 -> 5425 bytes tests/ref/footnote-float-priority.png | Bin 0 -> 1393 bytes tests/ref/footnote-in-list.png | Bin 0 -> 2513 bytes tests/ref/footnote-in-place.png | Bin 0 -> 1127 bytes tests/ref/footnote-in-table.png | Bin 12311 -> 12423 bytes tests/ref/footnote-multiple-in-one-line.png | Bin 0 -> 693 bytes tests/ref/footnote-nested-same-frame.png | Bin 743 -> 0 bytes tests/ref/footnote-nested.png | Bin 2469 -> 2581 bytes tests/ref/issue-2213-align-fr.png | Bin 0 -> 291 bytes tests/ref/issue-3481-cite-location.png | Bin 602 -> 504 bytes tests/ref/issue-3641-float-loop.png | Bin 704 -> 678 bytes tests/ref/issue-3866-block-migration.png | Bin 0 -> 777 bytes tests/ref/issue-footnotes-skip-first-page.png | Bin 571 -> 512 bytes tests/ref/issue-multiple-footnote-in-one-line.png | Bin 704 -> 0 bytes tests/ref/place-float-block-backlog.png | Bin 0 -> 826 bytes tests/ref/place-float-clearance-empty.png | Bin 0 -> 1235 bytes tests/ref/place-float-column-align-auto.png | Bin 0 -> 932 bytes tests/ref/place-float-column-queued.png | Bin 0 -> 638 bytes tests/ref/place-float-counter.png | Bin 0 -> 674 bytes tests/ref/place-float-delta.png | Bin 0 -> 317 bytes tests/ref/place-float-flow-size-alone.png | Bin 0 -> 125 bytes tests/ref/place-float-flow-size.png | Bin 0 -> 347 bytes tests/ref/place-float-fr.png | Bin 0 -> 507 bytes tests/ref/place-float-in-column-align-auto.png | Bin 843 -> 0 bytes tests/ref/place-float-in-column-queued.png | Bin 638 -> 0 bytes tests/ref/place-float-rel-sizing.png | Bin 0 -> 335 bytes .../ref/place-float-threecolumn-block-backlog.png | Bin 0 -> 707 bytes tests/ref/place-float-threecolumn.png | Bin 0 -> 1286 bytes tests/ref/place-float-twocolumn-align-auto.png | Bin 0 -> 719 bytes tests/ref/place-float-twocolumn-fits-not.png | Bin 0 -> 1043 bytes tests/ref/place-float-twocolumn-fits.png | Bin 0 -> 1001 bytes tests/ref/place-float-twocolumn-queued.png | Bin 0 -> 862 bytes tests/ref/place-float-twocolumn.png | Bin 0 -> 1259 bytes tests/ref/query-running-header.png | Bin 9017 -> 9231 bytes tests/skip.txt | 0 tests/src/collect.rs | 13 + tests/src/tests.rs | 3 + tests/suite/introspection/query.typ | 4 +- tests/suite/layout/align.typ | 8 + tests/suite/layout/columns.typ | 7 + tests/suite/layout/container.typ | 61 ++++- tests/suite/layout/flow/flow.typ | 13 +- tests/suite/layout/flow/footnote.typ | 277 ++++++++++++++++++++ tests/suite/layout/flow/place-float.typ | 83 ------ tests/suite/layout/flow/place-flush.typ | 29 --- tests/suite/layout/flow/place.typ | 290 +++++++++++++++++++++ tests/suite/model/cite.typ | 3 +- tests/suite/model/figure.typ | 36 +++ tests/suite/model/footnote.typ | 195 -------------- 65 files changed, 707 insertions(+), 315 deletions(-) create mode 100644 tests/ref/block-fr-height-auto-width.png create mode 100644 tests/ref/block-fr-height-first-child.png create mode 100644 tests/ref/block-fr-height-multiple.png create mode 100644 tests/ref/block-fr-height.png create mode 100644 tests/ref/block-sticky-alone.png create mode 100644 tests/ref/block-sticky-colbreak.png create mode 100644 tests/ref/block-sticky-many.png create mode 100644 tests/ref/block-sticky.png create mode 100644 tests/ref/box-fr-width.png delete mode 100644 tests/ref/box-width-fr.png create mode 100644 tests/ref/colbreak-weak.png create mode 100644 tests/ref/figure-placement.png create mode 100644 tests/ref/footnote-block-at-end.png create mode 100644 tests/ref/footnote-break-across-pages-block.png create mode 100644 tests/ref/footnote-break-across-pages-float.png create mode 100644 tests/ref/footnote-break-across-pages-nested.png create mode 100644 tests/ref/footnote-float-priority.png create mode 100644 tests/ref/footnote-in-list.png create mode 100644 tests/ref/footnote-in-place.png create mode 100644 tests/ref/footnote-multiple-in-one-line.png delete mode 100644 tests/ref/footnote-nested-same-frame.png create mode 100644 tests/ref/issue-2213-align-fr.png create mode 100644 tests/ref/issue-3866-block-migration.png delete mode 100644 tests/ref/issue-multiple-footnote-in-one-line.png create mode 100644 tests/ref/place-float-block-backlog.png create mode 100644 tests/ref/place-float-clearance-empty.png create mode 100644 tests/ref/place-float-column-align-auto.png create mode 100644 tests/ref/place-float-column-queued.png create mode 100644 tests/ref/place-float-counter.png create mode 100644 tests/ref/place-float-delta.png create mode 100644 tests/ref/place-float-flow-size-alone.png create mode 100644 tests/ref/place-float-flow-size.png create mode 100644 tests/ref/place-float-fr.png delete mode 100644 tests/ref/place-float-in-column-align-auto.png delete mode 100644 tests/ref/place-float-in-column-queued.png create mode 100644 tests/ref/place-float-rel-sizing.png create mode 100644 tests/ref/place-float-threecolumn-block-backlog.png create mode 100644 tests/ref/place-float-threecolumn.png create mode 100644 tests/ref/place-float-twocolumn-align-auto.png create mode 100644 tests/ref/place-float-twocolumn-fits-not.png create mode 100644 tests/ref/place-float-twocolumn-fits.png create mode 100644 tests/ref/place-float-twocolumn-queued.png create mode 100644 tests/ref/place-float-twocolumn.png create mode 100644 tests/skip.txt create mode 100644 tests/suite/layout/flow/footnote.typ delete mode 100644 tests/suite/layout/flow/place-float.typ delete mode 100644 tests/suite/layout/flow/place-flush.typ delete mode 100644 tests/suite/model/footnote.typ (limited to 'tests') diff --git a/tests/ref/block-fr-height-auto-width.png b/tests/ref/block-fr-height-auto-width.png new file mode 100644 index 00000000..21cd3f51 Binary files /dev/null and b/tests/ref/block-fr-height-auto-width.png differ diff --git a/tests/ref/block-fr-height-first-child.png b/tests/ref/block-fr-height-first-child.png new file mode 100644 index 00000000..0a179576 Binary files /dev/null and b/tests/ref/block-fr-height-first-child.png differ diff --git a/tests/ref/block-fr-height-multiple.png b/tests/ref/block-fr-height-multiple.png new file mode 100644 index 00000000..f502343c Binary files /dev/null and b/tests/ref/block-fr-height-multiple.png differ diff --git a/tests/ref/block-fr-height.png b/tests/ref/block-fr-height.png new file mode 100644 index 00000000..657cb43a Binary files /dev/null and b/tests/ref/block-fr-height.png differ diff --git a/tests/ref/block-sticky-alone.png b/tests/ref/block-sticky-alone.png new file mode 100644 index 00000000..74e30b3b Binary files /dev/null and b/tests/ref/block-sticky-alone.png differ diff --git a/tests/ref/block-sticky-colbreak.png b/tests/ref/block-sticky-colbreak.png new file mode 100644 index 00000000..a56b25d9 Binary files /dev/null and b/tests/ref/block-sticky-colbreak.png differ diff --git a/tests/ref/block-sticky-many.png b/tests/ref/block-sticky-many.png new file mode 100644 index 00000000..cdcf291d Binary files /dev/null and b/tests/ref/block-sticky-many.png differ diff --git a/tests/ref/block-sticky.png b/tests/ref/block-sticky.png new file mode 100644 index 00000000..4f236c89 Binary files /dev/null and b/tests/ref/block-sticky.png differ diff --git a/tests/ref/box-fr-width.png b/tests/ref/box-fr-width.png new file mode 100644 index 00000000..30d48163 Binary files /dev/null and b/tests/ref/box-fr-width.png differ diff --git a/tests/ref/box-width-fr.png b/tests/ref/box-width-fr.png deleted file mode 100644 index 30d48163..00000000 Binary files a/tests/ref/box-width-fr.png and /dev/null differ diff --git a/tests/ref/colbreak-weak.png b/tests/ref/colbreak-weak.png new file mode 100644 index 00000000..e2ce5b96 Binary files /dev/null and b/tests/ref/colbreak-weak.png differ diff --git a/tests/ref/figure-placement.png b/tests/ref/figure-placement.png new file mode 100644 index 00000000..c9ebd2ba Binary files /dev/null and b/tests/ref/figure-placement.png differ diff --git a/tests/ref/footnote-block-at-end.png b/tests/ref/footnote-block-at-end.png new file mode 100644 index 00000000..86416c48 Binary files /dev/null and b/tests/ref/footnote-block-at-end.png differ diff --git a/tests/ref/footnote-break-across-pages-block.png b/tests/ref/footnote-break-across-pages-block.png new file mode 100644 index 00000000..ae27b41a Binary files /dev/null and b/tests/ref/footnote-break-across-pages-block.png differ diff --git a/tests/ref/footnote-break-across-pages-float.png b/tests/ref/footnote-break-across-pages-float.png new file mode 100644 index 00000000..eb5f6f5d Binary files /dev/null and b/tests/ref/footnote-break-across-pages-float.png differ diff --git a/tests/ref/footnote-break-across-pages-nested.png b/tests/ref/footnote-break-across-pages-nested.png new file mode 100644 index 00000000..49061844 Binary files /dev/null and b/tests/ref/footnote-break-across-pages-nested.png differ diff --git a/tests/ref/footnote-break-across-pages.png b/tests/ref/footnote-break-across-pages.png index 73a483b2..8e5deabc 100644 Binary files a/tests/ref/footnote-break-across-pages.png and b/tests/ref/footnote-break-across-pages.png differ diff --git a/tests/ref/footnote-float-priority.png b/tests/ref/footnote-float-priority.png new file mode 100644 index 00000000..26797331 Binary files /dev/null and b/tests/ref/footnote-float-priority.png differ diff --git a/tests/ref/footnote-in-list.png b/tests/ref/footnote-in-list.png new file mode 100644 index 00000000..504c3578 Binary files /dev/null and b/tests/ref/footnote-in-list.png differ diff --git a/tests/ref/footnote-in-place.png b/tests/ref/footnote-in-place.png new file mode 100644 index 00000000..d41316db Binary files /dev/null and b/tests/ref/footnote-in-place.png differ diff --git a/tests/ref/footnote-in-table.png b/tests/ref/footnote-in-table.png index 3f8f50ca..7aa2bbf4 100644 Binary files a/tests/ref/footnote-in-table.png and b/tests/ref/footnote-in-table.png differ diff --git a/tests/ref/footnote-multiple-in-one-line.png b/tests/ref/footnote-multiple-in-one-line.png new file mode 100644 index 00000000..6f60b609 Binary files /dev/null and b/tests/ref/footnote-multiple-in-one-line.png differ diff --git a/tests/ref/footnote-nested-same-frame.png b/tests/ref/footnote-nested-same-frame.png deleted file mode 100644 index b22276d5..00000000 Binary files a/tests/ref/footnote-nested-same-frame.png and /dev/null differ diff --git a/tests/ref/footnote-nested.png b/tests/ref/footnote-nested.png index fecf2e8d..50cc2637 100644 Binary files a/tests/ref/footnote-nested.png and b/tests/ref/footnote-nested.png differ diff --git a/tests/ref/issue-2213-align-fr.png b/tests/ref/issue-2213-align-fr.png new file mode 100644 index 00000000..66f56d76 Binary files /dev/null and b/tests/ref/issue-2213-align-fr.png differ diff --git a/tests/ref/issue-3481-cite-location.png b/tests/ref/issue-3481-cite-location.png index cfc13db5..63388bd2 100644 Binary files a/tests/ref/issue-3481-cite-location.png and b/tests/ref/issue-3481-cite-location.png differ diff --git a/tests/ref/issue-3641-float-loop.png b/tests/ref/issue-3641-float-loop.png index c898d54e..c294c1e4 100644 Binary files a/tests/ref/issue-3641-float-loop.png and b/tests/ref/issue-3641-float-loop.png differ diff --git a/tests/ref/issue-3866-block-migration.png b/tests/ref/issue-3866-block-migration.png new file mode 100644 index 00000000..6e48f486 Binary files /dev/null and b/tests/ref/issue-3866-block-migration.png differ diff --git a/tests/ref/issue-footnotes-skip-first-page.png b/tests/ref/issue-footnotes-skip-first-page.png index d24387e3..fd973af7 100644 Binary files a/tests/ref/issue-footnotes-skip-first-page.png and b/tests/ref/issue-footnotes-skip-first-page.png differ diff --git a/tests/ref/issue-multiple-footnote-in-one-line.png b/tests/ref/issue-multiple-footnote-in-one-line.png deleted file mode 100644 index cdb83af2..00000000 Binary files a/tests/ref/issue-multiple-footnote-in-one-line.png and /dev/null differ diff --git a/tests/ref/place-float-block-backlog.png b/tests/ref/place-float-block-backlog.png new file mode 100644 index 00000000..c212717e Binary files /dev/null and b/tests/ref/place-float-block-backlog.png differ diff --git a/tests/ref/place-float-clearance-empty.png b/tests/ref/place-float-clearance-empty.png new file mode 100644 index 00000000..f170df34 Binary files /dev/null and b/tests/ref/place-float-clearance-empty.png differ diff --git a/tests/ref/place-float-column-align-auto.png b/tests/ref/place-float-column-align-auto.png new file mode 100644 index 00000000..a1dc9203 Binary files /dev/null and b/tests/ref/place-float-column-align-auto.png differ diff --git a/tests/ref/place-float-column-queued.png b/tests/ref/place-float-column-queued.png new file mode 100644 index 00000000..3eeb13dd Binary files /dev/null and b/tests/ref/place-float-column-queued.png differ diff --git a/tests/ref/place-float-counter.png b/tests/ref/place-float-counter.png new file mode 100644 index 00000000..aa669521 Binary files /dev/null and b/tests/ref/place-float-counter.png differ diff --git a/tests/ref/place-float-delta.png b/tests/ref/place-float-delta.png new file mode 100644 index 00000000..578d9301 Binary files /dev/null and b/tests/ref/place-float-delta.png differ diff --git a/tests/ref/place-float-flow-size-alone.png b/tests/ref/place-float-flow-size-alone.png new file mode 100644 index 00000000..e1b6adac Binary files /dev/null and b/tests/ref/place-float-flow-size-alone.png differ diff --git a/tests/ref/place-float-flow-size.png b/tests/ref/place-float-flow-size.png new file mode 100644 index 00000000..60bbc7cd Binary files /dev/null and b/tests/ref/place-float-flow-size.png differ diff --git a/tests/ref/place-float-fr.png b/tests/ref/place-float-fr.png new file mode 100644 index 00000000..83d31054 Binary files /dev/null and b/tests/ref/place-float-fr.png differ diff --git a/tests/ref/place-float-in-column-align-auto.png b/tests/ref/place-float-in-column-align-auto.png deleted file mode 100644 index 58ba9741..00000000 Binary files a/tests/ref/place-float-in-column-align-auto.png and /dev/null differ diff --git a/tests/ref/place-float-in-column-queued.png b/tests/ref/place-float-in-column-queued.png deleted file mode 100644 index 3eeb13dd..00000000 Binary files a/tests/ref/place-float-in-column-queued.png and /dev/null differ diff --git a/tests/ref/place-float-rel-sizing.png b/tests/ref/place-float-rel-sizing.png new file mode 100644 index 00000000..1b4e44b2 Binary files /dev/null and b/tests/ref/place-float-rel-sizing.png differ diff --git a/tests/ref/place-float-threecolumn-block-backlog.png b/tests/ref/place-float-threecolumn-block-backlog.png new file mode 100644 index 00000000..768d4eda Binary files /dev/null and b/tests/ref/place-float-threecolumn-block-backlog.png differ diff --git a/tests/ref/place-float-threecolumn.png b/tests/ref/place-float-threecolumn.png new file mode 100644 index 00000000..65ad88ac Binary files /dev/null and b/tests/ref/place-float-threecolumn.png differ diff --git a/tests/ref/place-float-twocolumn-align-auto.png b/tests/ref/place-float-twocolumn-align-auto.png new file mode 100644 index 00000000..5d9932a3 Binary files /dev/null and b/tests/ref/place-float-twocolumn-align-auto.png differ diff --git a/tests/ref/place-float-twocolumn-fits-not.png b/tests/ref/place-float-twocolumn-fits-not.png new file mode 100644 index 00000000..e533daf9 Binary files /dev/null and b/tests/ref/place-float-twocolumn-fits-not.png differ diff --git a/tests/ref/place-float-twocolumn-fits.png b/tests/ref/place-float-twocolumn-fits.png new file mode 100644 index 00000000..07e4c25f Binary files /dev/null and b/tests/ref/place-float-twocolumn-fits.png differ diff --git a/tests/ref/place-float-twocolumn-queued.png b/tests/ref/place-float-twocolumn-queued.png new file mode 100644 index 00000000..e5fa387d Binary files /dev/null and b/tests/ref/place-float-twocolumn-queued.png differ diff --git a/tests/ref/place-float-twocolumn.png b/tests/ref/place-float-twocolumn.png new file mode 100644 index 00000000..3ed2f729 Binary files /dev/null and b/tests/ref/place-float-twocolumn.png differ diff --git a/tests/ref/query-running-header.png b/tests/ref/query-running-header.png index 210c7810..1dd04418 100644 Binary files a/tests/ref/query-running-header.png and b/tests/ref/query-running-header.png differ diff --git a/tests/skip.txt b/tests/skip.txt new file mode 100644 index 00000000..e69de29b diff --git a/tests/src/collect.rs b/tests/src/collect.rs index 4dae0b70..cc3ff736 100644 --- a/tests/src/collect.rs +++ b/tests/src/collect.rs @@ -5,6 +5,7 @@ use std::path::{Path, PathBuf}; use std::str::FromStr; use ecow::{eco_format, EcoString}; +use once_cell::sync::Lazy; use typst::syntax::package::PackageVersion; use typst::syntax::{is_id_continue, is_ident, is_newline, FileId, Source, VirtualPath}; use unscanny::Scanner; @@ -389,6 +390,18 @@ impl<'a> Parser<'a> { /// Whether a test is within the selected set to run. fn selected(name: &str, abs: PathBuf) -> bool { + static SKIPPED: Lazy> = Lazy::new(|| { + String::leak(std::fs::read_to_string(crate::SKIP_PATH).unwrap()) + .lines() + .map(|line| line.trim()) + .filter(|line| !line.is_empty() && !line.starts_with("//")) + .collect() + }); + + if SKIPPED.contains(name) { + return false; + } + let paths = &crate::ARGS.path; if !paths.is_empty() && !paths.iter().any(|path| abs.starts_with(path)) { return false; diff --git a/tests/src/tests.rs b/tests/src/tests.rs index a2d85fec..58bd7cf7 100644 --- a/tests/src/tests.rs +++ b/tests/src/tests.rs @@ -30,6 +30,9 @@ const STORE_PATH: &str = "tests/store"; /// The directory where the reference images are stored. const REF_PATH: &str = "tests/ref"; +/// The file where the skipped tests are stored. +const SKIP_PATH: &str = "tests/skip.txt"; + /// The maximum size of reference images that aren't marked as `// LARGE`. const REF_LIMIT: usize = 20 * 1024; diff --git a/tests/suite/introspection/query.typ b/tests/suite/introspection/query.typ index b078863e..ddb518f5 100644 --- a/tests/suite/introspection/query.typ +++ b/tests/suite/introspection/query.typ @@ -25,10 +25,10 @@ #outline() = Introduction -#v(1cm) +#lines(1) = Background -#v(2cm) +#lines(2) = Approach diff --git a/tests/suite/layout/align.typ b/tests/suite/layout/align.typ index 61b79975..c4ed9ab9 100644 --- a/tests/suite/layout/align.typ +++ b/tests/suite/layout/align.typ @@ -140,3 +140,11 @@ To the right! Where the sunlight peeks behind the mountain. // Test right-aligning a line and a rectangle. #align(right, line(length: 30%)) #align(right, rect()) + +--- issue-2213-align-fr --- +// Test a mix of alignment and fr units (fr wins). +#set page(height: 80pt) +A +#v(1fr) +B +#align(bottom + right)[C] diff --git a/tests/suite/layout/columns.typ b/tests/suite/layout/columns.typ index 87a9f773..b86b798b 100644 --- a/tests/suite/layout/columns.typ +++ b/tests/suite/layout/columns.typ @@ -122,3 +122,10 @@ Hallo = B Text ] + +--- colbreak-weak --- +#set page(columns: 2) +#colbreak(weak: true) +A +#colbreak(weak: true) +B diff --git a/tests/suite/layout/container.typ b/tests/suite/layout/container.typ index 9ce3dc7d..508f1a36 100644 --- a/tests/suite/layout/container.typ +++ b/tests/suite/layout/container.typ @@ -18,10 +18,41 @@ Apart #block(width: 50%, height: 60%, fill: blue) ] ---- box-width-fr --- +--- box-fr-width --- // Test fr box. Hello #box(width: 1fr, rect(height: 0.7em, width: 100%)) World +--- block-fr-height --- +#set page(height: 100pt) +#rect(height: 10pt, width: 100%) +#align(center, block(height: 1fr, width: 20pt, stroke: 1pt)) +#rect(height: 10pt, width: 100%) + +--- block-fr-height-auto-width --- +// Test that the fr block can also expand its parent. +#set page(height: 100pt) +#set align(center) +#block(inset: 5pt, stroke: green)[ + #rect(height: 10pt) + #block(height: 1fr, stroke: 1pt, inset: 5pt)[ + #set align(center + horizon) + I am the widest + ] + #rect(height: 10pt) +] + +--- block-fr-height-first-child --- +// Test that block spacing is not trimmed if only an fr block precedes it. +#set page(height: 100pt) +#rect(height: 1fr) +#rect() + +--- block-fr-height-multiple --- +#set page(height: 100pt) +#rect(height: 1fr) +#rect() +#block(height: 1fr, line(length: 100%, angle: 90deg)) + --- block-multiple-pages --- // Test block over multiple pages. #set page(height: 60pt) @@ -121,6 +152,34 @@ Paragraph #show bibliography: none #bibliography("/assets/bib/works.bib") +--- block-sticky --- +#set page(height: 100pt) +#lines(3) +#block(sticky: true)[D] +#block(sticky: true)[E] +F + +--- block-sticky-alone --- +#set page(height: 50pt) +#block(sticky: true)[A] + +--- block-sticky-many --- +#set page(height: 80pt) +#set block(sticky: true) +#block[A] +#block[B] +#block[C] +#block[D] +E +#block[F] +#block[G] + +--- block-sticky-colbreak --- +A +#block(sticky: true)[B] +#colbreak() +C + --- box-clip-rect --- // Test box clipping with a rectangle Hello #box(width: 1em, height: 1em, clip: false)[#rect(width: 3em, height: 3em, fill: red)] diff --git a/tests/suite/layout/flow/flow.typ b/tests/suite/layout/flow/flow.typ index 88075c5b..fcbc005b 100644 --- a/tests/suite/layout/flow/flow.typ +++ b/tests/suite/layout/flow/flow.typ @@ -55,9 +55,6 @@ --- issue-3641-float-loop --- // Flow layout should terminate! -// -// This is not yet ideal: The heading should not move to the second page, but -// that's a separate bug and not a regression. #set page(height: 40pt) = Heading @@ -69,3 +66,13 @@ #metadata(none) #v(10pt, weak: true) Hi + +--- issue-3866-block-migration --- +#set page(height: 120pt) +#set text(costs: (widow: 0%, orphan: 0%)) +#v(50pt) +#columns(2)[ + #lines(6) + #block(rect(width: 80%, height: 80pt), breakable: false) + #lines(6) +] diff --git a/tests/suite/layout/flow/footnote.typ b/tests/suite/layout/flow/footnote.typ new file mode 100644 index 00000000..f7722e15 --- /dev/null +++ b/tests/suite/layout/flow/footnote.typ @@ -0,0 +1,277 @@ +// Test footnotes. + +--- footnote-basic --- +#footnote[Hi] + +--- footnote-space-collapsing --- +// Test space collapsing before footnote. +A#footnote[A] \ +A #footnote[A] + +--- footnote-nested --- +// Currently, numbers a bit out of order if a nested footnote ends up in the +// same frame as another one. :( +First \ +Second #footnote[A, #footnote[B, #footnote[C]]] +Third #footnote[D, #footnote[E]] \ +Fourth #footnote[F] + +--- footnote-entry --- +// Test customization. +#show footnote: set text(red) +#show footnote.entry: set text(8pt, style: "italic") +#set footnote.entry( + indent: 0pt, + gap: 0.6em, + clearance: 0.3em, + separator: repeat[.], +) + +Beautiful footnotes. #footnote[Wonderful, aren't they?] + +--- footnote-break-across-pages --- +#set page(height: 200pt) + +#lines(2) +#footnote[ // 1 + I + #footnote[II ...] // 2 +] +#lines(6) +#footnote[III: #lines(8, "1")] // 3 +#lines(6) +#footnote[IV: #lines(15, "1")] // 4 +#lines(6) +#footnote[V] // 5 + +--- footnote-break-across-pages-block --- +#set page(height: 100pt) +#block[ + #lines(3) #footnote(lines(6, "1")) + #footnote[Y] + #footnote[Z] +] + +--- footnote-break-across-pages-float --- +#set page(height: 180pt) + +#lines(5) + +#place( + bottom, + float: true, + rect(height: 50pt, width: 100%, { + footnote(lines(6, "1")) + footnote(lines(2, "I")) + }) +) + +#lines(5) + +--- footnote-break-across-pages-nested --- +#set page(height: 120pt) +#block[ + #lines(4) + #footnote[ + #lines(6, "1") + #footnote(lines(3, "I")) + ] +] + +--- footnote-in-columns --- +#set page(height: 120pt, columns: 2) + +#place( + top + center, + float: true, + scope: "page", + clearance: 12pt, + strong[Title], +) + +#lines(3) +#footnote(lines(4, "1")) + +#lines(2) +#footnote(lines(2, "1")) + +--- footnote-in-list --- +#set page(height: 120pt) + +- A #footnote[a] +- B #footnote[b] +- C #footnote[c] +- D #footnote[d] +- E #footnote[e] +- F #footnote[f] +- G #footnote[g] + +--- footnote-block-at-end --- +#set page(height: 50pt) +A +#block(footnote[hello]) + +--- footnote-float-priority --- +#set page(height: 100pt) + +#lines(3) + +#place( + top, + float: true, + rect(height: 40pt) +) + +#block[ + V + #footnote[1] + #footnote[2] + #footnote[3] + #footnote[4] +] + +#lines(5) + +--- footnote-in-caption --- +// Test footnote in caption. +Read the docs #footnote[https://typst.app/docs]! +#figure( + image("/assets/images/graph.png", width: 70%), + caption: [ + A graph #footnote[A _graph_ is a structure with nodes and edges.] + ] +) +More #footnote[just for ...] footnotes #footnote[... testing. :)] + +--- footnote-in-place --- +A +#place(top + right, footnote[A]) +#figure( + placement: bottom, + caption: footnote[B], + rect(), +) + +--- footnote-duplicate --- +// Test duplicate footnotes. +#let lang = footnote[Languages.] +#let nums = footnote[Numbers.] + +/ "Hello": A word #lang +/ "123": A number #nums + +- "Hello" #lang +- "123" #nums + ++ "Hello" #lang ++ "123" #nums + +#table( + columns: 2, + [Hello], [A word #lang], + [123], [A number #nums], +) + +--- footnote-invariant --- +// Ensure that a footnote and the first line of its entry +// always end up on the same page. +#set page(height: 120pt) + +#lines(5) + +A #footnote(lines(6, "1")) + +--- footnote-ref --- +// Test references to footnotes. +A footnote #footnote[Hi] \ +A reference to it @fn + +--- footnote-self-ref --- +// Error: 2-16 footnote cannot reference itself +#footnote() + +--- footnote-ref-multiple --- +// Multiple footnotes are refs +First #footnote[A] \ +Second #footnote[B] \ +First ref @fn1 \ +Third #footnote[C] \ +Fourth #footnote[D] \ +Fourth ref @fn4 \ +Second ref @fn2 \ +Second ref again @fn2 + +--- footnote-ref-forward --- +// Forward reference +Usage @fn \ +Definition #footnote[Hi] + +--- footnote-ref-in-footnote --- +// Footnote ref in footnote +#footnote[Reference to next @fn] +#footnote[Reference to myself @fn] +#footnote[Reference to previous @fn] + +--- footnote-styling --- +// Styling +#show footnote: text.with(fill: red) +Real #footnote[...] \ +Ref @fn + +--- footnote-ref-call --- +// Footnote call with label +#footnote() +#footnote[Hi] +#ref() +#footnote() + +--- footnote-in-table --- +// Test footnotes in tables. When the table spans multiple pages, the footnotes +// will all be after the table, but it shouldn't create any empty pages. +#set page(height: 100pt) + += Tables +#table( + columns: 2, + [Hello footnote #footnote[This is a footnote.]], + [This is more text], + [This cell + #footnote[This footnote is not on the same page] + breaks over multiple pages.], + image("/assets/images/tiger.jpg"), +) + +#table( + columns: 3, + ..range(1, 10) + .map(numbering.with("a")) + .map(v => upper(v) + footnote(v)) +) + +--- footnote-multiple-in-one-line --- +#set page(height: 100pt) +#v(50pt) +A #footnote[a] +B #footnote[b] + +--- issue-1433-footnote-in-list --- +// Test that footnotes in lists do not produce extraneous page breaks. The list +// layout itself does not currently react to the footnotes layout, weakening the +// "footnote and its entry are on the same page" invariant somewhat, but at +// least there shouldn't be extra page breaks. +#set page(height: 100pt) +#block(height: 50pt, width: 100%, fill: aqua) + +- #footnote[1] +- #footnote[2] + +--- issue-footnotes-skip-first-page --- +// In this issue, we would get an empty page at the beginning because footnote +// layout didn't properly check for in_last. +#set page(height: 50pt) +#footnote[A] +#footnote[B] + +--- issue-4454-footnote-ref-numbering --- +// Test that footnote references are numbered correctly. +A #footnote(numbering: "*")[B], C @fn, D @fn, E @fn. diff --git a/tests/suite/layout/flow/place-float.typ b/tests/suite/layout/flow/place-float.typ deleted file mode 100644 index 50a8a112..00000000 --- a/tests/suite/layout/flow/place-float.typ +++ /dev/null @@ -1,83 +0,0 @@ ---- place-float-flow-around --- -#set page(height: 80pt) -#set place(float: true) -#place(bottom + center, rect(height: 20pt)) -#lines(4) - ---- place-float-queued --- -#set page(height: 180pt) -#set figure(placement: auto) - -#figure(rect(height: 60pt), caption: [I]) -#figure(rect(height: 40pt), caption: [II]) -#figure(rect(), caption: [III]) -#figure(rect(), caption: [IV]) -A - ---- place-float-align-auto --- -#set page(height: 140pt) -#set place(clearance: 5pt) -#set place(auto, float: true) - -#place(rect[A]) -#place(rect[B]) -1 \ 2 -#place(rect[C]) -#place(rect[D]) - ---- place-float-in-column-align-auto --- -#set page(height: 150pt, columns: 2) -#set place(auto, float: true, clearance: 10pt) -#set rect(width: 75%) - -#place(rect[I]) -#place(rect[II]) -#place(rect[III]) -#place(rect[IV]) - -#lines(6) - -#place(rect[V]) - ---- place-float-in-column-queued --- -#set page(height: 100pt, columns: 2) -#set place(float: true, clearance: 10pt) -#set rect(width: 75%) -#set text(costs: (widow: 0%, orphan: 0%)) - -#lines(3) - -#place(top, rect[I]) -#place(top, rect[II]) -#place(bottom, rect[III]) - -#lines(3) - ---- place-float-missing --- -// 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] - ---- place-float-center-horizon --- -// Error: 2-45 floating placement must be `auto`, `top`, or `bottom` -#place(center + horizon, float: true)[Hello] - ---- place-float-horizon --- -// Error: 2-36 floating placement must be `auto`, `top`, or `bottom` -#place(horizon, float: true)[Hello] - ---- place-float-default --- -// Error: 2-27 floating placement must be `auto`, `top`, or `bottom` -#place(float: true)[Hello] - ---- place-float-right --- -// Error: 2-34 floating placement must be `auto`, `top`, or `bottom` -#place(right, float: true)[Hello] - ---- issue-2595-float-overlap --- -#set page(height: 80pt) - -1 -#place(auto, float: true, block(height: 100%, width: 100%, fill: aqua)) -#place(auto, float: true, block(height: 100%, width: 100%, fill: red)) -#lines(7) diff --git a/tests/suite/layout/flow/place-flush.typ b/tests/suite/layout/flow/place-flush.typ deleted file mode 100644 index 8f55a6fd..00000000 --- a/tests/suite/layout/flow/place-flush.typ +++ /dev/null @@ -1,29 +0,0 @@ ---- place-flush --- -#set page(height: 120pt) -#let floater(align, height) = place( - align, - float: true, - rect(width: 100%, height: height), -) - -#floater(top, 30pt) -A - -#floater(bottom, 50pt) -#place.flush() -B // Should be on the second page. - ---- place-flush-figure --- -#set page(height: 120pt) -#let floater(align, height, caption) = figure( - placement: align, - caption: caption, - rect(width: 100%, height: height), -) - -#floater(top, 30pt)[I] -A - -#floater(bottom, 50pt)[II] -#place.flush() -B // Should be on the second page. diff --git a/tests/suite/layout/flow/place.typ b/tests/suite/layout/flow/place.typ index f3231735..dc655ec5 100644 --- a/tests/suite/layout/flow/place.typ +++ b/tests/suite/layout/flow/place.typ @@ -70,6 +70,288 @@ Second #line(length: 50pt) ] +--- place-float-flow-around --- +#set page(height: 80pt) +#set place(float: true) +#place(bottom + center, rect(height: 20pt)) +#lines(4) + +--- place-float-queued --- +#set page(height: 180pt) +#set figure(placement: auto) + +#figure(rect(height: 60pt), caption: [I]) +#figure(rect(height: 40pt), caption: [II]) +#figure(rect(), caption: [III]) +A +#figure(rect(), caption: [IV]) + +--- place-float-align-auto --- +#set page(height: 140pt) +#set place(auto, float: true, clearance: 5pt) + +#place(rect[A]) +#place(rect[B]) +1 \ 2 +#place(rect[C]) +#place(rect[D]) + +--- place-float-delta --- +#place(top + center, float: true, dx: 10pt, rect[I]) +A +#place(bottom + center, float: true, dx: -10pt, rect[II]) + +--- place-float-flow-size --- +#set page(width: auto, height: auto) +#set place(float: true, clearance: 5pt) + +#place(bottom, rect(width: 80pt, height: 10pt)) +#place(top + center, rect(height: 20pt)) +#align(center)[A] +#pagebreak() +#align(center)[B] +#place(bottom, scope: "page", rect(height: 10pt)) + +--- place-float-flow-size-alone --- +#set page(width: auto, height: auto) +#set place(float: true, clearance: 5pt) +#place(auto)[A] + +--- place-float-fr --- +#set page(height: 120pt, columns: 2) +#set place(float: true, clearance: 10pt) +#set rect(width: 70%) + +#place(top + center, rect[I]) +#place(bottom + center, scope: "page", rect[II]) + +A +#v(1fr) +B +#colbreak() +C +#align(bottom)[D] + +--- place-float-rel-sizing --- +#set page(height: 100pt, columns: 2) +#set place(float: true, clearance: 10pt) +#set rect(width: 70%) + +#place(top + center, scope: "page", rect[I]) +#place(top + center, rect[II]) + +// This test result is not ideal: The first column takes 30% of the full page, +// while the second takes 30% of the remaining space since there is no concept +// of `full` for followup pages. +#set align(bottom) +#rect(width: 100%, height: 30%) +#rect(width: 100%, height: 30%) + +--- place-float-block-backlog --- +#set page(height: 100pt) +#v(60pt) +#place(top, float: true, rect()) +#list(.."ABCDEFGHIJ".clusters()) + +--- place-float-clearance-empty --- +// Check that we don't require space for clearance if there is no content. +#set page(height: 100pt) +#v(1fr) +#table( + columns: (1fr, 1fr), + lines(2), + [], + lines(8), + place(auto, float: true, block(width: 100%, height: 100%, fill: aqua)) +) + + +--- place-float-column-align-auto --- +#set page(height: 150pt, columns: 2) +#set place(auto, float: true, clearance: 10pt) +#set rect(width: 75%) + +#place(rect[I]) +#place(rect[II]) +#place(rect[III]) +#place(rect[IV]) + +#lines(6) + +#place(rect[V]) +#place(rect[VI]) + +--- place-float-column-queued --- +#set page(height: 100pt, columns: 2) +#set place(float: true, clearance: 10pt) +#set rect(width: 75%) +#set text(costs: (widow: 0%, orphan: 0%)) + +#lines(3) + +#place(top, rect[I]) +#place(top, rect[II]) +#place(bottom, rect[III]) + +#lines(3) + +--- place-float-twocolumn --- +#set page(height: 100pt, columns: 2) +#set place(float: true, clearance: 10pt) +#set rect(width: 70%) + +#place(top + center, scope: "page", rect[I]) +#place(top + center, rect[II]) +#lines(4) +#place(top + center, rect[III]) +#block(width: 100%, height: 70pt, fill: conifer) +#place(bottom + center, scope: "page", rect[IV]) +#place(bottom + center, rect[V]) +#v(1pt, weak: true) +#block(width: 100%, height: 60pt, fill: aqua) + +--- place-float-twocolumn-queued --- +#set page(height: 100pt, columns: 2) +#set place(float: true, scope: "page", clearance: 10pt) +#let t(align, fill) = place(top + align, rect(fill: fill, height: 25pt)) + +#t(left, aqua) +#t(center, forest) +#t(right, conifer) +#lines(7) + +--- place-float-twocolumn-align-auto --- +#set page(height: 100pt, columns: 2) +#set place(float: true, clearance: 10pt) +#set rect(width: 70%) + +#place(auto, scope: "page", rect[I]) // Should end up `top` +#lines(4) +#place(auto, scope: "page", rect[II]) // Should end up `bottom` +#lines(4) + +--- place-float-twocolumn-fits --- +#set page(height: 100pt, columns: 2) +#set place(float: true, clearance: 10pt) +#set rect(width: 70%) + +#lines(6) +#place(auto, scope: "page", rect[I]) +#lines(12, "1") + +--- place-float-twocolumn-fits-not --- +#set page(height: 100pt, columns: 2) +#set place(float: true, clearance: 10pt) +#set rect(width: 70%) + +#lines(10) +#place(auto, scope: "page", rect[I]) +#lines(10, "1") + +--- place-float-threecolumn --- +#set page(height: 100pt, columns: 3) +#set place(float: true, clearance: 10pt) +#set rect(width: 70%) + +#place(bottom + center, scope: "page", rect[I]) +#lines(21) +#place(top + center, scope: "page", rect[II]) + +--- place-float-threecolumn-block-backlog --- +#set page(height: 100pt, columns: 3) +#set place(float: true, clearance: 10pt) +#set rect(width: 70%) + +// The most important part of this test is that we get the backlog of the +// conifer (green) block right. +#place(top + center, scope: "page", rect[I]) +#block(fill: aqua, width: 100%, height: 70pt) +#block(fill: conifer, width: 100%, height: 160pt) +#place(bottom + center, scope: "page", rect[II]) +#place(top, rect(height: 40%)[III]) +#block(fill: yellow, width: 100%, height: 60pt) + +--- place-float-counter --- +#let c = counter("c") +#let cd = context c.display() + +#set page( + height: 100pt, + margin: (y: 20pt), + header: [H: #cd], + footer: [F: #cd], + columns: 2, +) + +#let t(align, scope: "column", n) = place( + align, + float: true, + scope: scope, + clearance: 10pt, + line(length: 100%) + c.update(n), +) + +#t(bottom, 6) +#cd +#t(top, 3) +#colbreak() +#cd +#t(scope: "page", bottom, 11) +#colbreak() +#cd +#t(top, 12) + +--- place-float-missing --- +// 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] + +--- place-float-center-horizon --- +// Error: 2-45 vertical floating placement must be `auto`, `top`, or `bottom` +#place(center + horizon, float: true)[Hello] + +--- place-float-horizon --- +// Error: 2-36 vertical floating placement must be `auto`, `top`, or `bottom` +#place(horizon, float: true)[Hello] + +--- place-float-default --- +// Error: 2-27 vertical floating placement must be `auto`, `top`, or `bottom` +#place(float: true)[Hello] + +--- place-float-right --- +// Error: 2-34 vertical floating placement must be `auto`, `top`, or `bottom` +#place(right, float: true)[Hello] + +--- place-flush --- +#set page(height: 120pt) +#let floater(align, height) = place( + align, + float: true, + rect(width: 100%, height: height), +) + +#floater(top, 30pt) +A + +#floater(bottom, 50pt) +#place.flush() +B // Should be on the second page. + +--- place-flush-figure --- +#set page(height: 120pt) +#let floater(align, height, caption) = figure( + placement: align, + caption: caption, + rect(width: 100%, height: height), +) + +#floater(top, 30pt)[I] +A + +#floater(bottom, 50pt)[II] +#place.flush() +B // Should be on the second page. + --- issue-place-base --- // Test that placement is relative to container and not itself. #set page(height: 80pt, margin: 0pt) @@ -98,3 +380,11 @@ Paragraph after float. Paragraph before place. #place(rect()) Paragraph after place. + +--- issue-2595-float-overlap --- +#set page(height: 80pt) + +1 +#place(auto, float: true, block(height: 100%, width: 100%, fill: aqua)) +#place(auto, float: true, block(height: 100%, width: 100%, fill: red)) +#lines(7) diff --git a/tests/suite/model/cite.typ b/tests/suite/model/cite.typ index ffbd3b52..f69fe9f4 100644 --- a/tests/suite/model/cite.typ +++ b/tests/suite/model/cite.typ @@ -102,8 +102,7 @@ B #cite() #cite(). // Everything moves to the second page because we want to keep the line and // its footnotes together. -#footnote[@netwok] -#footnote[A] +#footnote[@netwok \ A] #show bibliography: none #bibliography("/assets/bib/works.bib") diff --git a/tests/suite/model/figure.typ b/tests/suite/model/figure.typ index 13e94481..d71d92e3 100644 --- a/tests/suite/model/figure.typ +++ b/tests/suite/model/figure.typ @@ -41,6 +41,42 @@ We can clearly see that @fig-cylinder and caption: "A table containing images." ) +--- figure-placement --- +#set page(height: 160pt, columns: 2) +#set place(clearance: 10pt) + +#lines(4) + +#figure( + placement: auto, + scope: "page", + caption: [I], + rect(height: 15pt, width: 80%), +) + +#figure( + placement: bottom, + caption: [II], + rect(height: 15pt, width: 80%), +) + +#lines(2) + +#figure( + placement: bottom, + caption: [III], + rect(height: 25pt, width: 80%), +) + +#figure( + placement: auto, + scope: "page", + caption: [IV], + rect(width: 80%), +) + +#lines(15) + --- figure-theorem --- // Testing show rules with figures with a simple theorem display #show figure.where(kind: "theorem"): it => { diff --git a/tests/suite/model/footnote.typ b/tests/suite/model/footnote.typ deleted file mode 100644 index 41091228..00000000 --- a/tests/suite/model/footnote.typ +++ /dev/null @@ -1,195 +0,0 @@ -// Test footnotes. - ---- footnote-basic --- -#footnote[Hi] - ---- footnote-space-collapsing --- -// Test space collapsing before footnote. -A#footnote[A] \ -A #footnote[A] - ---- footnote-nested --- -// Test nested footnotes. -First \ -Second #footnote[A, #footnote[B, #footnote[C]]] \ -Third #footnote[D, #footnote[E]] \ -Fourth - ---- footnote-nested-same-frame --- -// Currently, numbers a bit out of order if a nested footnote ends up in the -// same frame as another one. :( -#footnote[A, #footnote[B]], #footnote[C] - ---- footnote-entry --- -// Test customization. -#show footnote: set text(red) -#show footnote.entry: set text(8pt, style: "italic") -#set footnote.entry( - indent: 0pt, - gap: 0.6em, - clearance: 0.3em, - separator: repeat[.], -) - -Beautiful footnotes. #footnote[Wonderful, aren't they?] - ---- footnote-break-across-pages --- -#set page(height: 200pt) - -#lines(2) -#footnote[ // 1 - I - #footnote[II ...] // 2 -] -#lines(6) -#footnote[III: #lines(8, "1")] // 3 -#lines(6) -#footnote[IV: #lines(15, "1")] // 4 -#lines(6) -#footnote[V] // 5 - ---- footnote-in-columns --- -// Test footnotes in columns, even those that are not enabled via `set page`. -#set page(height: 120pt) -#align(center, strong[Title]) - -#show: columns.with(2) -#lines(3) -#footnote(lines(4, "1")) - -#lines(2) -#footnote(lines(2, "1")) - ---- footnote-in-caption --- -// Test footnote in caption. -Read the docs #footnote[https://typst.app/docs]! -#figure( - image("/assets/images/graph.png", width: 70%), - caption: [ - A graph #footnote[A _graph_ is a structure with nodes and edges.] - ] -) -More #footnote[just for ...] footnotes #footnote[... testing. :)] - ---- footnote-duplicate --- -// Test duplicate footnotes. -#let lang = footnote[Languages.] -#let nums = footnote[Numbers.] - -/ "Hello": A word #lang -/ "123": A number #nums - -- "Hello" #lang -- "123" #nums - -+ "Hello" #lang -+ "123" #nums - -#table( - columns: 2, - [Hello], [A word #lang], - [123], [A number #nums], -) - ---- footnote-invariant --- -// Ensure that a footnote and the first line of its entry -// always end up on the same page. -#set page(height: 120pt) - -#lines(5) - -A #footnote(lines(6, "1")) - ---- footnote-ref --- -// Test references to footnotes. -A footnote #footnote[Hi] \ -A reference to it @fn - ---- footnote-ref-multiple --- -// Multiple footnotes are refs -First #footnote[A] \ -Second #footnote[B] \ -First ref @fn1 \ -Third #footnote[C] \ -Fourth #footnote[D] \ -Fourth ref @fn4 \ -Second ref @fn2 \ -Second ref again @fn2 - ---- footnote-ref-forward --- -// Forward reference -Usage @fn \ -Definition #footnote[Hi] - ---- footnote-ref-in-footnote --- -// Footnote ref in footnote -#footnote[Reference to next @fn] -#footnote[Reference to myself @fn] -#footnote[Reference to previous @fn] - ---- footnote-styling --- -// Styling -#show footnote: text.with(fill: red) -Real #footnote[...] \ -Ref @fn - ---- footnote-ref-call --- -// Footnote call with label -#footnote() -#footnote[Hi] -#ref() -#footnote() - ---- footnote-in-table --- -// Test footnotes in tables. When the table spans multiple pages, the footnotes -// will all be after the table, but it shouldn't create any empty pages. -#set page(height: 100pt) - -= Tables -#table( - columns: 2, - [Hello footnote #footnote[This is a footnote.]], - [This is more text], - [This cell - #footnote[This footnote is not on the same page] - breaks over multiple pages.], - image("/assets/images/tiger.jpg"), -) - -#table( - columns: 3, - ..range(1, 10) - .map(numbering.with("a")) - .map(v => upper(v) + footnote(v)) -) - ---- issue-multiple-footnote-in-one-line --- -// Test that the logic that keeps footnote entry together with -// their markers also works for multiple footnotes in a single -// line. -#set page(height: 100pt) -#v(50pt) -A #footnote[a] -B #footnote[b] - ---- issue-1433-footnote-in-list --- -// Test that footnotes in lists do not produce extraneous page breaks. The list -// layout itself does not currently react to the footnotes layout, weakening the -// "footnote and its entry are on the same page" invariant somewhat, but at -// least there shouldn't be extra page breaks. -#set page(height: 100pt) -#block(height: 50pt, width: 100%, fill: aqua) - -- #footnote[1] -- #footnote[2] - ---- issue-footnotes-skip-first-page --- -// In this issue, we would get an empty page at the beginning because footnote -// layout didn't properly check for in_last. -#set page(height: 50pt) -#footnote[A] -#footnote[B] - ---- issue-4454-footnote-ref-numbering --- -// Test that footnote references are numbered correctly. -A #footnote(numbering: "*")[B], C @fn, D @fn, E @fn. -- cgit v1.2.3