1

I feel like this is a noob question, but I've been busting my chops trying to find an answer to this.

I'm trying to create a table with two side by side paragraphs. They don't appear side by side when using a regular tabular. The problem can be worked around if I use \parbox, but occasionally I want to be able to use \mdframed on one side.

How do I get these two cells to line up?

\documentclass{article}
\usepackage{array}
\usepackage{mdframed}

\begin{document}
\begin{tabular}{p{.4\textwidth} | p{.58\textwidth}}


Hello from the other side.\\
I must have called 100 times.\\


&


To tell you I'm sorry for everything that I've done
But when I call you never seem to be home
Hello from the outside
At least I can say that I've tried
To tell you I'm sorry for breaking your heart
But it don't matter. It clearly doesn't tear you apart anymore.
\end{tabular}


\begin{tabular}{l | l}


\parbox[t][][t]{.4\textwidth}{Hello from the other side.\\
I must have called 100 times.\\
}

&

\parbox[t][][t]{.58\textwidth}{
To tell you I'm sorry for everything that I've done
But when I call you never seem to be home
Hello from the outside
At least I can say that I've tried
To tell you I'm sorry for breaking your heart
But it don't matter. It clearly doesn't tear you apart anymore.
}

\end{tabular}


\begin{tabular}{l | l}


\parbox[t][][t]{.4\textwidth}{Hello from the other side.\\
I must have called 100 times.\\
}

&

\parbox[t][][t]{.58\textwidth}{
\begin{mdframed}[linecolor=blue]
To tell you I'm sorry for everything that I've done
But when I call you never seem to be home
Hello from the outside
At least I can say that I've tried
To tell you I'm sorry for breaking your heart
But it don't matter. It clearly doesn't tear you apart anymore.
\end{mdframed}
}

\end{tabular}

\end{document}

enter image description here

Thanks.

6
  • 1
    one column uses b, the other p. Is that on purpose?
    – Johannes_B
    Commented Jan 31, 2016 at 15:34
  • 1
    you have aligned the baseline of each cell of the first column with the top of the second, use p for both Commented Jan 31, 2016 at 16:25
  • You're both right. However, the output doesn't change even when both are p. I'm editing the question to reflect that.
    – wolf_math
    Commented Jan 31, 2016 at 17:23
  • 1
    Repalace \\ with \newline or \par.
    – Salim Bou
    Commented Jan 31, 2016 at 18:37
  • @salimbou That works unless I'm using mdframed
    – wolf_math
    Commented Jan 31, 2016 at 18:54

1 Answer 1

1

Most of your problems are answered in comments (see Johannes_B and salim bou), regarding mdframed you probably want, that text is aligned. This can be possible only in case, if you use `mdframed on left side too but with white lines (that on white paper aren't visible):

enter image description here

\documentclass{article}
\usepackage{array}
\usepackage{mdframed}

    \begin{document}
\begin{tabular}{p{.4\textwidth} | p{.58\textwidth}}
Hello from the other side.\newline
I must have called 100 times.
    &   To tell you I'm sorry for everything that I've done
        But when I call you never seem to be home
        Hello from the outside
        At least I can say that I've tried
        To tell you I'm sorry for breaking your heart
        But it don't matter. It clearly doesn't tear you apart anymore.
    \end{tabular}

\begin{tabular}{p{.4\textwidth} | p{.58\textwidth}}
\begin{mdframed}[linecolor=white]
Hello from the other side.\newline
I must have called 100 times.
\end{mdframed}
    &   \begin{mdframed}[linecolor=blue]
        To tell you I'm sorry for everything that I've done
        But when I call you never seem to be home
        Hello from the outside
        At least I can say that I've tried
        To tell you I'm sorry for breaking your heart
        But it don't matter. It clearly doesn't tear you apart anymore.
        \end{mdframed}
\end{tabular}
    \end{document}

To have less vertical space before and after mdframed environment, you need redefine parameters accordingly.

You must log in to answer this question.

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