74

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?

3

4 Answers 4

62

Use the longtable package (see also the documentation).

5
  • 5
    Combined with the booktabs package, longtable is an excellent option. Jul 26, 2010 at 20:32
  • 5
    Be aware that \caption commands are placed inside a longtable environment, and therefore the respective code lines must end with \\.
    – lockstep
    Feb 10, 2012 at 22:00
  • 1
    @Quadrescence What can I use the booktabs package for? Jun 12, 2015 at 14:38
  • 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, 2023 at 2:50
13

I would recommend using the xtab package, which is designed as a improvement of the supertabular package.

3
  • 5
    Do you have an example for the starred version of xtabular? It is not working with me.
    – Rafid
    Feb 18, 2011 at 10:31
  • As Jose, I also suggest the supertabular and xtab packages. The xtab package provides tables that break across pages. Feb 18, 2011 at 20:47
  • 1
    Do you know if xtab and supertabular are compatible with tabularx? May 20, 2013 at 13:06
8

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}

enter image description here

1
  • 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, 2022 at 8:57
6

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .