# How to make a table on more then one page by using the table environment

EDIT [Like some comments below are remarking the table environment doesn't allow tables over more then on page. However the solution works fine]

I need to make a table over more then one pages. The standard approach seems to be to use the ltablex environment. However, it doesen't work, also I assume that the table environment may be also required for the thesis template I work on (e.g. suppose for the capture).

\documentclass[11pt]{article}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{ltablex}
\begin{document}

\begin{table}
\caption{Example of an table}
\label{tab:daypack}
\begin{tabularx}{\linewidth}{@{}cX@{}}
\toprule
\textbf{Column 1} & \textbf{Column 2} \\[6pt]
\midrule
$R$ & 1This is an example sentence \\[6pt]
$R$ & 2As well as the line before \\[6pt]
$A$ & 3Also this is an example \\[6pt]
$R$ & 4This is an example sentence \\[6pt]
$R$ & 5As well as the line before \\[6pt]
$A$ & 6Also this is an example \\[6pt]
$R$ & 7This is an example sentence \\[6pt]
$R$ & 8As well as the line before \\[6pt]
$A$ & 9Also this is an example \\[6pt]
$R$ & 10This is an example sentence \\[6pt]
$R$ & 11As well as the line before \\[6pt]
$A$ & 12Also this is an example \\[6pt]
$R$ & 13This is an example sentence \\[6pt]
$R$ & 14As well as the line before \\[6pt]
$A$ & 15Also this is an example \\[6pt]
$R$ & 16This is an example sentence \\[6pt]
$R$ & 17As well as the line before \\[6pt]
$A$ & 18Also this is an example \\[6pt]
$R$ & 19This is an example sentence \\[6pt]
$R$ & 20As well as the line before \\[6pt]
$A$ & 21Also this is an example \\[6pt]
$R$ & 22This is an example sentence \\[6pt]
$R$ & 23As well as the line before \\[6pt]
$A$ & 24Also this is an example \\[6pt]
$R$ & 25This is an example sentence \\[6pt]
$R$ & 26As well as the line before \\[6pt]
$A$ & 27Also this is an example \\[6pt]
$R$ & 28This is an example sentence \\[6pt]
$R$ & 29As well as the line before \\[6pt]
$A$ & 30Also this is an example \\[6pt]
$R$ & 31This is an example sentence \\[6pt]
$R$ & 32As well as the line before \\[6pt]
$A$ & 33Also this is an example \\[6pt]
$R$ & 34This is an example sentence \\[6pt]
$R$ & 35As well as the line before \\[6pt]
$A$ & 36Also this is an example \\[6pt]
$R$ & 37This is an example sentence \\[6pt]
\bottomrule
\end{tabularx}
\end{table}

\end{document}

-
A table environment can never be split across pages. The purpose of ltablex is exactly not using table. –  egreg Mar 15 '14 at 23:10
@egreg Thank you. However, may it be possible to change the code in order to work over more then one page and to add before a empty table? Otherwise could you at least offer a working code without the table environment because it doesn't work for me? –  alex Mar 15 '14 at 23:16

If you must combine tabularx and longtable, I prefer ltxtable to ltablex:

\documentclass[11pt]{article}
\usepackage{booktabs}
\usepackage{ltxtable}
\begin{document}

\LTXtable{\textwidth}{t1.tex}

\end{document}


where t1.tex is

\begin{longtable}{@{}cX@{}}
\toprule
\textbf{Column 1} & \textbf{Column 2} \\[6pt]
\midrule
$R$ & 1This is an example sentence \\[6pt]
$R$ & 2As well as the line before \\[6pt]
$A$ & 3Also this is an example \\[6pt]
$R$ & 4This is an example sentence \\[6pt]
$R$ & 5As well as the line before \\[6pt]
$A$ & 6Also this is an example \\[6pt]
$R$ & 7This is an example sentence \\[6pt]
$R$ & 8As well as the line before \\[6pt]
$A$ & 9Also this is an example \\[6pt]
$R$ & 10This is an example sentence \\[6pt]
$R$ & 11As well as the line before \\[6pt]
$A$ & 12Also this is an example \\[6pt]
$R$ & 13This is an example sentence \\[6pt]
$R$ & 14As well as the line before \\[6pt]
$A$ & 15Also this is an example \\[6pt]
$R$ & 16This is an example sentence \\[6pt]
$R$ & 17As well as the line before \\[6pt]
$A$ & 18Also this is an example \\[6pt]
$R$ & 19This is an example sentence \\[6pt]
$R$ & 20As well as the line before \\[6pt]
$A$ & 21Also this is an example \\[6pt]
$R$ & 22This is an example sentence \\[6pt]
$R$ & 23As well as the line before \\[6pt]
$A$ & 24Also this is an example \\[6pt]
$R$ & 25This is an example sentence \\[6pt]
$R$ & 26As well as the line before \\[6pt]
$A$ & 27Also this is an example \\[6pt]
$R$ & 28This is an example sentence \\[6pt]
$R$ & 29As well as the line before \\[6pt]
$A$ & 30Also this is an example \\[6pt]
$R$ & 31This is an example sentence \\[6pt]
$R$ & 32As well as the line before \\[6pt]
$A$ & 33Also this is an example \\[6pt]
$R$ & 34This is an example sentence \\[6pt]
$R$ & 35As well as the line before \\[6pt]
$A$ & 36Also this is an example \\[6pt]
$R$ & 37This is an example sentence \\[6pt]
\bottomrule
\end{longtable}

-
But ltablex is in Tex Live and MiKTeX. I'm not saying your package isn't superior (I've never used either) but it does require manual installation. –  cfr Mar 16 '14 at 0:12
@cfr I didn't install it manually, just picked it from texlive default install –  David Carlisle Mar 16 '14 at 0:15
How odd. I was just going by ctan.org/pkg/ltxtable in comparison with ctan.org/pkg/ltablex. I didn't check against my own installation (which does include it, as you say). –  cfr Mar 16 '14 at 0:18

With the correct code, it works fine. No table environment – a long table cannot possibly be a float, and the caption just after begin{tabularx}.

    \documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{ltablex}

\begin{document}

\label{tab:daypack}
\begin{tabularx}{\linewidth}{@{}cX@{}}
\caption{Example of an table}\\
\toprule
\textbf{Column 1} & \textbf{Column 2} \\[6pt]
\midrule

$R$ & 1This is an example sentence \\[6pt]
$R$ & 2As well as the line before \\[6pt]
$A$ & 3Also this is an example \\[6pt]
$R$ & 4This is an example sentence \\[6pt]
$R$ & 5As well as the line before \\[6pt]
$A$ & 6Also this is an example \\[6pt]
$R$ & 7This is an example sentence \\[6pt]
$R$ & 8As well as the line before \\[6pt]
$A$ & 9Also this is an example \\[6pt]
$R$ & 10This is an example sentence \\[6pt]
$R$ & 11As well as the line before \\[6pt]
$A$ & 12Also this is an example \\[6pt]
$R$ & 13This is an example sentence \\[6pt]
$R$ & 14As well as the line before \\[6pt]
$A$ & 15Also this is an example \\[6pt]
$R$ & 16This is an example sentence \\[6pt]
$R$ & 17As well as the line before \\[6pt]
$A$ & 18Also this is an example \\[6pt]
$R$ & 19This is an example sentence \\[6pt]
$R$ & 20As well as the line before \\[6pt]
$A$ & 21Also this is an example \\[6pt]
$R$ & 22This is an example sentence \\[6pt]
$R$ & 23As well as the line before \\[6pt]
$A$ & 24Also this is an example \\[6pt]
$R$ & 25This is an example sentence \\[6pt]
$R$ & 26As well as the line before \\[6pt]
$A$ & 27Also this is an example \\[6pt]
$R$ & 28This is an example sentence \\[6pt]
$R$ & 29As well as the line before \\[6pt]
$A$ & 30Also this is an example \\[6pt]
$R$ & 31This is an example sentence \\[6pt]
$R$ & 32As well as the line before \\[6pt]
$A$ & 33Also this is an example \\[6pt]
$R$ & 34This is an example sentence \\[6pt]
$R$ & 35As well as the line before \\[6pt]
$A$ & 36Also this is an example \\[6pt]
$R$ & 37This is an example sentence \\[6pt]
\bottomrule
\end{tabularx}

\end{document}


-
Sorry! I mingled with my clipboard manager, and I didn't check what was copied in the editing window. I've updated. –  Bernard Mar 16 '14 at 0:23
Thank you! :) the result looks perfect. However, I try and try but in the original document i get ! LaTeX Error: There's no line here to end. Have you any idea why? –  alex Mar 16 '14 at 1:13
Impossible to say without seeing the code and the .log. Probably you inserted a \ or a blankline just after the end of an environment. Usually, the .log tells you where this happens. –  Bernard Mar 16 '14 at 1:43
Thank you very much. Somehow in ltablex seems to create trouble inside my template. Therefore I've chosen the proposal from David Carlisle. However, this solution works in an normal environment and is very elegant! –  alex Mar 16 '14 at 2:35

Use longtable of the package longtable

\documentclass[11pt]{article}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{ltablex}
\usepackage{longtable}
\begin{document}

\begin{longtable}{cc}
\caption{Example of an table} \\
\textbf{Column 1} & \textbf{Column 2} \\[6pt]
$R$ & 1This is an example sentence \\[6pt]
$R$ & 2As well as the line before \\[6pt]
$A$ & 3Also this is an example \\[6pt]
$R$ & 4This is an example sentence \\[6pt]
$R$ & 5As well as the line before \\[6pt]
$A$ & 6Also this is an example \\[6pt]
$R$ & 7This is an example sentence \\[6pt]
$R$ & 8As well as the line before \\[6pt]
$A$ & 9Also this is an example \\[6pt]
$R$ & 10This is an example sentence \\[6pt]
$R$ & 11As well as the line before \\[6pt]
$A$ & 12Also this is an example \\[6pt]
$R$ & 13This is an example sentence \\[6pt]
$R$ & 14As well as the line before \\[6pt]
$A$ & 15Also this is an example \\[6pt]
$R$ & 16This is an example sentence \\[6pt]
$R$ & 17As well as the line before \\[6pt]
$A$ & 18Also this is an example \\[6pt]
$R$ & 19This is an example sentence \\[6pt]
$R$ & 20As well as the line before \\[6pt]
$A$ & 21Also this is an example \\[6pt]
$R$ & 22This is an example sentence \\[6pt]
$R$ & 23As well as the line before \\[6pt]
$A$ & 24Also this is an example \\[6pt]
$R$ & 25This is an example sentence \\[6pt]
$R$ & 26As well as the line before \\[6pt]
$A$ & 27Also this is an example \\[6pt]
$R$ & 28This is an example sentence \\[6pt]
$R$ & 29As well as the line before \\[6pt]
$A$ & 30Also this is an example \\[6pt]
$R$ & 31This is an example sentence \\[6pt]
$R$ & 32As well as the line before \\[6pt]
$A$ & 33Also this is an example \\[6pt]
$R$ & 34This is an example sentence \\[6pt]
$R$ & 35As well as the line before \\[6pt]
$A$ & 36Also this is an example \\[6pt]
$R$ & 37This is an example sentence \\[6pt]
\end{longtable}

\end{document}

-
Thank you very much! This solution is very similar (aside of alignment) to David Carlisle. However it works fine and I rated it positively. Have a nice day! –  alex Mar 16 '14 at 2:43
We could extend possibilities of the longtable package by loading the tabu package, ctan.org/pkg/tabu. Then we would use the longtabu environment instead of longtable. –  Malipivo Mar 16 '14 at 18:47