|
| 1 | +--- |
| 2 | +title: "Two Column with Landscape Section" |
| 3 | +subtitle: "Testing Column Layout with Page Orientation Changes" |
| 4 | +author: |
| 5 | + - name: Alice Smith |
| 6 | + email: alice@example.com |
| 7 | + affiliation: University A |
| 8 | + - name: Bob Jones |
| 9 | + email: bob@example.com |
| 10 | + affiliation: University B |
| 11 | +date: "2025-01-08" |
| 12 | +abstract: "This document tests combining two-column layout with landscape page sections. The title block should span both columns, and content should flow correctly when switching between portrait and landscape orientations." |
| 13 | +format: |
| 14 | + typst: |
| 15 | + columns: 2 |
| 16 | + keep-typ: true |
| 17 | +_quarto: |
| 18 | + tests: |
| 19 | + typst: |
| 20 | + ensureTypstFileRegexMatches: |
| 21 | + - # Patterns that MUST be found |
| 22 | + # Page columns set via set page() |
| 23 | + - 'columns: 2,' |
| 24 | + # Title block wrapped with place(scope: "parent") for column spanning |
| 25 | + - 'place\(top, float: true, scope: "parent", clearance: 4mm\)' |
| 26 | + # Landscape page start |
| 27 | + - '#set page\(flipped: true\)' |
| 28 | + # Landscape page end |
| 29 | + - '#set page\(flipped: false\)' |
| 30 | + - # Patterns that must NOT be found |
| 31 | + # Should NOT have columns() function call wrapping doc at end of article() |
| 32 | + - 'columns\(cols, doc\)\n\}' |
| 33 | +--- |
| 34 | + |
| 35 | +## Introduction |
| 36 | + |
| 37 | +This document tests the interaction between two-column layout and landscape page sections. The title block above should span the full page width, while this body content flows in two columns. |
| 38 | + |
| 39 | +## Portrait Section |
| 40 | + |
| 41 | +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. |
| 42 | + |
| 43 | +Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
| 44 | + |
| 45 | +Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. |
| 46 | + |
| 47 | +Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. |
| 48 | + |
| 49 | +::: {.landscape} |
| 50 | + |
| 51 | +## Landscape Section |
| 52 | + |
| 53 | +This section appears in landscape orientation. The two-column layout should persist but now on a rotated page, giving more horizontal space for wide content like tables. |
| 54 | + |
| 55 | +### The Bug This Test Catches |
| 56 | + |
| 57 | +When Quarto's `article()` function used `columns(cols, doc)` to wrap the document content (the old approach), landscape sections would crash with the error: |
| 58 | + |
| 59 | +``` |
| 60 | +error: page configuration is not allowed inside of containers |
| 61 | + ┌─ two-column-landscape.typ:351:1 |
| 62 | + │ |
| 63 | +351 │ #set page(flipped: true) |
| 64 | + │ ^^^^^^^^^^^^^^^^^^^^^^^ |
| 65 | +``` |
| 66 | + |
| 67 | +This happened because `columns()` creates a container, and Typst does not allow `set page()` directives inside containers. The landscape filter emits `#set page(flipped: true)` to rotate the page, which fails when nested inside a `columns()` call. |
| 68 | + |
| 69 | +### The Fix |
| 70 | + |
| 71 | +Pandoc fixed this in October 2024 (commit e01023c1f) for Typst 0.12+ compatibility. They changed from: |
| 72 | + |
| 73 | +```typst |
| 74 | +if cols == 1 { doc } else { columns(cols, doc) } |
| 75 | +``` |
| 76 | + |
| 77 | +to using `set page(columns: cols)` at page level, which allows page configuration changes anywhere in the document. This approach also requires wrapping the title block with `place(top, float: true, scope: "parent")` so it spans both columns. |
| 78 | + |
| 79 | +Quarto updated its copy of `template.typst` but missed updating the `article()` function in `typst-template.typ`, leaving the old `columns()` approach in place until this fix. |
| 80 | + |
| 81 | +| Column A | Column B | Column C | Column D | Column E | Column F | |
| 82 | +|----------|----------|----------|----------|----------|----------| |
| 83 | +| Data 1 | Data 2 | Data 3 | Data 4 | Data 5 | Data 6 | |
| 84 | +| Data 7 | Data 8 | Data 9 | Data 10 | Data 11 | Data 12 | |
| 85 | +| Data 13 | Data 14 | Data 15 | Data 16 | Data 17 | Data 18 | |
| 86 | + |
| 87 | +::: |
| 88 | + |
| 89 | +## Back to Portrait |
| 90 | + |
| 91 | +This section returns to portrait orientation with two columns. The content should continue flowing normally after the landscape section. |
| 92 | + |
| 93 | +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. |
| 94 | + |
| 95 | +Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
| 96 | + |
| 97 | +## Conclusion |
| 98 | + |
| 99 | +The document demonstrates that two-column layouts work correctly with landscape page sections when using `set page(columns:)` instead of the `columns()` function wrapper. |
0 commit comments