How to Make a Table in LaTeX
A table in LaTeX is built with the tabular environment. Give one letter per column (l, c or r for left, center, right), separate cells with & and end each row with \\.
\begin{tabular}{l c r}
Name & Age & Score \\
Alice & 24 & 91.5 \\
Bob & 31 & 78.0 \\
\end{tabular}Full document you can compile
\documentclass{article}
\begin{document}
\begin{tabular}{l c r}
Name & Age & Score \\
Alice & 24 & 91.5 \\
Bob & 31 & 78.0 \\
\end{tabular}
\end{document}How does the column specification work?
The argument after \begin{tabular} lists the columns: {l c r} makes three, aligned left, center and right. Every row needs the same number of cells. One & too many stops the compile with ! Extra alignment tab has been changed to \cr.
How do you add lines and borders?
Put | between column letters for vertical lines and \hline between rows for horizontal ones. |l|c|r| with \hline at the top, after the header and at the bottom gives a fully boxed table.
\begin{tabular}{|l|c|r|}
\hline
Name & Age & Score \\
\hline
Alice & 24 & 91.5 \\
Bob & 31 & 78.0 \\
\hline
\end{tabular}Full document you can compile
\documentclass{article}
\begin{document}
\begin{tabular}{|l|c|r|}
\hline
Name & Age & Score \\
\hline
Alice & 24 & 91.5 \\
Bob & 31 & 78.0 \\
\hline
\end{tabular}
\end{document}How do you center a table in LaTeX and add a caption?
Wrap the tabular in a table environment, then add \centering, \caption{…} and \label{…}. LaTeX numbers the caption, and \ref prints that number anywhere in the text. Put \label after \caption, or the reference points at the wrong counter.
Table~\ref{tab:scores} lists the results.
\begin{table}[h]
\centering
\caption{Test scores by student}
\label{tab:scores}
\begin{tabular}{l c r}
Name & Age & Score \\
Alice & 24 & 91.5 \\
Bob & 31 & 78.0 \\
\end{tabular}
\end{table}Full document you can compile
\documentclass{article}
\begin{document}
Table~\ref{tab:scores} lists the results.
\begin{table}[h]
\centering
\caption{Test scores by student}
\label{tab:scores}
\begin{tabular}{l c r}
Name & Age & Score \\
Alice & 24 & 91.5 \\
Bob & 31 & 78.0 \\
\end{tabular}
\end{table}
\end{document}Why does a table in LaTeX move away from where I put it?
table is a float: LaTeX may move it to the top of the page or the next page to avoid a large gap. [h] asks for "here" but is only a request. Use [ht] to give LaTeX another option, or load the float package and write [H] to fix the position.
What do professional tables look like?
Journals usually prefer the booktabs package: three horizontal rules of different weights and no vertical lines. Replace \hline with \toprule, \midrule and \bottomrule.
\begin{tabular}{l c r}
\toprule
Name & Age & Score \\
\midrule
Alice & 24 & 91.5 \\
Bob & 31 & 78.0 \\
\bottomrule
\end{tabular}Needs \usepackage{booktabs} in the preamble.
Full document you can compile
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{l c r}
\toprule
Name & Age & Score \\
\midrule
Alice & 24 & 91.5 \\
Bob & 31 & 78.0 \\
\bottomrule
\end{tabular}
\end{document}How do you wrap long text in a cell?
Columns of type l, c and r never wrap, so long text runs off the page. Use p{5cm} for a column of fixed width; the text breaks into lines inside it.
\begin{tabular}{|l|p{5cm}|}
\hline
Term & Meaning \\
\hline
Float & A box LaTeX may move to the top of
a page or the next page to avoid gaps. \\
\hline
\end{tabular}Full document you can compile
\documentclass{article}
\begin{document}
\begin{tabular}{|l|p{5cm}|}
\hline
Term & Meaning \\
\hline
Float & A box LaTeX may move to the top of
a page or the next page to avoid gaps. \\
\hline
\end{tabular}
\end{document}How do you merge cells in a LaTeX table?
\multicolumn{2}{c|}{…} spans two columns and needs no package. Spanning rows needs multirow: \multirow{2}{*}{…}, with the cells below left empty. \cline{2-3} draws a line under columns 2 to 3 only. For a grid of numbers inside a formula, use a matrix instead of a table.
\begin{tabular}{|l|c|c|}
\hline
& \multicolumn{2}{c|}{Score} \\
\cline{2-3}
Name & Test 1 & Test 2 \\
\hline
\multirow{2}{*}{Alice} & 91 & 88 \\
& 85 & 90 \\
\hline
\end{tabular}Needs \usepackage{multirow} in the preamble.
Full document you can compile
\documentclass{article}
\usepackage{multirow}
\begin{document}
\begin{tabular}{|l|c|c|}
\hline
& \multicolumn{2}{c|}{Score} \\
\cline{2-3}
Name & Test 1 & Test 2 \\
\hline
\multirow{2}{*}{Alice} & 91 & 88 \\
& 85 & 90 \\
\hline
\end{tabular}
\end{document}Is there a faster way than typing & and \\?
Yes. The LaTeX table generator turns cells you type or paste from Excel into tabular code, with booktabs and merged cells. To show the result on a web page, the free LaTeX to HTML tool turns tabular into an HTML table. Lists that don't need columns are simpler as bullet points. Two tables next to each other work like subfigures, with subtable.
Sources
- LaTeX2e: An unofficial reference manual, tabular, read Nov 28, 2026
- booktabs package documentation (CTAN), read Nov 28, 2026
- multirow package documentation (CTAN), read Nov 28, 2026
Text drafted with AI from the cited documentation; every example compiled with TeX Live 2026; checked by Cem Demir. See the editorial policy.