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}
\newcommand{\heading}[1]{\multicolumn{1}{|c|}{#1}} % centering the headers
\begin{document}
\begin{table}
\caption{Sample table}
\centering
\begin{tabularx}{\textwidth}{|f|s|t|}
\hline
\heading{\textbf{\makecell{Short\\Column}}} & \heading{\textbf{Medium Column}} & \heading{\textbf{Long Column}} \\ \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!
xltabular
(which loadsltablex
), but be aware that long tables can break across pages only at the end of a row.