Skip to content

LaTeX Table Generator

Paste a CSV or TSV — or type into a grid — and get a LaTeX table ready for your paper: column alignment, booktabs rules, a caption and label in a table float, threeparttable notes, and every special character escaped. The packages it needs are listed for your preamble. Runs in your browser. Free, no sign-up.

Data

Structure

Float, caption and notes

Paste data or fill in the grid to generate the table — or load the example.

How to Use the LaTeX Table Generator

  1. 1. Add your data. Paste rows copied from Excel, Google Sheets or a CSV file — commas, semicolons and tabs are detected — or switch to the grid and type. Load the example fills in a small results table.
  2. 2. Check the structure. Leave First row is a header ticked to rule off a header row. Columns of numbers are right-aligned automatically; change any column's alignment from its menu.
  3. 3. Choose the rules. Booktabs gives the clean three-rule look most journals use, Horizontal lines uses plain \hline, and Full grid adds vertical lines as well.
  4. 4. Add a caption, label and notes. A caption and label need the table float. Notes go under the table with threeparttable, which keeps them as wide as the table itself.
  5. 5. Copy the code and the preamble lines. The \usepackage lines belong before \begin{document}; the table goes where you want it in the text.

What the Generated Code Does, Line by Line

Load the example produces a table of two group means with the default settings. Reading its code from the top:

LaTeXWhat it does
\begin{table}[htbp]Opens a float. htbp lets LaTeX put it here, at the top or bottom of a page, or on a page of floats — wherever it fits best.
\centeringCentres the table. Inside a float, use this rather than the center environment, which adds extra vertical space.
\begin{threeparttable}Holds the caption, table and notes together so the notes wrap at the table's width. It appears only when you add notes.
\caption{Descriptive statistics by group}The numbered title — “Table 1: Descriptive statistics by group” in the standard classes.
\label{tab:descriptives}A name for cross-references: \ref{tab:descriptives} prints the table's number. It must come after \caption.
\begin{tabular}{lrr}Three columns: left-aligned text, then two right-aligned columns of numbers.
\toprule, \midrule, \bottomruleBooktabs rules: heavier above and below the table, lighter under the header, each with a little space around it.
Group & Mean & SDA row. & separates the cells and a double backslash ends the row; the next two rows hold the data.
\begin{tablenotes}The notes block: \small, then one \item per line you typed — here, Scores range from 1 to 7.

The preamble needs \usepackage{booktabs} for the rules and \usepackage{threeparttable} for the notes. Choose plain lines and drop the notes, and the table compiles with no extra packages at all.

Special Characters and Escaping

A stray & or % in a cell is the commonest reason a pasted table will not compile: & starts a new cell, and % turns the rest of the line into a comment. With escaping on, the ampersand, percent sign, dollar sign, hash, underscore and both braces get a backslash in front — \&, \%, \$, \#, \{, \} — and the tilde, caret and backslash become \textasciitilde{}, \textasciicircum{} and \textbackslash{}, because a backslash before a tilde or caret is an accent command rather than the character.

Three more characters are converted for safety. In LaTeX's original OT1 font encoding, < and > print as ¡ and ¿ and | prints as an em dash, so they become \textless{}, \textgreater{} and \textbar{}. Untick Escape special characters when your cells already contain LaTeX — math such as $p < .05$, or commands such as \textit{…} — and the text passes through unchanged.

Why booktabs?

The booktabs manual's advice is to never use vertical rules and never use double rules, and most journal templates follow it. Its rules also add space above and below, so text never touches a line. If your template or instructor wants a boxed table, choose Full grid instead.

Frequently Asked Questions

Which LaTeX packages does a generated table need?
Only what its features use, and the tool lists them under the code: booktabs for booktabs rules, threeparttable for notes, and float if you choose the H placement. A table with plain \hline rules and no notes needs nothing beyond standard LaTeX.
Why does my table appear on a different page?
A table is a float, and LaTeX moves floats to where they fit without leaving large gaps. htbp gives it the most freedom; adding ! relaxes LaTeX's limits on how much of a page floats may fill. H, from the float package, pins the table exactly where it is written, at the cost of possible blank space above it.
How do I refer to the table in my text?
Keep the \label after the \caption and write Table~\ref{tab:descriptives}; the tilde keeps “Table” and the number on one line. With the hyperref package, \autoref{tab:descriptives} writes the word “Table” for you and links to it.
How do I line numbers up on the decimal point?
Load the siunitx package and use its S column type instead of r, for example \begin{tabular}{lSS}. Setting S[table-format=1.2] reserves room for one digit before the point and two after. Header cells in an S column then need braces, such as {Mean}, so they are not read as numbers.
Can I merge cells?
Not in the generator, but it is quick by hand: \multicolumn{2}{c}{Treatment} spans two columns and is built into LaTeX, and \multirow from the multirow package spans rows. Booktabs' \cmidrule{2-3} draws a short rule under a heading that spans columns 2 and 3.
How do I make a wide table fit the page?
Put \small or \footnotesize just before \begin{tabular}, narrow the space between columns with \setlength{\tabcolsep}{4pt} (the default is 6pt), or let a text column wrap by giving it a width, such as p{4cm}. For very wide tables, the pdflscape or rotating package turns the page sideways.
Does the code work in Overleaf?
Yes. Paste the \usepackage lines into the preamble of your main .tex file and the table into the body. Booktabs, threeparttable and float are all part of the standard TeX Live distribution that Overleaf uses.

Related Tools

More in Data, Markup & Code

See all Data, Markup & Code