Convert Markdown to LaTeX Online
Convert a Markdown table into a LaTeX tabular. The table is read in your browser and never uploaded.
Drop a CSV or Excel file here
CSV · XLSX · XLS · XLSM · XLSB
Ready to download as a binary file.
How to convert a Markdown table to LaTeX
Three steps from features.md to LaTeX.
1. Paste the table
Paste a Markdown pipe table or drop a .md file.
2. Check it in the grid
Replace Markdown formatting with plain text in the grid; LaTeX would print the markers literally.
3. Choose environment and rules
tabular or longtable, booktabs rules or grid lines, alignment and escaping; copy the code or download data.tex.
Example: Markdown in, LaTeX out
A feature comparison with dollar signs and an escaped pipe.
| Feature | Free | Pro |
| :------ | :---: | :---------: |
| Price | $0 | $12 |
| Login | Email | SSO \| SAML |\begin{tabular}{|l|l|l|}
\hline
Feature & Free & Pro \\
\hline
Price & \$0 & \$12 \\
Login & Email & SSO | SAML \\
\hline
\end{tabular}$0 and $12 are written as \$0 and \$12. The | in SSO | SAML is not escaped; with LaTeX's default OT1 font encoding it prints as a dash, so add \usepackage[T1]{fontenc} or write \textbar{} in that cell.
What changes between Markdown and LaTeX
Environment
You get a tabular with the column spec {|l|l|l|} and \hline rules, one line per row ending in \\. Choose longtable for tables that run over several pages (needs \usepackage{longtable}). There is no table float, so add \begin{table} and \caption yourself.
Escaping
& % $ # _ { } ~ ^ are escaped, so the value $0 is written as \$0. Untick Escape special chars only when the cells already contain LaTeX, such as math in $...$.
Header and separator
The row above the separator line becomes the header (Feature, Free and Pro). The separator is dropped, along with its alignment colons.
When to convert Markdown to LaTeX
- Moving a table drafted in Markdown notes into a LaTeX paper.
- Converting tables when porting documentation from Markdown to LaTeX.
Markdown to LaTeX in JavaScript
A pipe table is easy to split by hand. Then special characters are escaped and cells joined with &.
import { readFile } from 'node:fs/promises';
const lines = (await readFile('features.md', 'utf8')).split('\n').filter((l) => l.includes('|'));
const cells = (line) => line.trim().replace(/^\||\|$/g, '')
.split(/(?<!\\)\|/).map((c) => c.trim().replace(/\\\|/g, '|'));
const header = cells(lines[0]);
const rows = lines.slice(2).map(cells); // lines[1] is the separator
const map = { '\\': '\\textbackslash{}', '~': '\\textasciitilde{}', '^': '\\textasciicircum{}' };
const esc = (v) => String(v ?? '').replace(/[\\&%$#_{}~^]/g, (c) => map[c] ?? '\\' + c);
const line = (cells) => cells.map(esc).join(' & ') + ' \\\\';
console.log([`\\begin{tabular}{|${header.map(() => 'l').join('|')}|}`, '\\hline', line(header), '\\hline',
...rows.map((row) => line(header.map((_, i) => row[i]))), '\\hline', '\\end{tabular}'].join('\n'));Like this page, the split skips the separator line and honours escaped pipes.
Frequently asked questions
Is the alignment from the Markdown separator kept?
No; the colons are dropped when the table is read. Choose one alignment in the Align menu, or edit the column spec by hand, for example {|l|r|c|l|}.
Can **bold** become \textbf{}?
Not automatically. Replace **bold** with \textbf{bold} in the grid and untick Escape special chars, or let Pandoc convert the whole document.
What if a row has fewer cells than the header?
It is read as it is, and the missing cells at the end of the row are left empty in the output.
Can I use the table in a Beamer slide?
Yes. Paste the tabular inside a frame. For a wide table on a slide, put \small or \footnotesize before it.
Does features.md get uploaded when I convert it to LaTeX?
No. The table is read in your browser and never uploaded.