# Table With Long Cell Contents Over Multiple Pages

I am using tabularx to create a very large description table, where the content of a lot of the cells is either quite long — spanning over more than one line — or requires an explicit new line. A quick example is the following table:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}

\usepackage{tabularx}        % splits cells with text longer than the column width
\usepackage{makecell}        % to allow for a header to span over two lines

\newcolumntype{f}{>{\hsize=.2\hsize}X}    % each of the columns has a defined static width
\newcolumntype{s}{>{\hsize=.3\hsize}X}
\newcolumntype{t}{>{\hsize=.5\hsize}X}

\begin{document}
\begin{table}
\caption{Sample table}
\centering
\begin{tabularx}{\textwidth}{|f|s|t|}

\hline

Value       & Text      & Text              \\ \hline
Value       & Text      & This text is too long to fit in one line and is automatically split into three   \\ \hline
Value       & Text      & - 0: Important \newline
- 1: instance \newline
- 2: where \newline
- 3: the lines \newline
- 4: are manually \newline
- 5: split \newline
- 6: into \newline
- 7: items        \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
...
Value       & Text      & Text              \\ \hline

\end{tabularx}
\end{table}

\end{document}


Which then goes over the page height limit until it disappears in the end of the page (notice the page number in the middle of the table as well):

Is there a way to make a table like this span over multiple pages? The solutions that I found (e.g. 2014, 2016 and 2017) for problems similar to mine — using packages such as longtable and ltablex— don't work for some of the specifics of the table I already have. I have tried to adapt them to do so, but could not make it work.

Thank you in advance for the help!

• You also have xltabular (which loads ltablex), but be aware that long tables can break across pages only at the end of a row. Jul 9, 2020 at 14:32
• If you have this long lists inside of a table cell, probably entirely switching to a nested list might be a better idea. With thie approach you can have pagebreaks wherever needed. Jul 15, 2020 at 8:21

As suggested @Bernard in his comment, you should

• not use float table, it prevent to break table over pages
• for table use xltabular package

Using any sort of long table you should be aware, that those tables can be split between pages only between their rows.

An example of your table is:

\documentclass[12pt]{article}

\usepackage{xltabular}        % splits cells with text longer than the column width
\newcolumntype{f}{>{\hsize=.2\hsize\hsize=\linewidth}X}    % each of the columns has a defined static width
\newcolumntype{s}{>{\hsize=.3\hsize\hsize=\linewidth}X}
\newcolumntype{t}{>{\hsize=.5\hsize\hsize=\linewidth}X}
\usepackage{makecell}        % to allow for a header to span over two lines

\begin{document}
\begingroup
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\begin{xltabular}{\textwidth}{|f|s|t|}
\caption{Sample table}
\label{tab:longtable}   \\
\hline
\hline
\caption[]{Sample table (cont.)}\\
\hline
\hline
\multicolumn{3}{r}{\footnotesize\itshape{Continued on the next page}}           \\
\endfoot
\endlastfoot
%   table body
Value       & Text      & Text              \\ \hline
Value       & Text      & This text is too long to fit in one line and is automatically split into three   \\ \hline
Value       & Text      & - 0: Important \newline
- 1: instance \newline
- 2: where \newline
- 3: the lines \newline
- 4: are manually \newline
- 5: split \newline
- 6: into \newline
- 7: items        \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
Value       & Text      & Text              \\ \hline
\end{xltabular}
\endgroup

\end{document}


• Why do was there a zero score? Now +1 Dec 31, 2021 at 7:44
• @Sebastiano, I don't know :-(. Thank you very much! :-) Dec 31, 2021 at 7:49