72

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

60

Use the longtable package (see also the documentation).

3
  • 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
  • @Quadrescence What can I use the booktabs package for? Jun 12, 2015 at 14:38
13

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

3
  • 4
    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
5

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.

3

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 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.