5

I am trying to align a minipage that has a list inside. Using a tabular environment for the list results in the minipage ignoring the [t] option (or any other, as far as I can tell). On the other hand, using a description environment yields the correct result, but I don't like how it aligns the item[]s with different length, and so would prefer using the tabular.

MWE:

\documentclass{article}
\begin{document}
    \textbf{One set of notes.}
    \begin{minipage}[t]{0.5\linewidth}
        \begin{tabular}{@{}r@{ }l@{}}
            Note 1: & This is the first note \\
            Note 2: & This is the second note \\
            Note 3: & This is the third note \\
            Note 4: & This is the fourth note \\
        \end{tabular}
    \end{minipage}

    \textbf{Another set of notes.}
    \begin{minipage}[t]{0.5\linewidth}
        \begin{description}
            \item[Note 1:] This is the first note \\
            \item[Note 2:] This is the second note \\
            \item[Note 3:] This is the third note \\
            \item[Note 4:] This is the fourth note \\
        \end{description}
    \end{minipage}
\end{document}

The result is shown in the image at the bottom.

Is there a way of using a tabular inside a minipage that acknowledges the vertical alignment?

Ignoring alignment option

1
  • 1
    You want \begin{tabular}[t]
    – egreg
    Commented Mar 21, 2015 at 21:16

1 Answer 1

5

The [t]op alignment of the minipage aligns it's content at the top of the anchor point of the minipage interior. Since the minipage interior has an anchor point in the middle - given by the tabular block, the minipage "top" results in the (vertical) middle of the block.

To avoid this, specify the tabular anchor point as being [t]op as well:

enter image description here

\documentclass{article}
\begin{document}
\textbf{One set of notes.}
\begin{minipage}[t]{0.5\linewidth}
  \begin{tabular}[t]{@{}r@{ }l@{}}
    Note 1: & This is the first note \\
    Note 2: & This is the second note \\
    Note 3: & This is the third note \\
    Note 4: & This is the fourth note \\
  \end{tabular}
\end{minipage}

\textbf{Another set of notes.}
\begin{minipage}[t]{0.5\linewidth}
  \begin{description}
    \item[Note 1:] This is the first note \\
    \item[Note 2:] This is the second note \\
    \item[Note 3:] This is the third note \\
    \item[Note 4:] This is the fourth note \\
  \end{description}
\end{minipage}
\end{document}

Since there are known problems with baseline settings in minipage/\parbox boxes, you may be better off setting the entire minipage-tabular combination in a nested tabular:

\begin{tabular}[t]{@{}p{0.5\linewidth}@{}}
  \begin{tabularx}{\linewidth}[t]{@{}r@{ }X@{}}
    Note 1: & This is the first note \\
    Note 2: & This is the second note \\
    Note 3: & This is the third note \\
    Note 4: & This is the fourth note \\
  \end{tabularx}
\end{tabular}

I've inserted a tabularx inner to allow for a fixed-width 0.5\linewidth structure.

You must log in to answer this question.

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