# How to make \hhline work with longtable's \\*

1. longtable provides \\* which can prevent the pagebreak, and longtable redefines \hline to support this function.
2. Then, multirow enhances \cline to support that function.
One can use package option "longtable" to load the enhancement, see texdoc multirow, sec. 3.6.
3. It seems that \hhline from hhline package does not work with \\*.

Is there a way to make hhline work with \\*? Maybe this answer can be a start point, but I am not sure.

\documentclass{article}

\usepackage{array}
\usepackage{longtable}
\usepackage[longtable]{multirow}
\usepackage{hhline}
\usepackage[table]{xcolor}

\textheight4\baselineskip
\pdfpageheight5\textheight

\begin{document}
\begin{longtable}{*{3}{|l}|}
\hline
A & B                 & C \\ \hline
A & B                 & C \\ \hline
A & B                 & C \\* \cline{2-3}
A & \cellcolor{pink}B & C \\* \cline{2-3}
A & B                 & C \\ \hline
\end{longtable}

\newpage
\begin{longtable}{*{3}{|l}|}
\hline
A & B                 & C \\ \hline
A & B                 & C \\ \hline
A & B                 & C \\* \hhline{|~|-|-|}
A & \cellcolor{pink}B & C \\* \hhline{|~|-|-|}
A & B                 & C \\ \hline
\end{longtable}
\end{document}


I need to use \cellcolor inside a longtable hence \hhline seems to be a must, by texdoc colortbl, sec. 10.

• longtable \\* does not prevent page breaks at a following \hline – David Carlisle Jul 29 at 21:21
• @DavidCarlisle Then, does multirow actually make \cline working with \\*`, as stated in its package doc? – Johannes Z Jul 30 at 0:57
• I assume so, I don't really use multirow and never looked at its internals. I think I have an answer on this site showing how to have a non-breaking hline in longtable, I will see if I can find..... – David Carlisle Jul 30 at 11:23