Open masics opened 3 years ago
Example please!
Easy.
\documentclass{article}
\usepackage{xltabular}
\title{xltabular}
\begin{document}
\begin{xltabular}{\textwidth}{|l|X|X|}
\caption{A sample long table.} \label{tab:long} \\
\hline \multicolumn{1}{|c|}{\textbf{First column}} & \multicolumn{1}{c|}{\textbf{Second column}} & \multicolumn{1}{c|}{\textbf{Third column}} \\ \hline
\endfirsthead
\multicolumn{3}{c}%
{\tablename\ \thetable{} -- continued from previous page} \\
\hline \multicolumn{1}{|c|}{\textbf{First column}} & \multicolumn{1}{c|}{\textbf{Second column}} & \multicolumn{1}{c|}{\textbf{Third column}} \\ \hline
\endhead
\hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline
\endfoot
\hline
\endlastfoot
Line 1 & & \\
Line 2 & & \\ \hline
Line 1 & & \\
Line 2 & & \\ \hline
Line 1 & & \\
Line 2 & & \\ \hline
Line 1 & & \\
Line 2 & & \\ \hline
Line 1 & & \\
Line 2 & & \\ \hline
Line 1 & & \\
Line 2 & & \\ \hline
Line 1 & & \\
Line 2 & & \\ \hline
Line 1 & & \\
Line 2 & & \\ \hline
Line 1 & & \\
Line 2 & & \\ \hline
Line 1 & & \\
Line 2 & & \\ \hline
Line 1 & & \\
Line 2 & & \\ \hline
Line 1 & & \\ \cline{2-3}
Line 2 & & \\ \hline
Line 1 & & \\ \cline{2-3}
Line 2 & & \\ \hline
Line 1 & & \\ \cline{2-3}
Line 2 & & \\ \hline
Line 1 & & \\ \cline{2-3}
Line 2 & & \\ \hline
Line 1 & & \\ \cline{2-3}
Line 2 & & \\ \hline
Line 1 & & \\ \cline{2-3}
Line 2 & & \\ \hline
Line 1 & & \\ \cline{2-3}
Line 2 & & \\ \hline
Line 1 & & \\ \cline{2-3}
Line 2 & & \\ \hline
Line 1 & & \\ \cline{2-3}
Line 2 & & \\ \hline \nopagebreak
Line 11 & & \\ \cline{2-3}
Line 12 & & \\ \hline
Line 1 & & \\ \cline{2-3}
Line 2 & & \\ \hline
Line 1 & & \\ \cline{2-3}
Line 2 & & \\ \hline
Line 1 & & \\
Line 2 & & \\ \hline
Line 1 & & \\
Line 2 & & \\ \hline
\end{xltabular}
\end{document}
This is out of the control of xltabular
, it also happens for a simple longtable
. Use the other way round and insert \pagebreak
where it should appear.
If I add a
\nopagebreak
after\cline
, it is not working.