FormaTeX

\begin{tabular}

LaTeX Tables

The complete guide to LaTeX tables — from a simple tabular environment to professional layouts with booktabs, multirow cells, and precise float positioning.

\section{Quick start}

Your first LaTeX table

Every LaTeX table uses the tabular environment. Columns are separated by & and rows end with \\.

\documentclass{article}

\begin{document}

\begin{table}[h]
  \centering
  \begin{tabular}{|l|c|r|}
    \hline
    \textbf{Name} & \textbf{Score} & \textbf{Grade} \\
    \hline
    Alice & 95 & A \\
    Bob   & 82 & B \\
    Carol & 78 & C \\
    \hline
  \end{tabular}
  \caption{Student grades}
  \label{tab:grades}
\end{table}

\end{document}

\section{Column alignment}

Understanding column specifiers

The column specification string (e.g. l|c|r) controls alignment and vertical borders.

lLeft aligned

Content is flush-left. Good for text columns like names.

cCenter aligned

Content is centered. Good for short values, grades, symbols.

rRight aligned

Content is flush-right. Good for numbers and scores.

p{4cm}Fixed width

Paragraph column. Wraps content at the specified width.

\section{Borders}

Table borders

Use | in the column spec for vertical lines and \hline for horizontal rules. For publication-quality tables, use booktabs instead and avoid vertical lines entirely.

|

Vertical line between columns in the spec string

\hline

Full horizontal rule spanning all columns

\cline{2-4}

Partial rule from column 2 to column 4

\usepackage{booktabs}

Professional tables with booktabs

The booktabs package provides \toprule, \midrule, and \bottomrule — heavier rules at top and bottom, lighter in the middle, with correct spacing above and below. No vertical lines, no double rules.

\documentclass{article}
\usepackage{booktabs}

\begin{document}

\begin{table}[h]
  \centering
  \begin{tabular}{lcc}
    \toprule
    \textbf{Engine} & \textbf{Speed} & \textbf{Unicode} \\
    \midrule
    pdfLaTeX & Fast   & Via inputenc \\
    XeLaTeX  & Medium & Native \\
    LuaLaTeX & Slower & Native \\
    \bottomrule
  \end{tabular}
  \caption{LaTeX engine comparison}
\end{table}

\end{document}

\usepackage{multirow}

Multirow and multicolumn

Span cells across rows with \multirow (requires the multirow package) and across columns with \multicolumn (built-in). Use \cmidrule to draw partial horizontal rules under spanned headers.

\documentclass{article}
\usepackage{booktabs}
\usepackage{multirow}

\begin{document}

\begin{table}[h]
  \centering
  \begin{tabular}{lllr}
    \toprule
    \multirow{2}{*}{\textbf{Team}} & \multicolumn{2}{c}{\textbf{Scores}} & \\
    \cmidrule(lr){2-3}
    & Q1 & Q2 & \textbf{Total} \\
    \midrule
    Alpha & 45 & 50 & 95 \\
    Beta  & 38 & 42 & 80 \\
    \bottomrule
  \end{tabular}
  \caption{Quarterly scores}
\end{table}

\end{document}

\section{Positioning}

Float placement

The optional argument to \begin{table} hints where LaTeX should place the float. Use [H] from the float package to force the table exactly at the insertion point.

[h]

Here

Approximately here, if possible

[t]

Top

Top of the current page

[b]

Bottom

Bottom of the current page

[H]

Exact

Exactly here (requires float package)

\section{Common mistakes}

Avoid these pitfalls

Forgetting & separators

Each row must have exactly (n − 1) & separators for n columns. Too few causes a misaligned-table error; too many causes extra empty columns.

Mismatched column count

The number of columns in \begin{tabular}{spec} must match the cells in every row. LaTeX will compile but produce garbled output if they differ.

Bad float placement

Avoid [h!] or [!htbp] as a crutch. If the table lands in the wrong place, restructure your document or use \clearpage to flush all pending floats.

\section{Related guides}

Keep learning LaTeX

Explore more guides and try every example live in the FormaTeX playground.

Try these table examples live

Compile LaTeX in the browser. Free tier — no credit card required.

One quick thing

We track anonymous usage — page views, feature usage, compilation events — to understand what works and what doesn't. No ads, no personal data, no third-party sharing.

Cookie policy