3

It's almost embarrassing to ask: How can I vertically align the contents of one column to the top beside a second column holding nested tables. Please have a look at the minimal working example:

\documentclass{article}

\usepackage{booktabs}

\begin{document}

\begin{tabular}{cl}
  \textbf{top/center} & \textbf{top/left} \\
  \midrule
  foo &
  \begin{tabular}{ll}
    bla & blub \\
    bla & blub \\
    bla & blub \\
  \end{tabular} \\
  \midrule
  bar &
  \begin{tabular}{ll}
    bla & blub \\
    bla & blub \\
    bla & blub \\
    bla & blub \\
  \end{tabular} \\
\end{tabular}

\end{document}

In this example, "foo" and "bar" should be aligned to the top vertically and to the center horizontally. The nested tables should be aligned top left.

The contents of the tables are filled dynamically. Thus, I cannot apply tricks like using \raisebox or something (or at least I don't know how to apply such tricks dynamically in my case).

5

You can use [t] option on any tabular to top align it.

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{cl}
  \textbf{top/center} & \textbf{top/left} \\
  \midrule
  foo &
  \begin{tabular}[t]{ll}
    bla & blub \\
    bla & blub \\
    bla & blub \\
  \end{tabular} \\
  \midrule
  bar &
  \begin{tabular}[t]{ll}
    bla & blub \\
    bla & blub \\
    bla & blub \\
    bla & blub \\
  \end{tabular} \\
\end{tabular}
\end{document}

enter image description here

  • Like I said, really embarrassing! ;) Thanks for your answer. That did the trick. But I find it somewhat surprising: I set the vertical alignment of the tables in the right column, which affects the alignment of "foo" and "bar" outside of these tables in the left column... oO – Flinsch Dec 1 '11 at 12:22
  • look at this previous questions problem-with-table-vertical-alignment, how-to-vertically-center-the-text-of-the-cells. May be they help you to understand it. You can also look at Related questions on the right. – Ignasi Dec 1 '11 at 15:20

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.