English | 简体中文
A VSCode extension that automatically converts RTF or CSV tables from the clipboard to Typst table syntax. Ideal for regression tables, academic papers, and quick table reuse in Typst.
- Copy a table from Excel, Word, or a CSV source.
- In a
.typfile, pressCtrl+Shift+V(orCmd+Shift+V). - A table file is saved to
typ_tables/, and a reference is inserted at the cursor. - You can edit the table file separately to keep your main file clean.
Note: Use Ctrl+Shift+V instead of Ctrl+V to avoid conflicts with other paste extensions (like typst-figure-pastetools).
- Press
Ctrl+Shift+P(orCmd+Shift+P) to open the command palette. - Type "Typst Table Paste: Convert From File".
- Select one or more CSV, Excel, or RTF files to import.
- For Excel files with multiple sheets, choose which sheet(s) to convert.
- Tables are saved to
typ_tables/using source filenames (e.g.,data.csv→data.typ).
Note on RTF files: RTF table conversion may not be perfect for all tables. For best results, export to CSV/Excel format first. If you encounter conversion issues, please submit an issue on GitHub.
Rename table files with automatic reference updates:
- In editor: Press
Shift+F2on include statement line or right-click → "Rename Table File" - In explorer: Right-click
.typfile intyp_tables/→ "Rename Typst Table"
All references are automatically updated across workspace.
Round numbers in existing .typ table files to a specified number of decimal places:
- In editor: Open a
.typfile, then use command palette → "Typst Table Paste: Round Numbers in Table" - In explorer: Right-click any
.typfile → "Round Numbers in Table" - Choose to overwrite the original file or save as a new file
- Supports multiple number formats:
- Normal numbers:
0.123456→0.123 - Scientific notation:
1.23456e-5→1.235e-5 - Percentages:
12.3456%→12.346% - Parentheses:
(0.045678)→(0.046) - Typst syntax:
0.123456#super[***]→0.123#super[***]
- Normal numbers:
- Configure decimal places in settings (default: 3)
- RTF/CSV/Excel table detection and conversion
- Supports Word RTF, Stata RTF, CSV, and Excel formats
- Automatic table structure detection
- Preserves borders, alignment, and formatting
- Preserve significance markers, borders, and alignment
- Automatic layout for small vs. large tables (≤5 columns: compact, >5 columns: expanded)
- Smart file naming from source filenames (e.g.,
data.csv→data.typ) - Rename tables with automatic reference updates (Shift+F2)
- Auto-number duplicate filenames (e.g.,
data.typ,data_1.typ,data_2.typ) - Round numbers in tables: Process existing
.typfiles to round numbers to specified decimal places
- Three-line table format and automatic divider insertion (optional)
- Automatic math mode conversion for variable names and R² (optional)
- Interaction term formatting (
*→times) - Greek letter recognition
- File path detection from clipboard (supports Windows/Unix paths, quoted paths, file:// URIs)
- Panel system for multiple CSV file imports
- Clone or download this project
- Run in the project directory:
npm install npm run compile
- Press
F5in VSCode to start debugging mode
Search for "Typst Table Paste" in the VSCode extension marketplace.
="",="(1)",="(2)",="(3)"
="Variable",="Coef",="SE"
="X1",="0.05***",="0.01"Small table (3 columns):
#table(
columns: (auto, 1fr, 1fr),
align: (left, center, center),
[], [(1)], [(2)],
[Variable], [Coef], [SE],
[X1], [0.05#super[\*\*\*]], [0.01],
)Large table (7 columns):
#table(
columns: (auto, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr),
align: (left, center, center, center, center, center, center),
[],
[(1)],
[(2)],
[(3)],
[(4)],
[(5)],
[(6)],
[Variable],
[Coef1],
[Coef2],
[Coef3],
[Coef4],
[Coef5],
[Coef6],
)When autoMathMode is enabled:
Input (CSV):
Variable,(1),(2)
log_gdp,0.45***,0.52***
gdp_growth,0.12*,0.15**
alpha * beta,0.08,0.10
ln(population),0.23**,0.25**Output (Typst):
#table(
columns: (auto, 1fr, 1fr),
align: (left, center, center),
[Variable], [(1)], [(2)],
[$log_"gdp"$], [0.45#super[\*\*\*]], [0.52#super[\*\*\*]],
[$"gdp"_"growth"$], [0.12#super[\*]], [0.15#super[\*\*]],
[$alpha times beta$], [0.08], [0.10],
[$ln("population")$], [0.23#super[\*\*]], [0.25#super[\*\*]],
)When threeLineTable is enabled:
#table(
columns: (auto, 1fr, 1fr),
align: (left, center, center),
stroke: none,
table.hline(),
[], [(1)], [(2)],
table.hline(stroke: 0.5pt),
[Variable], [Coef], [SE],
[X1], [0.05#super[\*\*\*]], [0.01],
table.hline(),
)You can customize how table references are inserted using the includeTemplate setting:
Default:
"typstTablePaste.includeTemplate": "#figure(include \"{path}\")"With caption:
"typstTablePaste.includeTemplate": "#figure(include \"{path}\", caption: [Table])"Simple include:
"typstTablePaste.includeTemplate": "#include \"{path}\""Custom wrapper:
"typstTablePaste.includeTemplate": "#block(include \"{path}\")"- Standard CSV: Comma-separated, e.g.,
Header1,Value1,Value2 - Equals-separated CSV: Using
="value"format, e.g.,="Header1",="Value1"
- Excel files:
.xlsx,.xls,.xlsmformats - Multiple sheets: Choose specific sheets or convert all sheets
- Automatic data extraction: Extracts formatted values from cells
- Tables copied from Microsoft Word
- Tables copied from Microsoft Excel
- Tables copied from other applications that support RTF format
- Tables copied directly from Stata console output
- Basic table structure detection and conversion
- Note: This is an experimental feature. For complex tables, it's recommended to export the table to CSV or Excel first for better results.
Search for "Typst Table Paste" in VSCode settings.
| Setting | Default | Description |
|---|---|---|
typstTablePaste.autoConvert |
true |
Automatically convert tables when pasting |
typstTablePaste.preserveSuperscript |
true |
Preserve significance markers as superscript |
typstTablePaste.preserveBorders |
true |
Preserve table border styles |
typstTablePaste.preserveAlignment |
true |
Preserve table alignment |
typstTablePaste.threeLineTable |
false |
Use three-line table format (top, header bottom, bottom lines only) |
typstTablePaste.autoMathMode |
false |
Automatically convert variable names and R² to math mode |
typstTablePaste.mathModeExclusions |
["Constant", "Controls", "Observations", "N", "Fixed Effects", "Year FE", "Firm FE", "Industry FE", "Country FE"] |
Terms to exclude from math mode conversion |
typstTablePaste.addDividerAfterConstant |
false |
Add a divider after the Constant row |
typstTablePaste.tableFolder |
"typ_tables" |
Folder name for saving table files |
typstTablePaste.includeTemplate |
"#figure(include \"{path}\")" |
Template for table references |
typstTablePaste.promptForTableName |
false |
Prompt for table filename when pasting from clipboard or importing from file |
typstTablePaste.roundingDecimalPlaces |
3 |
Number of decimal places for rounding numbers in tables (0-10) |
Example settings.json:
{
"typstTablePaste.autoConvert": true,
"typstTablePaste.threeLineTable": false,
"typstTablePaste.addDividerAfterConstant": false,
"typstTablePaste.autoMathMode": false,
"typstTablePaste.tableFolder": "typ_tables",
"typstTablePaste.includeTemplate": "#figure(include \"{path}\")",
"typstTablePaste.roundingDecimalPlaces": 3
}- Nothing happens on paste: Make sure the active file is
.typ, and tryCtrl+Shift+V. Check for keybinding conflicts. - Conflicts with other paste extensions: Prefer
Ctrl+Shift+V, or remap the shortcut to avoid collisions. - R² or variables not in math mode: Enable
typstTablePaste.autoMathModeand ensure the term is not inmathModeExclusions. - Change output folder: Set
typstTablePaste.tableFolderto a custom path. - Cannot import RTF files directly: RTF files can only be processed from clipboard (copy from Word/Excel). Use "Convert from File" only for CSV files.
Clipboard data is processed locally in VSCode and is not sent over the network.
git clone https://github.com/leichaoL/typst-table-paste.git
cd typst-table-paste
npm installnpm run compilePress F5 in VSCode to start debugging.
npm install -g @vscode/vsce
vsce package- Stata console tables: Experimental support available. Simple tables work well, but complex tables may not convert perfectly. For best results, export tables to CSV/Excel format first.
See CHANGELOG.md for version history.
MIT License - see LICENSE for details.
