0

My table is logically divided by 2 rows in a group. I want the page break occurs only after the last row in the group. How I can do that with longtable? In the example below page break happens on "bit 6"

\documentclass[]{article}
\usepackage{longtable,booktabs}
\usepackage{geometry}
 \geometry{
 a4paper,
 total={160mm,257mm},
 left=10mm,
 top=20mm,
 }

\date{}

\begin{document}


\subsubsection{SOME\_REGISTER, 0x100}\label{some_register-0x100}

Some register for XXX

\begin{longtable}[c]{|p{0.15\textwidth}|p{0.4\textwidth}|p{0.15\textwidth}|p{0.15\textwidth}|p{0.2\textwidth}|}
\caption{A sample long table.} \label{tab:long} \\
\hline
{\bf Bit Position} & {\bf Field Name} & {\bf Permissions} & {\bf Reset Value} & {\bf Field Attributes} \\\hline 
\endfirsthead
\multicolumn{5}{c}%
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\hline {\bf Bit Position} & {\bf Field Name} & {\bf Permissions} & {\bf Reset Value} & {\bf Field Attributes} \\ \hline 
\endhead
\hline \multicolumn{5}{|r|}{{Continued on next page}} \\ \hline
\endfoot

\hline \hline
\endlastfoot
0        & Reserved   & --          & --          & \\\hline 
1         & FIELD1\_NAME & RW & 0x0 & \\*\hline 
             & \multicolumn{4}{|p{.85\textwidth}|}{
Line1

Line1

Line1

Line1

Line1
Line1

Line1
Line1

Line1
Line1

} \\\hline
2         & FIELD1\_NAME & RW & 0x0 & \\*\hline 
             & \multicolumn{4}{|p{.85\textwidth}|}{
Line1

Line1

Line1

Line1

Line1
Line1

Line1
Line1

Line1
Line1

} \\\hline
3         & FIELD1\_NAME & RW & 0x0 & \\*\hline 
             & \multicolumn{4}{|p{.85\textwidth}|}{
Line1

Line1

Line1

Line1

Line1
Line1

Line1
Line1

Line1
Line1

} \\\hline
4         & FIELD1\_NAME & RW & 0x0 & \\*\hline 
             & \multicolumn{4}{|p{.85\textwidth}|}{
Line1

Line1

Line1

Line1

Line1
Line1

Line1
Line1

Line1
Line1

} \\\hline
5         & FIELD1\_NAME & RW & 0x0 & \\*\hline 
             & \multicolumn{4}{|p{.85\textwidth}|}{
Line1

Line1

Line1

Line1

Line1
Line1

Line1
Line1

Line1
Line1

} \\\hline
6         & FIELD1\_NAME & RW & 0x0 & \\*\hline 
             & \multicolumn{4}{|p{.85\textwidth}|}{
Line1

Line1

Line1

Line1

Line1
Line1

Line1
Line1

Line1
Line1

} \\\hline

\bottomrule
\end{longtable}

\end{document}
Michael
  • 197
  • 2
    \\*does not give you the desired result since it is followed by an \hline. Pagrebreaks are generally allowed at \hline. To change this, you can use the approach presented in https://tex.stackexchange.com/a/6353/134144 – leandriis Mar 21 '20 at 12:10
  • Why use you \bf instead of \textbf{} text mode or \mathbf{} in math-mode? – Sebastiano Mar 22 '20 at 12:37

2 Answers2

2

You can use \\ to allow for pagebreaks after this specific row. Use \\* instead to disallow page breaks.

leandriis
  • 62,593
0

As stated by leandriis, this post helped me to implement correct page breaks: https://tex.stackexchange.com/a/107893/209519

Michael
  • 197