3

I've got a tabu package related question. In the longtabu environment using \hline works perfectly. But when I try to use \tabucline[...] instead, on pagebreak there is one line missing.

Info according my preamble which I think may be relevant:

\documentclass[a4paper,12pt,BCOR8mm,DIV=calc,oneside,headings=normal,parskip=half,toc=graduated,bibliography=totocnumbered,draft]{scrreprt}
\pagestyle{headings}
\usepackage[T1]{fontenc}
\usepackage{frutigernext}
\renewcommand{\familydefault}{\sfdefault} 
\usepackage{lscape}
\usepackage{setspace}
\usepackage[left=30mm, right=29mm,top=30mm,bottom=30mm,bindingoffset=8mm]{geometry}
\usepackage[ngerman,english]{babel}
\usepackage[latin1]{inputenc} 
\setcounter{tocdepth}{4} 
\setcounter{secnumdepth}{4}
\usepackage[markuppercase,clines]{scrpage2} 
\clearscrheadfoot
\renewcommand*{\chapterpagestyle}{scrheadings}
\chead[]{}
\automark{chapter}
\ihead[\headmark]{\uppercase{\headmark}}
\ohead[\pagemark]{\pagemark}
\setheadsepline{0.5pt}

% ----- TABELLEN -----
\usepackage{tabu}
\usepackage{longtable}
\usepackage[table]{xcolor}
\usepackage{calc}
\newcommand{\ctabukopf}{\taburowcolors[1]1{gray!100 .. gray!100}\rowfont[c]\bfseries\hline}
...

Now using \hline in longtabu:

\scriptsize
\tabulinesep=0.8ex
\begin{longtabu} to \linewidth {|X[ml]X[ml]X[ml2.5]|}
\ctabukopf
\multicolumn{3}{|c|}{Programmaufrufe}\\ \hline
\taburowcolors[1]1{white .. white}              
\textbf{Aufruf} & \textbf{Argument} & \textbf{Bedeutung}\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
\end{longtabu}  
\tabureset
\normalsize

Result (OK): http://homepages-nw.uni-r.de/~ocs23577/a.jpg http://homepages-nw.uni-r.de/~ocs23577/a.jpg

Using \tabucline[...] in longtabu:

\scriptsize
\tabulinesep=0.8ex
\begin{longtabu} to \linewidth {|X[ml]X[ml]X[ml2.5]|}
\ctabukopf
\multicolumn{3}{|c|}{Programmaufrufe}\\ \hline
\taburowcolors[1]1{white .. white}              
\textbf{Aufruf} & \textbf{Argument} & \textbf{Bedeutung}\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \tabucline[on 2pt gray!100]
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \tabucline[on 2pt gray!100]
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \tabucline[on 2pt gray!100]
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
Example1 & Example2 & Little bit longer example Little bit longer example Little bit longer example Little bit longer example\\ \hline
\end{longtabu}  
\tabureset
\normalsize

Result (crashed): http://homepages-nw.uni-r.de/~ocs23577/b.jpg http://homepages-nw.uni-r.de/~ocs23577/b.jpg

Do you know how to address this problem correctly? Thanks, Simon

3

The tabu documentation has the following note (v2.8, p. 9):

\tabucline does not care of page breaks presently: use \hline instead.

So simply using \hline is indeed the recommended solution.

Of course, \tabucline has a bunch of features that \hline lacks, including style options that control thickness, colors, and dashing. If you're using any of these features, simply using \hline won't meet your needs. The ideal solution would be for tabu's author, or some other TeXnical wizard, to make \tabucline compatible with page breaks. In the meantime, however, I can show you some simple workarounds I've found that will allow you to control the thickness and color of ordinary \hlines while preserving the behavior you seek (repeating rules that occur on page breaks). In this way, you can get some of the most popular features that \tabucline provides (control over the thickness and color of individual rules) while preserving the good behavior across page breaks that \hline has. (Because they use only \hline, these techniques should work fine with any longtable; it needn't necessarily be a longtabu.)

First, the simple case: if you need to change the thickness and/or color of all rules in your table, this is quite easy to do. For thickness, set the \arrayrulewidth length, and for color, load the colortbl package and use the \arrayrulecolor command. That is, put

\setlength{\arrayrulewidth}{2pt}

right before the table and

\arrayrulecolor{blue}

right after the \begin{longtabu} declaration.

Things get harder if you want to control thickness and color on a per-rule basis—that is, if you want some horizontal rules in a table to be thick and black, while others are thin and blue. Fortunately, I found this related question that has a couple of answers that solve the hardest part of this problem for us. Here's an example of how this can be used in practice:

\documentclass{article}
\usepackage{longtable,tabu}
\usepackage[table]{xcolor}
\usepackage[paperwidth=5.5in,paperheight=8.5in,margin=.5in,footskip=.25in]{geometry}

\newcommand{\thickhline}[1]{\noalign{\global\arrayrulewidth#1}\hline
    \noalign{\global\arrayrulewidth#1}}

\newcommand{\coloredthickhline}[2]{
    \arrayrulecolor{#1}
    \thickhline{#2}
    \arrayrulecolor{black}
}

\begin{document}

\tabulinesep=4pt
\begin{longtabu}{XX[1.7]} \thickhline{3pt}
    \textbf{Base Potions} &
        These potions have no effect...
    \\\coloredthickhline{blue!35!lightgray}{.5pt}
    \leftskip=3ex Awkward Potion &
        This is the base for most potions...
    \\\coloredthickhline{blue!35!lightgray}{.5pt}
    % etc.
    \\\thickhline{3pt}
\end{longtabu}

\end{document}

Here is a screenshot of the result:

enter image description here

As you can see, the rules behave as you would want them to: the rule on which a page break occurs is repeated on the new page with the correct color and thickness. Of course, this isn't a perfect solution—there are still plenty of other things that a \tabucline can do that an \hline can't—but I think it will satisfy most people's needs.

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.