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).

Moriambar
  • 11,466
Flinsch
  • 233

1 Answers1

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

Werner
  • 603,163
Ignasi
  • 136,588