LaTeX Tables Generator
How to use the LaTeX tables generator?
- Enter the data. Copy cells from a spreadsheet (Excel,
Google Sheets, LibreOffice Calc) or a table on a web page, click a cell and
press Ctrl+V: the table grows to fit them. Or click a cell and type: typing
replaces its text, while a double click or Enter edits the text that is
there (Esc or a click elsewhere ends the edit). Tab and the arrow keys move
to the next cell. Add and remove rows and columns with the Row and
Column menus, or by right-clicking a cell. You can also import an
Excel workbook or a CSV file with File / Import CSV or Excel
file.
- Format it. Select cells by clicking them,
by dragging over them or with Shift and the arrow keys (Ctrl+click adds
a cell), then
merge them, align their text, make it bold or italic and add or remove
borders with the toolbar and the Table and Cell menus.
- Copy the code. The table's LaTeX code appears under
the editor as you edit: click Copy to clipboard and paste
it into your document. The options under the code set its style,
caption, placement and width; the packages the table needs are named in
a comment at its top.
To edit a table you already have in LaTeX, paste its code in
File / From LaTeX code.
Standard or booktabs style?
For more professional looking tables, try the
booktabs style
(Style: Booktabs in the options under the code). Its tables
look like those in books and scientific articles:
- no vertical rules,
- more space above and below the horizontal rules,
- a thicker rule at the top and the bottom of the table than between
its rows, and no double rules.
The table's horizontal borders become the rules: the top border
\toprule, the bottom one \bottomrule and the
others \midrule (\cmidrule under some columns
only). So give the table a top and a bottom border, e.g. with
Table / Add horizontal borders.
Long text in a column
A column is as wide as its longest text. To wrap its text, give the column a
width: drag the right edge of its header above the table, or right-click the
header and choose Set column width (double-click the edge to
make the column as wide as its text again). It becomes a p{}
column of that width. To make the table as wide as the text on the page,
choose Width: Wrap to text width in the options: the
columns with a width share what the other columns leave of it (a
tabularx table). Scaling the table to the text width shrinks its
text too, which most style guides advise against.
Special characters and LaTeX commands
Characters with a special meaning in LaTeX, such as %,
&, _, # or $, are
escaped, so the cells print as typed. To write LaTeX in the cells, e.g. math
($x^2$) or \cite{key}, choose
Cell text: LaTeX code in the options.