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.

In the following table I get some vertical space after the rows whose content is short but not after the row having a cell with long content.

The problem is that I want to generate the report from my program and I won't know ahead of time whether each cell will be long or short and I am really hoping that I don't have to do something like examine the content and output different latex code for short and long content cells.

\documentclass{article}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{booktabs}
\usepackage{tabu}
\begin{document}

\begin{center}\small 
\extrarowsep=3pt\begin{tabu} to \columnwidth{>{\bfseries}lX}
            \everyrow{\tabucline[blue]-} 
A & a \\ 
B & b \\ 
C & c \\ 
D & Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \\ 
E & e \\ 
\end{tabu} 
\end{center} 

\end{document}

Output:

screenshot

share|improve this question
add comment

1 Answer

up vote 9 down vote accepted

For consistent spacing with tabu you should use the \tabulinesep command before your table. You can also make it so that the value stay applied throughout your document if you use it outside a block.

\documentclass{article}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{booktabs}
\usepackage{tabu}
\usepackage{lipsum}
\begin{document}
\tabulinesep=1.2mm
{\centering
\begin{tabu} to \columnwidth {>{\bfseries}lX}
\everyrow{\tabucline[blue]-} 
A & a \\ 
B & b \\ 
C & c \\ 
D & \lipsum[1] \\ 
E & e \\ 
\end{tabu}}
\end{document}
share|improve this answer
    
\begin{center}\small \extrarowsep=3pt\begin{tabu} to \columnwidth{>{\bfseries}lX} \everyrow{\tabucline[blue]-} A & a \\ B & b \\ C & c \\ D & \lipsum[1] \\ E & e \\ \end{tabu} \end{center} -- When I execute this (note the absence of \tabulinesep), I get some extra gap, the size a line would take, between the end of the filler text and the line. So, does the lipsum package add the relevant paragraph along with the break (I guess not!). So, what's happening? –  kan Jul 23 '12 at 1:18
    
Please see here: The first is the OP's code. The second version is from the code I wrote in the previous comment -- An image. +1 BTW. :) –  kan Jul 23 '12 at 1:21
1  
(1) Even with \tabulinesep=1.2mm I get extra vertical space with \lipsum[1] but not if I write out the text in full as in my post. (2) The need to use \tabulinesep to get consistent results seems to be an unexpected deficiency in the tabu package and really means one should always use \tabulinesep whenever using tabu. This seems to be a bug in tabu. No one would intentionally design a package to be inconsistent by default. –  user1189687 Jul 23 '12 at 2:22
2  
@user1189687 Try the starred version of lipsum (\lipsum*[1]). See page 2 in the lipsum manual. –  Sveinung Jul 23 '12 at 6:34
add comment

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.