I've got data that I need to include in a table, but there's a lot if it. I've played with the font size and table formatting as much as I can, but the table still won't fit on the page. Is there anyway to make a table that spans multiple pages with LaTeX?
4 Answers
Use the longtable package (see also the documentation).
- 259,911
- 34
- 706
- 1,036
- 30,891
- 23
- 67
- 87
-
5Combined with the
booktabspackage,longtableis an excellent option. – Quadrescence Jul 26 '10 at 20:32 -
5Be aware that
\captioncommands are placed inside alongtableenvironment, and therefore the respective code lines must end with\\. – lockstep Feb 10 '12 at 22:00 -
1
-
1
-
@tommy.carstensen it's just a tiny embellishment package that provides a couple of macros for automatically adding extra vertical space around horizontal lines. – ScumCoder Nov 19 '23 at 02:50
I would recommend using the xtab package, which is designed as a improvement of the supertabular package.
- 576
- 4,125
- 2
- 27
- 35
-
5Do you have an example for the starred version of xtabular? It is not working with me. – Rafid Feb 18 '11 at 10:31
-
As Jose, I also suggest the
supertabularandxtabpackages. Thextabpackage provides tables that break across pages. – hassan_noori Feb 18 '11 at 20:47 -
1Do you know if
xtabandsupertabularare compatible withtabularx? – Mario S. E. May 20 '13 at 13:06
An alternative solution with longtblr environment of the new LaTeX3 package tabularray:
\documentclass[12pt]{article}
\usepackage[a6paper,margin=10mm]{geometry}
\usepackage{tabularray}
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{colorlinks}
\begin{document}
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text.
\begin{longtblr}[
caption = {Long Long Tabular Long Long Long Tabular},
entry = {Short Caption},
label = {tblr:test},
note{a} = {It is the first footnote.},
note{$\dag$} = {It is the second long long long long long long footnote.},
]{
colspec = {XXX}, width = 0.85\linewidth, hlines,
rowhead = 2, rowfoot = 1,
row{1-2} = {purple7}, row{Z} = {blue7}, row{3-Y} = {gray9},
}
Head & Head & Head \
Head & Head & Head \
Alpha & Beta & Gamma \
Epsilon & Zeta & Eta \
Iota & Kappa & Lambda \
Nu & Xi & Omicron \
Rho & Sigma & Tau \
Phi & Chi & Psi \
Alpha & Beta & Gamma \
Epsilon & Zeta\TblrNote{a} & Eta \
Iota & Kappa\TblrNote{$\dag$} & Lambda \
Nu & Xi & Omicron \
Rho & Sigma & Tau \
Phi & Chi & Psi \
Alpha & Beta & Gamma \
Epsilon & Zeta & Eta \
Iota & Kappa & Lambda \
Nu & Xi & Omicron \
Rho & Sigma & Tau \
Phi & Chi & Psi \
Foot & Foot & Foot \
\end{longtblr}
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text.
\end{document}
- 10,932
-
This is good with automatic table title in the second page.
By the way, to use "tabularray", maybe you should do something else.
For overlef, one way is useful: Menu -> TeX Live Version -> 2021.
– ML Xu Oct 31 '22 at 08:57
Depending on your overall requirements and the shape of the data in the table, you might also consider dropping your longtable into a landscape environment, as provided, e.g., by the pdflscape package.
- 576
- 14,435

[page-breaking]tag will stop duplicates of this question. – lockstep Feb 17 '11 at 21:11