Documentation/Tables & Figures/How to Create Tables That Span Multiple Pages in LaTeX (longtable)
Tables & Figures

How to Create Tables That Span Multiple Pages in LaTeX (longtable)

When your data exceeds a single page, standard LaTeX tables simply get cut off or overflow. The longtable package solves this by automatically breaking your table across pages while repeating headers and footers. Bibby AI's live preview makes working with longtable effortless — you can see exactly where page breaks fall in real time, unlike Overleaf where compile times slow you down on large documents.

Set Up a Basic Longtable

Load the longtable package and replace the tabular environment with longtable. Note that longtable replaces both the table and tabular environments — you do not wrap it in a table float:

% In your preamble
\usepackage{longtable}

% In your document body
\begin{longtable}{|l|c|r|}
\caption{Experimental Results Across All Trials} \label{tab:results} \\
\hline
\textbf{Trial} & \textbf{Temperature (°C)} & \textbf{Yield (\%)} \\
\hline
\endfirsthead

\multicolumn{3}{c}{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
\hline
\textbf{Trial} & \textbf{Temperature (°C)} & \textbf{Yield (\%)} \\
\hline
\endhead

\hline
\multicolumn{3}{r}{\textit{Continued on next page}} \\
\endfoot

\hline
\endlastfoot

Trial 1 & 25 & 78.3 \\
Trial 2 & 30 & 82.1 \\
Trial 3 & 35 & 85.7 \\
% ... more rows ...
Trial 50 & 100 & 91.2 \\
\end{longtable}

Understand the Four Header/Footer Regions

Longtable provides four special regions to control what appears at the top and bottom of each page. Place content between \hline commands and terminate each region with its corresponding command:

% \endfirsthead  — Header on the FIRST page only
% \endhead       — Header on every SUBSEQUENT page
% \endfoot       — Footer on every page EXCEPT the last
% \endlastfoot   — Footer on the LAST page only

\begin{longtable}{lll}
\caption{List of Abbreviations} \\
\hline
\textbf{Abbr.} & \textbf{Full Form} & \textbf{Context} \\
\hline
\endfirsthead

\hline
\textbf{Abbr.} & \textbf{Full Form} & \textbf{Context} \\
\hline
\endhead

\hline \multicolumn{3}{r}{\footnotesize Continued\ldots} \\
\endfoot

\hline
\endlastfoot

API & Application Programming Interface & Computing \\
CNN & Convolutional Neural Network & Deep Learning \\
GPU & Graphics Processing Unit & Hardware \\
% ... many more rows ...
\end{longtable}

Control Page Breaks Inside the Table

Use \pagebreak and \nopagebreak inside longtable to force or prevent breaks at specific rows. You can also use the \* command to suggest break points:

\begin{longtable}{|l|p{8cm}|}
\caption{Chapter Summaries} \\
\hline
\textbf{Chapter} & \textbf{Summary} \\
\hline
\endfirsthead
\hline
\textbf{Chapter} & \textbf{Summary} \\
\hline
\endhead
\hline
\endfoot

Chapter 1 & Introduction to the research problem and motivation. \\
\nopagebreak  % Keep the next row on the same page
Chapter 2 & Literature review covering 50 years of prior work. \\
\pagebreak   % Force a page break after this row
Chapter 3 & Methodology and experimental design. \\
Chapter 4 & Results and statistical analysis. \\
\end{longtable}

💡 Tips

  • Longtable requires multiple LaTeX compilations to calculate column widths correctly — run pdflatex at least twice.
  • You cannot use longtable inside a table float environment; longtable handles float placement itself.
  • Combine longtable with booktabs for professional-looking multi-page tables: \usepackage{booktabs} and use \toprule, \midrule, \bottomrule.
  • Bibby AI automatically handles multiple compilations, so your longtable renders correctly on the first preview — no manual re-runs needed.

Try This in Bibby AI

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

Start Writing Free

Related Tutorials

How to Create Tables That Span Multiple Pages in LaTeX (longtable) | Bibby AI