8

I need to add some vertical space between two lines in a p-column of a tabular. Outside of a table I'd use \\[1ex], but inside of a table I have to use \newline which doesn't have an optional argument for extra vertical space. So how can I get the vertical space?

3 Answers 3

6

Get yourself a copy of the macro that does the real work when \\ is found in normal circumstances:

\documentclass{article}

\expandafter\let\expandafter\pnewline\csname\string\ \endcsname


\begin{document}
\begin{tabular}{|p{5cm}|l|}
some text with\pnewline[1cm]
a forced line break
&
Second
\end{tabular}
\end{document}

enter image description here

Explanation. The usual definition of \\ is

\DeclareRobustCommand{\\}{...}

so the macro doing the real work is named \\⍽ (with a trailing space in the name). We can access that macro with \csname\string\ \endcsname.

I don't think it's necessary to make \pnewline robust, as long as you use it only in tabular cells.

4

This works (but is obviously not for general use):

\makeatletter\@newline[1.1mm]\makeatother

\@newline is the internal macro that does the \\[foo] stuff.

3

Use \par \vpsace{1ex}

\documentclass{article}
\usepackage{lipsum}

\begin{document}
\begin{tabular}{p{25em}}
    \lipsum[1] \par \vspace{5ex} \lipsum[1] \\
\end{tabular}
\end{document}
1
  • \par does a bit too much: The next line may be indented (by \parindent) and TeX executes \everypar. Jul 23, 2013 at 10:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .