rolfn / xltabular

LaTeX package which combines longtable and tabularx.
Other
10 stars 3 forks source link

\nopagebreak is not working with \cline #16

Open masics opened 3 years ago

masics commented 3 years ago

If I add a \nopagebreak after \cline, it is not working.

hvoss49 commented 3 years ago

Example please!

masics commented 3 years ago

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}
hvoss49 commented 3 years ago

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.