Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I know there are similar questions, but using \\* did not work for me.

What I want to achieve is that the last two rows of my table will be on the same page (and therefore no page break between them).

Please see the following example

\documentclass[a4paper]{article}
\usepackage{longtable}
\usepackage{lipsum}
\usepackage{geometry}
\geometry{left=1.8cm,right=1.8cm,top=7.3cm,bottom=2.5cm}

\begin{document}
    \begin{longtable}{@{}|p{1.7cm}|p{9.9cm}|p{2.6cm}|p{1.2cm}|}
        \hline
        a & \lipsum[1] & c & d\\\hline
        a & \lipsum[1] & c & d\\\hline
        a & \lipsum[1] & c & d\\\hline

        \multicolumn{1}{|l}{\textbf{Total}} & \multicolumn{3}{r|}{\bf 0} \\* \hline
        \multicolumn{4}{l}{\small I need to be just below Total}        
    \end{longtable}
\end{document}

which results in a page break between the last two rows.

Do you know why \\* isn't working? Am I using it in a wrong way?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

\hline introduces an allowed breakpoint. It is possible to drop into internals and stop that but the easiest thing to do is put the last two rows in the last foot, ie put them at the start, marked with \endlastfoot

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.