diff options
| author | John MacFarlane <[email protected]> | 2024-03-20 14:25:08 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-03-20 14:25:08 -0700 |
| commit | 604f541b0ff2e521ba207991baf43c9550189736 (patch) | |
| tree | bbeece4e30227df45e206008be89072beae9dc94 /test/tables.typst | |
| parent | ebcae86cf47e3037ccc3c7146cf610e5a7af3b03 (diff) | |
Typst writer: support Typst 0.11 table features. (#9593)
* Typst writer: support Typst 0.11 table features.
- colspans
- rowspans
- cell alignment overrides
- relative column widths
- header and footer
- multiple table bodies with intermediate headers
Row heads are not yet supported.
The default typst template has been modified so that tables
don't have lines by default. As is standard with pandoc, we only
add a line under a header or over a footer. However, a different
default stroke pattern can easily be added in a template.
Closes #9588.
Diffstat (limited to 'test/tables.typst')
| -rw-r--r-- | test/tables.typst | 130 |
1 files changed, 43 insertions, 87 deletions
diff --git a/test/tables.typst b/test/tables.typst index 0eaa77600..3736a7193 100644 --- a/test/tables.typst +++ b/test/tables.typst @@ -3,20 +3,12 @@ Simple table with caption: #figure( align(center)[#table( columns: 4, - align: (col, row) => (right,left,center,auto,).at(col), - [Right], [Left], [Center], [Default], - [12], - [12], - [12], - [12], - [123], - [123], - [123], - [123], - [1], - [1], - [1], - [1], + align: (right,left,center,auto,), + table.header([Right], [Left], [Center], [Default],), + table.hline(), + [12], [12], [12], [12], + [123], [123], [123], [123], + [1], [1], [1], [1], )] , caption: [Demonstration of simple table syntax.] , kind: table @@ -27,20 +19,12 @@ Simple table without caption: #figure( align(center)[#table( columns: 4, - align: (col, row) => (right,left,center,auto,).at(col), - [Right], [Left], [Center], [Default], - [12], - [12], - [12], - [12], - [123], - [123], - [123], - [123], - [1], - [1], - [1], - [1], + align: (right,left,center,auto,), + table.header([Right], [Left], [Center], [Default],), + table.hline(), + [12], [12], [12], [12], + [123], [123], [123], [123], + [1], [1], [1], [1], )] , kind: table ) @@ -50,20 +34,12 @@ Simple table indented two spaces: #figure( align(center)[#table( columns: 4, - align: (col, row) => (right,left,center,auto,).at(col), - [Right], [Left], [Center], [Default], - [12], - [12], - [12], - [12], - [123], - [123], - [123], - [123], - [1], - [1], - [1], - [1], + align: (right,left,center,auto,), + table.header([Right], [Left], [Center], [Default],), + table.hline(), + [12], [12], [12], [12], + [123], [123], [123], [123], + [1], [1], [1], [1], )] , caption: [Demonstration of simple table syntax.] , kind: table @@ -73,17 +49,14 @@ Multiline table with caption: #figure( align(center)[#table( - columns: 4, - align: (col, row) => (center,left,right,left,).at(col), - [Centered Header], [Left Aligned], [Right Aligned], [Default aligned], - [First], - [row], - [12.0], - [Example of a row that spans multiple lines.], - [Second], - [row], - [5.0], - [Here’s another one. Note the blank line between rows.], + columns: (15%, 13.75%, 16.25%, 35%), + align: (center,left,right,left,), + table.header([Centered Header], [Left Aligned], [Right Aligned], [Default + aligned],), + table.hline(), + [First], [row], [12.0], [Example of a row that spans multiple lines.], + [Second], [row], [5.0], [Here’s another one. Note the blank line between + rows.], )] , caption: [Here’s the caption. It may span multiple lines.] , kind: table @@ -93,17 +66,14 @@ Multiline table without caption: #figure( align(center)[#table( - columns: 4, - align: (col, row) => (center,left,right,left,).at(col), - [Centered Header], [Left Aligned], [Right Aligned], [Default aligned], - [First], - [row], - [12.0], - [Example of a row that spans multiple lines.], - [Second], - [row], - [5.0], - [Here’s another one. Note the blank line between rows.], + columns: (15%, 13.75%, 16.25%, 35%), + align: (center,left,right,left,), + table.header([Centered Header], [Left Aligned], [Right Aligned], [Default + aligned],), + table.hline(), + [First], [row], [12.0], [Example of a row that spans multiple lines.], + [Second], [row], [5.0], [Here’s another one. Note the blank line between + rows.], )] , kind: table ) @@ -113,19 +83,10 @@ Table without column headers: #figure( align(center)[#table( columns: 4, - align: (col, row) => (right,left,center,right,).at(col), - [12], - [12], - [12], - [12], - [123], - [123], - [123], - [123], - [1], - [1], - [1], - [1], + align: (right,left,center,right,), + [12], [12], [12], [12], + [123], [123], [123], [123], + [1], [1], [1], [1], )] , kind: table ) @@ -134,16 +95,11 @@ Multiline table without column headers: #figure( align(center)[#table( - columns: 4, - align: (col, row) => (center,left,right,auto,).at(col), - [First], - [row], - [12.0], - [Example of a row that spans multiple lines.], - [Second], - [row], - [5.0], - [Here’s another one. Note the blank line between rows.], + columns: (15%, 13.75%, 16.25%, 35%), + align: (center,left,right,auto,), + [First], [row], [12.0], [Example of a row that spans multiple lines.], + [Second], [row], [5.0], [Here’s another one. Note the blank line between + rows.], )] , kind: table ) |
