2

I want to horizontally align two cells with two lines in a table environment, something like this:

-------------------
| A long    | foo |
|           | ----|
| multiline | bar |
-------------------

What I'm getting is a blank line under foo as the long multi-line takes up more vertical space, and bar is pushed down. In this image, I don't want the blank space between 'First text' and 'Second text', or 'Second text' and 'Third text'.

Lines not correct

I thought putting the top left cell into a minipage would make it flow into the blank space I provided in the second row, but that didn't work. My MWE is below.

How can I align my cells correctly?

Here's my MWE:

\documentclass{article}

\begin{document}

\begin{table}[tb]
    \begin{center}
        \begin{tabular}{p{0.3\textwidth}p{0.6\textwidth}}
        \hline
        \begin{minipage}[t]{0.3\textwidth} A long\\line\end{minipage} & First text\\
                                                                      & Second Text\\
        A second\\Line & Third Text\\
                       & Fourth Text\\
        \hline
        \end{tabular}
    \end{center}
\end{table}

\end{document}
1

Two options:

\documentclass{article}
\usepackage{multirow}

\begin{document}

\begin{table}
\centering
\begin{tabular}{p{0.3\textwidth}p{0.6\textwidth}}
\hline
A long & First text\\
line & Second Text\\
\multirow{2}{*}{\parbox{0.3\textwidth}{A second\\ Line}} & Third Text\\
 & Fourth Text\\
\hline
\end{tabular}
\end{table}

\end{document}

enter image description here

  • With the first example, is there any difference in spacing between the lines if I spread them over two cells? I can't see one, but I wouldn't expect it to be big if it existed. – simont Aug 12 '13 at 5:34
  • @simont Sirry, but I'm afraid I don't understand your question. Which lines would be spread over which cells? – Gonzalo Medina Aug 12 '13 at 13:19

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.