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 want to increase a bit the vertical spacing in my tabular table. I did something like this:

\documentclass{article}

\begin{document}

\begin{tabular}{p{4cm}p{4cm}}
  Lorem ipsum dolor sit amet consectetur & adipisicing elit \\[6pt]
  sed do eiusmod tempor incididunt ut labore & et dolore magna aliqua.\\
\end{tabular}

\end{document}

but to my surprise, it doesn't work - it seems that the extra vertical space from [12pt] is somehow eaten by the space beneath the (shorter) parbox. What should I do?

share|improve this question
1  
You could redefine the \arraystretch length, stretching the space between rows. –  Christian Hupfer Apr 14 at 9:37
    
And what if I want to increase the spacing of only one row? (And yes, this is sometimes justified IMHO.) –  mbork Apr 14 at 9:38
2  
The implementation of \\[..] in LaTeX tables is one of its more interesting "features". The expected behaviour is that the user finds the behaviour unexpected. Impossible to change without breaking every existing document that has a table though.... –  David Carlisle Apr 14 at 9:52

3 Answers 3

up vote 5 down vote accepted

You could put a strut in the first column.

\documentclass{article}
\begin{document}
\begin{tabular}{p{4cm}p{4cm}}
  Lorem ipsum dolor sit amet consectetur\rule[-6pt]{0pt}{6pt} & adipisicing elit \\
  sed do eiusmod tempor incididunt ut labore & et dolore magna aliqua.\\
\end{tabular}
\end{document}
share|improve this answer
    
Nice, though a bit hackish. (I thought about it too, though I didn't remember the syntax of \rule, so thanks!) If nothing more "elegant" shows up, I'll accept this one... –  mbork Apr 14 at 11:15
1  
@mbork don't wait:-) –  David Carlisle Apr 14 at 14:20
    
@DavidCarlisle: having seen the other answers, I can see that you're probably right... –  mbork Apr 14 at 20:59

The \\ mechanism can be used, but one has to account for the height of the \parbox, either manually or automatically. The other option, if all rows are to be adjusted, is to use the \extrarowheight parameter of the array package, or else \arraystretch as was mentioned in the comments.

\documentclass{article}
\usepackage{array}
\begin{document}

ORIGINAL

\begin{tabular}{p{4cm}p{4cm}}
  Lorem ipsum dolor sit amet consectetur & adipisicing elit \\[6pt]
  sed do eiusmod tempor incididunt ut labore & et dolore magna aliqua.\\
  sed do eiusmod tempor incididunt ut labore & et dolore magna aliqua.\\
  sed do eiusmod tempor incididunt ut labore & et dolore magna aliqua.\\
\end{tabular}

\hrulefill

CAN DO A SINGLE ROW, MANUALLY ACCOUNT FOR \verb|\parbox| HEIGHT

\begin{tabular}{p{4cm}p{4cm}}
  Lorem ipsum dolor sit amet consectetur & adipisicing elit \\[18pt]%
  sed do eiusmod tempor incididunt ut labore & et dolore magna aliqua.\\
  sed do eiusmod tempor incididunt ut labore & et dolore magna aliqua.\\
  sed do eiusmod tempor incididunt ut labore & et dolore magna aliqua.\\
\end{tabular}

\hrulefill

CAN DO A SINGLE ROW,AUTO- ACCOUNT FOR \verb|\parbox| HEIGHT

\def\x{Lorem ipsum dolor sit amet consectetur}
\setbox0=\hbox{\parbox[t]{4cm}{\x}}

\begin{tabular}{p{4cm}p{4cm}}
  \x & adipisicing elit \\[\dimexpr\dp0+6pt\relax]%
  sed do eiusmod tempor incididunt ut labore & et dolore magna aliqua.\\
  sed do eiusmod tempor incididunt ut labore & et dolore magna aliqua.\\
  sed do eiusmod tempor incididunt ut labore & et dolore magna aliqua.\\
\end{tabular}

\hrulefill

AFFECTS EVERY ROW:

\setlength\extrarowheight{6pt}
\begin{tabular}{p{4cm}p{4cm}}
  Lorem ipsum dolor sit amet consectetur & adipisicing elit \\
  sed do eiusmod tempor incididunt ut labore & et dolore magna aliqua.\\
  sed do eiusmod tempor incididunt ut labore & et dolore magna aliqua.\\
  sed do eiusmod tempor incididunt ut labore & et dolore magna aliqua.\\
\end{tabular}

\end{document}

enter image description here

share|improve this answer

If you do not have vertical lines, then this can be solved by

\noalign{\vspace{6pt}}

Full example:

\documentclass{article}

\begin{document}
  \begin{tabular}{p{4cm}p{4cm}}
    Lorem ipsum dolor sit amet consectetur & adipisicing elit\\
  \noalign{\vspace{6pt}}%
    sed do eiusmod tempor incididunt ut labore & et dolore magna aliqua.\\
  \end{tabular}
\end{document} 

Result

With \noalign vertical mode material can be added that is not subjected to the current table alignment.

The main disadvantage of this approach is that vertical lines get interrupted:

Result interrupted vertical lines

Therefore LaTeX uses this implementation for negative lengths. Then the problem with the vertical lines is much smaller, because they just overlap in most cases.

If the value is positive, then LaTeX adds an invisible rule. Height and width are zero, the depth is the sum of the given value and the depths of the standard tabular line, the depth of a strutbox increased by \arraystretch.

A better implementation would have keep track of the maximum depth of all cells in the row. The increased memory usage and slower run time might have been an noticeable issue in the early days of LaTeX. Nowadays implementing such a feature is no fun at all, because 99% of the implementation would have to deal with package compatibility (array, colortbl and many, many other table packages).

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.