Skip to content

Commit 45cddd5

Browse files
committed
Let captioned tables break across pages in Typst
Typst figures do not break across pages, so a captioned table taller than the page ran past the page bottom and its last rows were lost. definitions.typ now makes table figures breakable. Because the rule comes before include-in-header in the template, a document can still keep its tables whole with one line in its header: #show figure.where(kind: "quarto-float-tbl"): set block(breakable: false)
1 parent 38e34ec commit 45cddd5

4 files changed

Lines changed: 192 additions & 0 deletions

File tree

‎news/changelog-1.12.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ All changes included in 1.12:
3131

3232
- ([#15168](https://github.com/quarto-dev/quarto-cli/issues/15168)): Fix definitions, examples and exercises being set in italics in Typst output with the default `theorem-appearance: simple`. Their body is now upright, as in LaTeX output, while theorems, lemmas, corollaries, propositions and conjectures keep an italic body. (author: @mcanouil)
3333
- ([#15251](https://github.com/quarto-dev/quarto-cli/pull/15251)): Fix algorithm blocks (`#alg-`) being set in italics with `theorem-appearance: simple` and using the colours of theorems with `theorem-appearance: fancy`. They now look like definitions, examples and exercises. (author: @mcanouil)
34+
- ([#15278](https://github.com/quarto-dev/quarto-cli/pull/15278)): Fix captioned tables taller than a page being cut off instead of continuing on the next page. (author: @faysou)
3435

3536
## Projects
3637

‎src/resources/formats/typst/pandoc/quarto/definitions.typ‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#block(inset: (left: 1.5em, top: -0.4em))[#it.description]
2323
]
2424

25+
#show figure.where(kind: "quarto-float-tbl"): set block(breakable: true)
26+
2527
// Some quarto-specific definitions.
2628

2729
#show raw.where(block: true): set block(
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
title: Long captioned table breaks across pages
3+
format: typst
4+
_quarto:
5+
tests:
6+
typst:
7+
ensurePdfTextPositions:
8+
- # The table is taller than a page. A breakable figure starts on
9+
# page 1 below the title; an unbreakable one moves whole to page 2
10+
# and its last rows run past the page bottom.
11+
- subject: "FIRSTROW_MARKER"
12+
relation: above
13+
object:
14+
role: Page
15+
page: 1
16+
edge: bottom
17+
- []
18+
---
19+
20+
| A | B |
21+
|---|---|
22+
| 1 | FIRSTROW_MARKER |
23+
| 2 | row 2 |
24+
| 3 | row 3 |
25+
| 4 | row 4 |
26+
| 5 | row 5 |
27+
| 6 | row 6 |
28+
| 7 | row 7 |
29+
| 8 | row 8 |
30+
| 9 | row 9 |
31+
| 10 | row 10 |
32+
| 11 | row 11 |
33+
| 12 | row 12 |
34+
| 13 | row 13 |
35+
| 14 | row 14 |
36+
| 15 | row 15 |
37+
| 16 | row 16 |
38+
| 17 | row 17 |
39+
| 18 | row 18 |
40+
| 19 | row 19 |
41+
| 20 | row 20 |
42+
| 21 | row 21 |
43+
| 22 | row 22 |
44+
| 23 | row 23 |
45+
| 24 | row 24 |
46+
| 25 | row 25 |
47+
| 26 | row 26 |
48+
| 27 | row 27 |
49+
| 28 | row 28 |
50+
| 29 | row 29 |
51+
| 30 | row 30 |
52+
| 31 | row 31 |
53+
| 32 | row 32 |
54+
| 33 | row 33 |
55+
| 34 | row 34 |
56+
| 35 | row 35 |
57+
| 36 | row 36 |
58+
| 37 | row 37 |
59+
| 38 | row 38 |
60+
| 39 | row 39 |
61+
| 40 | row 40 |
62+
| 41 | row 41 |
63+
| 42 | row 42 |
64+
| 43 | row 43 |
65+
| 44 | row 44 |
66+
| 45 | row 45 |
67+
| 46 | row 46 |
68+
| 47 | row 47 |
69+
| 48 | row 48 |
70+
| 49 | row 49 |
71+
| 50 | row 50 |
72+
| 51 | row 51 |
73+
| 52 | row 52 |
74+
| 53 | row 53 |
75+
| 54 | row 54 |
76+
| 55 | row 55 |
77+
| 56 | row 56 |
78+
| 57 | row 57 |
79+
| 58 | row 58 |
80+
| 59 | row 59 |
81+
| 60 | row 60 |
82+
| 61 | row 61 |
83+
| 62 | row 62 |
84+
| 63 | row 63 |
85+
| 64 | row 64 |
86+
| 65 | row 65 |
87+
| 66 | row 66 |
88+
| 67 | row 67 |
89+
| 68 | row 68 |
90+
| 69 | row 69 |
91+
| 70 | row 70 |
92+
93+
: Long table {#tbl-long}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
title: Header include keeps a long captioned table whole
3+
format:
4+
typst:
5+
include-in-header:
6+
text: |
7+
#show figure.where(kind: "quarto-float-tbl"): set block(breakable: false)
8+
_quarto:
9+
tests:
10+
typst:
11+
ensurePdfTextPositions:
12+
- []
13+
- # The header rule overrides the breakable default, so the
14+
# unbreakable figure moves whole to page 2.
15+
- subject: "FIRSTROW_MARKER"
16+
relation: above
17+
object:
18+
role: Page
19+
page: 1
20+
edge: bottom
21+
---
22+
23+
| A | B |
24+
|---|---|
25+
| 1 | FIRSTROW_MARKER |
26+
| 2 | row 2 |
27+
| 3 | row 3 |
28+
| 4 | row 4 |
29+
| 5 | row 5 |
30+
| 6 | row 6 |
31+
| 7 | row 7 |
32+
| 8 | row 8 |
33+
| 9 | row 9 |
34+
| 10 | row 10 |
35+
| 11 | row 11 |
36+
| 12 | row 12 |
37+
| 13 | row 13 |
38+
| 14 | row 14 |
39+
| 15 | row 15 |
40+
| 16 | row 16 |
41+
| 17 | row 17 |
42+
| 18 | row 18 |
43+
| 19 | row 19 |
44+
| 20 | row 20 |
45+
| 21 | row 21 |
46+
| 22 | row 22 |
47+
| 23 | row 23 |
48+
| 24 | row 24 |
49+
| 25 | row 25 |
50+
| 26 | row 26 |
51+
| 27 | row 27 |
52+
| 28 | row 28 |
53+
| 29 | row 29 |
54+
| 30 | row 30 |
55+
| 31 | row 31 |
56+
| 32 | row 32 |
57+
| 33 | row 33 |
58+
| 34 | row 34 |
59+
| 35 | row 35 |
60+
| 36 | row 36 |
61+
| 37 | row 37 |
62+
| 38 | row 38 |
63+
| 39 | row 39 |
64+
| 40 | row 40 |
65+
| 41 | row 41 |
66+
| 42 | row 42 |
67+
| 43 | row 43 |
68+
| 44 | row 44 |
69+
| 45 | row 45 |
70+
| 46 | row 46 |
71+
| 47 | row 47 |
72+
| 48 | row 48 |
73+
| 49 | row 49 |
74+
| 50 | row 50 |
75+
| 51 | row 51 |
76+
| 52 | row 52 |
77+
| 53 | row 53 |
78+
| 54 | row 54 |
79+
| 55 | row 55 |
80+
| 56 | row 56 |
81+
| 57 | row 57 |
82+
| 58 | row 58 |
83+
| 59 | row 59 |
84+
| 60 | row 60 |
85+
| 61 | row 61 |
86+
| 62 | row 62 |
87+
| 63 | row 63 |
88+
| 64 | row 64 |
89+
| 65 | row 65 |
90+
| 66 | row 66 |
91+
| 67 | row 67 |
92+
| 68 | row 68 |
93+
| 69 | row 69 |
94+
| 70 | row 70 |
95+
96+
: Long table {#tbl-long}

0 commit comments

Comments
 (0)