Long table in LaTeX: break it across pages
To make a long table in LaTeX that breaks across pages, load the longtable package and replace the table and tabular environments with a single longtable. Put the caption and column headings at the top and end them with \endfirsthead, repeat the headings for later pages before \endhead, set the bottom of each page with \endfoot and of the last page with \endlastfoot, then compile until the "Table widths have changed" warning stops.
- In the preamble, add
\usepackage{longtable}, plus\usepackage{booktabs}for the rules and\usepackage{caption}so the caption is as wide as a normal table caption. - Delete
\begin{table}and\end{table}, and change\begin{tabular}{…}to\begin{longtable}{…}. Don't wrap it in a float: a longtable insidetablecan't break. - Inside it, write
\caption{…}\label{tab:…}\\, the headings, then\endfirsthead; the headings again for later pages, then\endhead; a rule for the bottom of every other page, then\endfoot; and the closing rule, then\endlastfoot. The rows follow. - Compile until the log no longer says
Table widths have changed. Rerun LaTeX.Three runs did it in every test on this page.
01Turn a table into a longtable
A normal LaTeX table can never break across pages: the table environment is a float, and LaTeX moves a float whole to a page where it fits, as I explain in my guide to LaTeX tables. A table longer than the page just runs off the bottom. The longtable package replaces both environments with one that LaTeX's normal page breaking can split between rows, keeps the column widths the same on every page, and repeats a head and foot you define (longtable documentation). It is part of LaTeX's required tools bundle, so every TeX distribution and Overleaf already has it.
Converting an existing table takes four changes:
- Remove the float. Delete
\begin{table}[htbp],\end{table}and\centering. A longtable is centred by default and sits exactly where you type it, with a big skip of space above and below (\LTpreand\LTpost, both set to\bigskipamount). - Rename the environment.
\begin{tabular}{l p{9cm} r}becomes\begin{longtable}{l p{9cm} r}. The column letters work as before, including booktabs rules and siunitxScolumns. - Move the caption inside, as a row.
\caption{…}becomes the first row of the table and ends with\\like any other row. Put\labelright after it, in the same row. - Compile three times. longtable sets the table in chunks and writes the column widths to the .aux file, so the pages only line up after a rerun. In my tests the first two runs printed
Table widths have changed. Rerun LaTeX.and the third was clean.
% preamble: \usepackage{longtable} \usepackage{booktabs}
\begin{longtable}{@{} l p{9cm} r @{}}
\caption{Questionnaire items}\label{tab:items}\\
\toprule
Code & Item wording & Mean \\
\midrule
BT1 & I trust this brand to deliver what it promises. & 5.42 \\
BT2 & This brand is honest about price changes. & 4.87 \\
% ... as many rows as you need
\bottomrule
\end{longtable}
That table already breaks across pages. What it doesn't do yet is repeat the column headings on the next page, and the closing rule only appears at the very end, so every page but the last stops with no rule at all. Section 02 fixes both.
02Headings and caption on every page
The rows you type at the top of a longtable, before the data, can be marked as its head or foot. longtable has four markers, and each one ends a section in place of the last \\ (longtable documentation; Overleaf, Tables):
\endfirsthead: everything above it is the head of the first page only: the caption and the column headings.\endhead: the head of every later page: usually a short "continued" caption and the same headings.\endfoot: the bottom of every page except the last: a rule, and "Continued on next page" if your guide asks for it.\endlastfoot: the bottom of the last page: the closing rule and the table note.
All four go at the start of the longtable, before the data. Their order among themselves doesn't matter (I tested them reversed), but keeping them in the order above makes the code easier to read. Leave out \endfirsthead and the \endhead rows are used on the first page too.
This is the full table as I would hand it in, with booktabs rules, a number column aligned on the decimal point, and the note:
% preamble
\usepackage{longtable}
\usepackage{booktabs} % \toprule, \midrule, \bottomrule
\usepackage{caption} % captions as wide as in a table float
\usepackage{siunitx} % S column: decimals aligned
% in the appendix
\begingroup
\singlespacing % only if you use setspace (section 04)
\begin{longtable}{@{} l p{9cm} S[table-format=1.2] @{}}
\caption{Questionnaire items and scale means}\label{tab:items}\\
\toprule
Code & Item wording & {\textit{M}} \\
\midrule
\endfirsthead
\caption*{Table \thetable{} (continued)}\\
\toprule
Code & Item wording & {\textit{M}} \\
\midrule
\endhead
\midrule
\multicolumn{3}{r@{}}{\footnotesize\itshape Continued on next page}\\
\endfoot
\bottomrule
\multicolumn{3}{@{}p{\linewidth}@{}}{\footnotesize
\textit{Note.} $N = 412$. Items rated from 1 to 7.}\\
\endlastfoot
BT1 & I trust this brand to deliver what it promises. & 5.42 \\
BT2 & This brand is honest about price changes. & 4.87 \\
% ... the remaining rows
\end{longtable}
\endgroup
The choices in that code, and the ones I see go wrong:
- The continued caption.
\caption*{Table \thetable{} (continued)}prints "Table B.1 (continued)" with no colon and no title, and adds nothing to the list of tables. If your guide wants the title repeated, use\caption[]{Questionnaire items (continued)}instead: the empty square brackets keep the number and suppress the list entry (longtable documentation). A plain\caption{…}in the\endheadrows adds a list-of-tables entry on every page it prints: in my test, a table that ran over three pages showed Table 1.1 three times, with three page numbers. - One number per table. The longtable environment, not
\caption, steps the table counter, so the continued caption carries the same number however many pages the table runs (caption manual, section on longtable). It also follows the class: Table 4.5 in a chapter, Table B.1 in an appendix. - The caption package. Without it, a longtable caption is set in a box 4 inches wide (
\LTcapwidth), so a long caption wraps far earlier than the captions of your other tables. With\usepackage{caption}loaded, it matched the width of a normal table caption, and the caption settings you use for tables apply here too. - "Continued on next page" is optional: check whether your guide asks for it or only for the headings to repeat; APA's rule for tables that continue on the next page is in my APA table format guide. If you drop the line, keep
\midruleor\bottomrulebefore\endfoot, so each page still closes with a rule.
03Notes under a long table
A table note belongs on the last page only, which is exactly what \endlastfoot is for. The simplest note is a row that spans every column, as in the code above: \multicolumn{3}{@{}p{\linewidth}@{}}{…} makes a paragraph cell as wide as the text block, so a long note wraps instead of stretching the table. I put it after \bottomrule, so the note sits under the closing rule, and set it in \footnotesize.
For lettered notes attached to single cells, the threeparttablex package does for a longtable what threeparttable does for a normal table. Wrap the longtable in ThreePartTable, write the notes first, mark the cell with \tnote{a}, and print the notes with \insertTableNotes in the last foot:
% preamble: \usepackage{threeparttablex}
\begin{ThreePartTable}
\begin{TableNotes}[flushleft]\footnotesize
\item \textit{Note.} $N = 412$.
\item[a] Reverse-coded item.
\end{TableNotes}
\begin{longtable}{@{} l p{9cm} r @{}}
... % heads and foot as before
\bottomrule
\insertTableNotes
\endlastfoot
BT4 & This brand is not honest about price changes.\tnote{a} & 3.12 \\
...
\end{longtable}
\end{ThreePartTable}
Page footnotes are the other option, with a catch: the longtable documentation warns that \footnote doesn't work in the head or foot sections. In a caption or a heading, use \footnotemark there and \footnotetext{…} in a body row that falls on the same page. For a thesis, table notes are cleaner, because the note stays with the table.
04Line spacing: the 1.5 spacing trap
This one is easy to miss, because normal tables behave. When the preamble sets 1.5 or double spacing with the setspace package, normal tables still come out single-spaced, because setspace turns its spacing off inside floats and footnotes (setspace documentation). A longtable is not a float. It is typeset as part of the text, so it inherits the 1.5 spacing: every wrapped line in a text column gets the full gap, and the table grows by pages.
\onehalfspacing. Before: the wrapped item wording is 1.5-spaced, like the body text. After: wrapped in \begingroup\singlespacing … \endgroup, the lines sit together as in a normal table. In my 45-row test the fix took the table from four pages to three.The fix is to switch to single spacing for that table only, inside a group, as in the worked example:
- Type
\begingroupand then\singlespacingon the lines before\begin{longtable}. - Type
\endgroupafter\end{longtable}. The text after the table returns to the thesis spacing.
If your class sets the spacing with \linespread instead of setspace, the spacing applies to every table, float or not; use \linespread{1}\selectfont inside the group instead of \singlespacing. Check your guide first: if it asks for tables in the same spacing as the text, leave the longtable as it is.
Appendix tables that run to twenty pages and break differently every compile?I can set them all to your guide
05Control where the table breaks
longtable breaks only between rows; a row never splits across two pages, so a row with a very long paragraph cell moves whole to the next page. Usually the break falls in the right place. When it doesn't, for example a group label left alone at the bottom of a page, these row commands from the longtable documentation fix it:
| Command | What it does |
|---|---|
| \\* | Ends the row like \\, but forbids a page break after it. Use it on a group label so it stays with its first row. |
| \pagebreak | At the start of a row: break the page before this row. \pagebreak[2] only suggests it (0 to 4). |
| \nopagebreak | At the start of a row: no break before this row. |
| \newpage | At the start of a row: force a new page here. |
| \kill | Ends a row that is measured for the column widths but not printed. |
| \caption[]{…} | A numbered caption with no entry in the list of tables. |
| \caption*{…} | A caption with no number and no list entry. |
| [l] [c] [r] | After \begin{longtable}: place the table flush left, centred (the default) or flush right. |
Change the breaks last. Every edit above a long table moves its start, so a \newpage placed in March can leave a near-empty page in May. Fix the breaks once the text before the table is final, and check the list of tables page numbers afterwards; how that list is built is in my guide to the LaTeX table of contents and lists of tables.
06Wrapping text, X columns and landscape
Long tables in a thesis are mostly text: questionnaire items, interview codes, a coding frame, a literature summary. A column of l never wraps, so give long text a p column of fixed width, such as p{9cm}, as in the examples above.
A long table with an X column: xltabular
tabularx's stretching X column doesn't work in a plain longtable. The xltabular package combines the two: it takes the table width first, like tabularx, and accepts every longtable command. I compiled the worked example with the environment swapped as below, and it broke across pages with the same heads and feet:
% preamble: \usepackage{xltabular}
\begin{xltabular}{\textwidth}{@{} l >{\raggedright\arraybackslash}X r @{}}
... % caption, heads, feet and rows as before
\end{xltabular}
A long table that is too wide: landscape pages
For a table with many columns, turn its pages sideways. Load \usepackage{pdflscape} and put the longtable inside \begin{landscape} and \end{landscape}. The environment starts a new page and ends with one (the lscape code issues \clearpage at both ends), the table is set across the long side of the page, and pdflscape marks those pages as rotated in the PDF, so they display the right way up on screen. In my test the page number stayed where it is on the portrait pages, so it reads sideways on screen; check your guide, because some want it on the long edge of a landscape page instead.
Don't reach for \resizebox. It needs the whole table in one box, which is exactly what longtable avoids: in my test, a longtable inside \resizebox stopped the compile with "Missing \endgroup inserted". Shorten the headings, set the table in \small inside the group, or turn the pages sideways.
The landscape environment only turns the text block, so a landscape page keeps the thesis margins, including the wider binding margin on the same edge of the paper. Those margins are set once with geometry, as described in my guide to writing a thesis in LaTeX.
07Long table errors and fixes
I reproduced each of these with pdfLaTeX in TeX Live 2025. Some give a clear error; the first one gives none at all.
The table runs off the bottom of the page, with no error
The longtable is still inside a table environment. The float puts it in one box, which can't break, so it runs off the page and the log shows only a warning: Float too large for page by 574.39996pt in my test. Delete \begin{table} and \end{table}.
"Misplaced \noalign" at \toprule or \hline
The \caption row has no \\ at the end, so the rule that follows lands in the middle of a row. In my test, pdflatex in non-stop mode also kept running until I stopped it. Write \caption{…}\\, and check that the row before every \toprule, \midrule or \hline ends in \\.
"Table widths have changed. Rerun LaTeX."
Not an error: the columns on different pages don't match yet. Compile again until the warning goes away; the longtable documentation explains that the widths are stored in the .aux file and used on the next run. If the columns still jump after several runs, delete the .aux file and compile three times.
The table appears more than once in the list of tables
The continued caption in the \endhead rows is a plain \caption{…}. Change it to \caption[]{…} or \caption*{…} (section 02).
"Package longtable Error: longtable not in 1-column mode"
The document or the section is in two columns: the twocolumn class option or a multicols environment. longtable changes how pages are built, and can't work there (longtable on CTAN). With the class option, put \onecolumn before the table and \twocolumn after it; each starts a new page (LaTeX2e reference manual). With multicols, end the environment before the longtable and start it again after.
A footnote in the heading disappears
\footnote doesn't work in the head or foot rows. Use \footnotemark there and \footnotetext in a body row on the same page, or a table note (section 03).
The caption is narrower than the other table captions
The caption package isn't loaded, so longtable uses its 4-inch caption box. Add \usepackage{caption}.
The rows are far apart
The thesis spacing applies inside the longtable. Wrap it in \begingroup\singlespacing … \endgroup (section 04).
Inherited a template where every long table breaks differently?Send me the project and I'll set the tables to your guide
08Questions people ask
Can I split a normal table float across two pages instead?
Not automatically. You can split it by hand into two table floats and give the second \ContinuedFloat from the caption package, which keeps the same number. That works for a table that will never change length. For anything longer, or still being edited, longtable is less work; the caption manual notes that \ContinuedFloat itself doesn't work inside a longtable.
Does longtable work in Overleaf?
Yes. longtable, booktabs, xltabular, threeparttablex and pdflscape are all part of TeX Live, which Overleaf uses, so the code on this page compiles there unchanged. Overleaf's Tables page has its own longtable example with the same four markers.
Does longtable work with booktabs and siunitx?
Yes. The worked example uses both: booktabs rules in the heads and feet, and an siunitx S column with its heading in braces.
Where should a long table go in a thesis?
Usually in an appendix, with a short summary table in the chapter. A three-page questionnaire table in the middle of a results chapter breaks the reading, so unless your guide says otherwise, I move it to an appendix and refer to it by number. My thesis format checklist covers the rest of what a thesis needs.
How this was checked: every table, warning and error on this page was compiled with pdfLaTeX in TeX Live 2025 (longtable 4.22, booktabs 1.61803398, caption 3.6o with ltcaption 1.4c, siunitx 3.4.10, setspace 6.7b, xltabular 0.2i, threeparttablex 0.3, pdflscape 0.13) on Windows 11, in the report class at 12 pt on A4, and the output was compared with the longtable documentation (current version 4.28 on CTAN), Overleaf's Tables page, the caption manual, the setspace documentation and the LaTeX2e reference manual, on .
Sources
- longtable – Allow tables to flow over page boundaries CTAN
- The longtable package (documentation) CTAN
- Tables (section Multi-page tables) Overleaf
- Customizing captions of floating environments (caption manual, longtable section) CTAN
- setspace – Set space between lines CTAN
- booktabs – Publication quality tables in LaTeX CTAN
- siunitx – A comprehensive (SI) units package CTAN
- threeparttablex – Notes in longtables CTAN
- xltabular – Longtable support with possible X-column specifier CTAN
- pdflscape – Make landscape pages display as landscape CTAN
- \onecolumn LaTeX2e unofficial reference manual