Typst Table Generator
Build your table in the grid, with header rows or merged cells where you need them, then copy the `#table(...)` code into your Typst document.
- Markdown table generator
- HTML table generator
- CSV table generator
- LaTeX table generator
- JSON table generator
- SQL table generator
- MediaWiki table generator
- Plain Text table generator
- reStructuredText table generator
- Balsamiq table generator
- Mathematica table generator
- YAML table generator
- AsciiDoc table generator
How to create your table
- Choose a table size, then type in the grid or paste cells from a spreadsheet.
- Turn on a header row, merge cells where needed, and set column alignment with Format › Align.
- Copy the
#table(...)code into your Typst document.
Example output
#table(
columns: 3,
align: (left, right, right),
stroke: none,
table.header(
[*Item*], [*Qty*], [*Price*],
),
[Widget], [4], [3.00],
[Gadget], [12], [5.50],
table.hline(y: 0),
table.hline(y: 1),
table.hline(y: 3),
)
Typst table syntax
A Typst table is a call to #table. The columns argument sets the number of columns, and the cells follow as content blocks in square brackets. Typst fills the cells row by row, left to right, so you do not mark where a row ends.
Inside a cell you can use normal Typst markup, such as *bold*, _italic_ or $x^2$ for math.
#table(
columns: 2,
[Name], [Role],
[Ada], [Engineer],
[Grace], [Admiral],
)
Column widths and alignment
columns also takes an array of widths: (auto, 1fr, 1fr) makes the first column as wide as its content and shares the remaining space between the other two. The editor writes the column count. Once you set a column width, Table width or Distribute columns, it writes one width per column instead, in pt, fr or auto depending on those settings.
align takes one value for every cell, or an array with one value per column, such as (left, right, right). In the editor, select a whole column and choose Format › Align, and the output gets the matching align array.
Header rows that repeat on every page
Rows wrapped in table.header(...) are the table header. Typst repeats them at the top of each page when a table breaks across pages, which is on by default (repeat: true). Screen readers and PDF tags also treat them as headers. The editor puts your header rows in table.header and makes their text bold.
Merged cells
table.cell(colspan: 2)[...] spans two columns and table.cell(rowspan: 2)[...] spans two rows. You leave out the cells a merge covers, and Typst flows the rest around it. When you merge cells in the editor, it writes the table.cell calls for you.
Lines and shading
By default every cell has a 1 pt black border. stroke: none removes all lines, and table.hline() and table.vline() add single lines where you place them. For striped rows, give fill a function of the cell position, as in the example below.
The editor writes the borders you set with Format › Borders. With every border on, it keeps Typst's default grid. Otherwise it sets stroke: none and draws your borders with table.hline() and table.vline(), as in the example above, where lines above and below the header and at the bottom give a booktabs-like look. Fill colours are not exported; add fill by hand.
#table(
columns: 2,
stroke: none,
fill: (_, y) => if calc.odd(y) { luma(240) },
table.hline(),
[Item], [Qty],
table.hline(),
[Widget], [4],
[Gadget], [12],
table.hline(),
)
Captions and references
To number a table and give it a caption, wrap it in a figure and add a label. Inside figure(...) you write table(...) without the #, because the arguments are already code.
#figure(
table(
columns: 2,
[Item], [Qty],
[Widget], [4],
),
caption: [Stock count],
) <stock>
See @stock for the numbers.
Moving tables from LaTeX to Typst
tabular becomes #table, \multicolumn becomes table.cell(colspan: ...) and \hline becomes table.hline(). For a booktabs-like look, set stroke: none and add table.hline() above the header, under it and at the end.
You can also paste a LaTeX tabular into the editor, or import it with File › Import, and copy it back out as Typst. The same works for Excel, CSV and Markdown tables, and for Typst tables you want to change.
What the editor can do
- Merge and split cells
- Paste cells from Excel, Google Sheets or an HTML table
- Import CSV, TSV, Excel (
.xlsx), OpenDocument (.ods), Markdown, HTML, LaTeX, Typst, JSON, MediaWiki and plain text tables - Copy the table as one of 14 text formats, or download it as an Excel, OpenDocument or Word (
.docx) file - Header rows and columns, borders, and bold, italic and alignment per cell
- Number formats for numbers, percentages and currencies
- Checkboxes, and one link per cell. Links stay links in Markdown, HTML, LaTeX, Typst, Excel, Word and the other formats that have them
- Sort, transpose, fill down or right, and find and replace with regular expressions
- Undo and redo, keyboard shortcuts and a command palette (
Alt+Q) - Save tables in the browser, reopen recent tables and share a table as a link
- Also available as a Windows app
Table Editor for Windows
The same editor as a Windows app, with what a browser tab can't do.
- Tabs. Keep several tables open at once. Tabs with unsaved changes come back when you start the app again.
- Your own files. Open Excel, CSV, Markdown, LaTeX and other files directly, also from Windows Explorer, and save back to the same file.
- Offline, without ads. Works without an internet connection. No ads, no analytics, and nothing leaves your computer.
A one-time purchase in the Microsoft Store.
Frequently asked questions
- How do I create a table in Typst?
- Call
#table(...)with acolumnsargument and the cell contents in square brackets, as in the example above. You can also fill in the grid and copy the code the editor writes. - Can I merge cells in a Typst table?
- Yes. Select the cells and merge them in the editor. The code uses
table.cellwithcolspanorrowspanfor the merged cells. - How do I align columns?
- Select a whole column and choose Format › Align. The code then gets an
alignarray with one value per column, such asalign: (left, right, right). - Are borders exported?
- Yes. With every border on, the code keeps Typst's default grid. With some borders, it sets
stroke: noneand draws each line withtable.hline(y: ...)ortable.vline(x: ...), withstartandendfor lines that cover only part of the table. - How do I make a matrix?
- Choose a matrix under Table type in the output panel menu (⋮): mat [ ], mat ( ), mat { }, mat | |, mat ‖ ‖ or mat without brackets. The table is written as
$ mat(delim: "[", a, b; c, d) $, and each cell as math, soa_1orfrac(1, 2)work as typed. A cell that is not math Typst knows, such as a word, is written as a string in quotes. A vertical border through every row, or a horizontal one through every column, is written asaugment:. File › Import readsmat(...)too. - Can I import an existing Typst table?
- Yes. Paste a
#table(...)into File › Import, or open a.typfile. The editor reads the cells,table.header,table.cellspans and alignment, thealignarray, bold and italic text, line breaks, links and the borders, also from a table inside afigure. Other arguments, such asfillorinset, are skipped. - How are header rows exported?
- Header rows are wrapped in
table.header(...), which Typst repeats on every page. Their text, and the text in header columns, is made bold unless you turn off Bold headers in the output panel menu. - Are special characters in cells escaped?
- Yes. Characters that mean something in Typst markup, such as
#,$,*,_,@,<and//, are escaped, and so are=,-and+at the start of a cell, which would start a heading or a list. A cell then shows exactly what you typed. Line breaks in a cell become#linebreak(). Math and code you type are not escaped (see the next question). The export is tested against the Typst compiler. - Can I use Typst math and code in cells?
- Yes. With Keep Typst math and code on (the default, in the output panel menu ⋮), math such as
$x^2$or$sqrt(2)$and calls such as#emph[...],#text(fill: red)[...]or#link("https://example.com")[...]are written as you typed them, and the rest of the cell is escaped. Typst stops at the first error, so only math with names Typst knows and a few text functions with arguments the editor can check are kept; anything else is escaped. A dollar sign in a price, as in$5 and $10, stays text. Importing Typst keeps that math and those calls as written. Turn the setting off to escape everything. - What happens to links and checkboxes?
- A link is written as
#link("https://example.com")[text], or as#link("https://example.com")when the cell holds only the address. Importing Typst reads#linkback as the cell's link when it covers the whole cell. A checkbox (Format › Number format › Checkbox) is written as✓when it is checked and as an empty cell when it is not. The Checkboxes as setting in the output panel menu (⋮) changes that to Yes and No, or true and false.