2

See the following longtabu axample:

\documentclass{article}

\usepackage{longtable}
\usepackage{booktabs}
\usepackage{tabu}

\usepackage{lipsum}

\begin{document}

\tabulinesep=1.5mm    % <---- seems like this is causing the issue

\def\head{Head A & Head B}
\def\nbcolumns{2}
\begin{longtabu}{X[.5,l] X[1,l]}
  \toprule\rowfont{\bfseries}
  \head\\
  \midrule
  \endfirsthead
%
  \multicolumn{\nbcolumns}{l}{\scriptsize\itshape\ldots Fortsetzung}\\
  \toprule\rowfont{\bfseries}
  \head\\
  \midrule
  \endhead
%
  \multicolumn{\nbcolumns}{r}{\scriptsize\itshape wird fortgesetzt \ldots}
  \endfoot
  \endlastfoot
%
  \everyrow{\tabucline[on 3 pt off 3pt]-}
  1 & \lipsum[2] \\
  2 & \lipsum[2] \\
  3 & \lipsum[2] \\
  4 & \lipsum[2] \\
  5 & \lipsum[2] \\
  6 & \lipsum[2] \\
  7 & \lipsum[2] \\
  8 & \lipsum[2] 
  \everyrow{}\\
  \bottomrule
  \caption{Table name}
\end{longtabu}

\end{document}

... and the resulting document:

enter image description here enter image description here enter image description here

The page break from page 1 to page 2 is as expected.

But there is an issue with the page break from page 2 to page 3. The first dashed line on the top of page 3 should be placed on the bottom of page 2.

How can I fix it?

Or should I consider using an alternative to longtabu?

6
  • You could consider replacing the dashed rules with a little bit of white space. – Thruston Jun 2 '14 at 17:47
  • @Thruston I am sorry, but I am afraid I can't follow you. Do you have an example? I like the dashed rules, but one of the rules is placed on the wrong page. – sergej Jun 3 '14 at 7:24
  • I was suggesting that you could easily avoid your problem by not using the rules at all. Personally I think tables look better with as few rules as possible. But if you like them that's fine too! – Thruston Jun 4 '14 at 11:41
  • 1
    The documentation of tabu says "\tabucline does not care of page breaks presently: use \hline instead." – Andrew Swann Jun 5 '14 at 8:10
  • @AndrewSwann Thank's for your answer, can I modify \hline to be dashed? – sergej Jun 5 '14 at 11:24
3

enter image description here

You can add a \nobreak so linebreaking before the tabu cline is discouraged and add a \filbreak so linebreaking (and padding with space) after the line is encouraged.

\documentclass{article}

\usepackage{longtable}
\usepackage{booktabs}
\usepackage{tabu}

\makeatletter
\renewcommand*\tabucline{\noalign{\nobreak\ifnum0=`}\fi \tabu@cline}


\def\tabu@docline@evr {\xdef\tabu@doclineafter{\the\toks@\filbreak}%
              \ifnum0=`{\fi}\aftergroup\tabu@doclineafter}

\makeatother

\usepackage{lipsum}

\begin{document}

\tabulinesep=1.5mm    % <---- seems like this is causing the issue

\def\head{Head A & Head B}
\def\nbcolumns{2}
\begin{longtabu}{X[.5,l] X[1,l]}
  \toprule\rowfont{\bfseries}
  \head\\
  \midrule
  \endfirsthead
%
  \multicolumn{\nbcolumns}{l}{\scriptsize\itshape\ldots Fortsetzung}\\
  \toprule\rowfont{\bfseries}
  \head\\
  \midrule
  \endhead
%
  \multicolumn{\nbcolumns}{r}{\scriptsize\itshape wird fortgesetzt \ldots}
  \endfoot
  \endlastfoot
%
  \everyrow{\tabucline[on 3 pt off 3pt]-}
  1 & \lipsum[2] \\
  2 & \lipsum[2] \\
  3 & \lipsum[2] \\
  4 & \lipsum[2] \\
  5 & \lipsum[2] \\
  6 & \lipsum[2] \\
  7 & \lipsum[2] \\
  8 & \lipsum[2]
  \everyrow{}\\*
  \bottomrule
  \caption{Table name}
\end{longtabu}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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