1

Here is a minimal example that illustrates my problem.

\documentclass{article}

\begin{document}
\begin{tabular}{@{}lp{2cm}@{}}
\hline
Top left!  & This is a long cell \\\hline
Top left!  & This is another long cell \\\hline
Not top left!  & 
\begin{tabular}{@{}ll@{}}
cell1&cell2\\
cell3&cell4\\
cell5&cell6
\end{tabular}
\\\hline
\end{tabular}
\end{document}

The result looks like this:

enter image description here

My question: How to achieve that in the third row the first cell is vertically aligned at the top, as it is already the case for the two previous rows?

Why does the vertical alignment change?

1 Answer 1

2

I asked the question too quickly. The solution is counterintuitive, but still fairly simple.

For the inner tabular, we need to add the option [t] for vertical alignment. I kept trying to set the vertical alignment option for the outer tabular...

Here is the fixed solution:

\documentclass{article}

\begin{document}
\begin{tabular}{@{}lp{2cm}@{}}
\hline
Top left!  & This is a long cell \\\hline
Top left!  & This is another long cell \\\hline
Also top left!  & 
\begin{tabular}[t]{@{}ll@{}}
cell1&cell2\\
cell3&cell4\\
cell5&cell6
\end{tabular}
\\\hline
\end{tabular}
\end{document}

enter image description here

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.