4

I'm trying to make a table with three columns, the first two being aligned on a row-by-row basis (the usual way) but with the third column only aligning with the first two at the top. Here's what I've tried:

\documentclass[landscape,letterpaper,11pt]{article}

\usepackage[left=0.5in,top=0.5in,right=0.5in,bottom=0.5in,nohead]{geometry}
\pagestyle{empty}

\begin{document}

\begin{table}[h]
\begin{tabular}{p{0.6\textwidth}p{0.3\textwidth}}
\begin{tabular}{p{0.3\textwidth}p{0.3\textwidth}}
This is aligned with the first equation & $\displaystyle x^2 + y^2 = z^2 $ \\
This is aligned with the second equation & $\displaystyle e^{i\theta} = \cos(\theta) + i\sin(\theta)$
\end{tabular}
&
\begin{itemize}
\item Bullets.
\item Go with the table in general.
\item The top of the first bullet should be aligned with the tops of the rest of the table.
\end{itemize}
\end{tabular}
\end{table}

\end{document}

The problem is that the tops of the three columns aren't aligned when I do this. Where am I going wrong?

5
  • 2
    The inner tabular should be \begin{tabular}[t]{...}; then there's the usual problem of starting an itemize without vertical space before it.
    – egreg
    Commented Oct 10, 2012 at 13:43
  • @egreg Bingo! Now I just need to remind myself of how to start itemize without vertical space before it. Commented Oct 10, 2012 at 13:45
  • There should be something in the site. Let me try find it.
    – egreg
    Commented Oct 10, 2012 at 13:47
  • 1
    @egreg This seems to be what you're talking about: tex.stackexchange.com/questions/6445/… Commented Oct 10, 2012 at 13:49
  • @egreg Those two things together solve the problem. If you post it as an answer then I'll accept it. Commented Oct 10, 2012 at 13:53

2 Answers 2

3

First of all, the inner tabular should be declared [t] (top aligned). In order to remove the space before itemized lists in p cells, there are various ways.

If you always have a single itemized list in those cells, the following slight modification of this answer by Danie Els might do:

\documentclass[landscape,letterpaper,11pt]{article}
\usepackage{calc,array}
\usepackage[left=0.5in,top=0.5in,right=0.5in,bottom=0.5in,nohead]{geometry}
\pagestyle{empty}

\makeatletter
\newcolumntype{i}[1]{%
    >{\minipage[t]{\linewidth}\arraybackslash\itemize}
    p{#1}%
    <{\@finalstrut\@arstrutbox\enditemize\endminipage}}

\makeatother

\begin{document}

\noindent
\begin{tabular}{@{}p{0.6\textwidth}i{0.4\textwidth-2\tabcolsep}@{}}
\hline
\begin{tabular}[t]{@{}p{0.3\textwidth-\tabcolsep}p{0.3\textwidth-\tabcolsep}@{}}
This is aligned with the first equation & $\displaystyle x^2 + y^2 = z^2 $ \\
This is aligned with the second equation & $\displaystyle e^{i\theta} = \cos(\theta) + i\sin(\theta)$
\end{tabular}
&
\item Bullets.
\item Go with the table in general.
\item The top of the first bullet should be aligned with the tops of the rest of the table.
\\
\hline
\end{tabular}

\end{document}

(The rules are just to show the spacings and the alignments.)

Notice how I computed the width of the table columns so that they completely fill the line (the calc package is needed for this).

If your last column cells don't always have only an itemized list, then including the lists in \begin{minipage}[t]{\linewidth}...\end{minipage} will do in (almost) the same way. The column should, of course, be declared as p{...}.

enter image description here

1

egreg's solution was more than I needed, so I ended up going with this slightly simpler version based on his comments:

\documentclass[landscape,letterpaper,11pt]{article}

\usepackage[left=0.5in,top=0.5in,right=0.5in,bottom=0.5in,nohead]{geometry}
\pagestyle{empty}

% http://tex.stackexchange.com/questions/6445/preventing-itemize-environment-to-insert-initial-vertical-space
\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother

\begin{document}

\begin{table}[h]
\begin{tabular}{p{0.6\textwidth}p{0.3\textwidth}}
\begin{tabular}[t]{p{0.3\textwidth}p{0.3\textwidth}}
This is aligned with the first equation & $\displaystyle x^2 + y^2 = z^2 $ \\
This is aligned with the second equation & $\displaystyle e^{i\theta} = \cos(\theta) + i\sin(\theta)$
\end{tabular}
&
{\compress}
\begin{itemize}
\item Bullets.
\item Go with the table in general.
\item The top of the first bullet should be aligned with the tops of the rest of the table.
\end{itemize}
\end{tabular}
\end{table}

\end{document}

You must log in to answer this question.

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