Documentation/Tables & Figures/How to Insert Tables in LaTeX
Tables & Figures

How to Insert Tables in LaTeX

Inserting a table in LaTeX is a two-step idea: build the grid with tabular (or longtable), then optionally wrap it in a table environment so it floats, gets a caption, and can be cross-referenced. This guide walks through the patterns researchers use every day.

Insert a Simple Table in the Document Flow

Use tabular when the table should appear exactly where you type it (no float):

\noindent
\begin{tabular}{lcc}
\hline
Model & Accuracy & F1 \\
\hline
Baseline & 0.81 & 0.76 \\
Ours & 0.89 & 0.84 \\
\hline
\end{tabular}

Insert a Floating Table with Caption

Wrap tabular in table so LaTeX can move it to a sensible page and you can reference it:

\begin{table}[htbp]
  \centering
  \caption{Comparison of methods on the validation set.}
  \label{tab:results}
  \begin{tabular}{lcc}
    \toprule
    Method & Accuracy & F1 \\
    \midrule
    Baseline & 0.81 & 0.76 \\
    Ours & 0.89 & 0.84 \\
    \bottomrule
  \end{tabular}
\end{table}

See Table~\ref{tab:results} for the full comparison.

Insert Wide or Multi-Page Tables

Use tabularx for flexible width, or longtable when a table spans pages:

\usepackage{tabularx}
\usepackage{booktabs}

% Flexible width table
\begin{tabularx}{\textwidth}{lXX}
  \toprule
  Feature & Description & Notes \\
  \midrule
  Speed & Fast inference & GPU recommended \\
  Memory & Low footprint & Runs on CPU \\
  \bottomrule
\end{tabularx}

% Multi-page table (requires \usepackage{longtable})
% \begin{longtable}{lcc} ... \end{longtable}

Insert Tables from CSV or a Visual Editor

For large datasets, generate LaTeX instead of typing every row by hand:

% 1. Export spreadsheet as CSV
% 2. Use Bibby's CSV → LaTeX tool at /csv-to-latex
% 3. Or use the table generator at /table-generator-latex

\begin{table}[htbp]
  \centering
  \caption{Participant demographics}
  \label{tab:demo}
  % paste generated tabular code here
\end{table}

💡 Tips

  • Load \usepackage{booktabs} for publication-quality rules (\toprule, \midrule, \bottomrule)
  • Placement letters: h (here), t (top), b (bottom), p (float page) — combine as [htbp]
  • Never use vertical lines in academic tables; use column spacing and booktabs instead
  • If a table is too wide, try \small, resizebox, or rotate with the rotating package

Try This in Bibby AI

Write LaTeX faster with AI auto-complete and instant compilation.

Start Writing Free

Need help with your bibliography or citations?

Book a Free Call

Related Tutorials

How to Insert Tables in LaTeX | Bibby AI