# Why does the vertical alignment not match the expected behaviour at p columns in tabular env?

I have the following code:

\documentclass{scrartcl}
\begin{document}
\begin{tabular}{lp{5cm}}
a &
\begin{itemize}
\item sd
\end{itemize}\\
\end{tabular}
\end{document}


I want to get a table with a on the left side and a list (only one entry at the moment) on the right.

What I get is that the list is positioned below the a (seems to be aline below).

Can you tell me what is wrong here?

-
What is your expected behavior when there are more than 1 item? –  hpesoj626 Dec 7 '12 at 13:33
–  mythealias Dec 7 '12 at 13:33

The space is there because inside the cell, a paragraph is first started, then it's ended and your itemize starts. You can wrap the code inside minipage to get the desired output:

\documentclass{scrartcl}
\begin{document}
\begin{tabular}{ll}
a & \begin{minipage}{5cm}
\begin{itemize}
\item sd
\end{itemize}\end{minipage}\\
\end{tabular}
\end{document}


However, I would prefer to make an environment of its own:

\documentclass{scrartcl}

\newenvironment{tabitemize}[1][5cm]{\minipage{#1}\begin{itemize}}{\end{itemize}\endminipage}

\begin{document}
\begin{tabular}{ll}
a & \begin{tabitemize}[5cm]
\item sd
\end{tabitemize}\\
\end{tabular}
\end{document}


Notice that I made the width as an optional arugument (I suppose you'll fix one width value). As well, I use the direct call to \minipage...\endminipage to avoid one unnecessary grouping.

According to suggest by azetina and A.Ellet I propose another version:

\documentclass{scrartcl}

\usepackage{tabularx}

\newenvironment{tabitemize}[1][\hsize]%
{\minipage[t]{#1}\begin{itemize}}%
{\end{itemize}\endminipage}

\usepackage{lipsum,showframe} % not needed

\begin{document}

\noindent
\begin{tabularx}{\linewidth}{@{}l@{}X@{}}
Hello & \begin{tabitemize}
\item \lipsum[1-2] % lipsum command just produces some dummy text
\item \lipsum[3]
\end{tabitemize}\\
\end{tabularx}

\end{document}

• We use tabularx to use the whole width of a page.
• We set the argument to minipage to \hsize which seems to be the right approach according to tabularx manual
• We set [t] argument to minipage to get the right vertical alignment
• By @{} we remove the (probably unnecessary) horizontal spaces.

-

@tohecz solution works quite well. But what if you want the first item of the list to align on the baseline of the content in the first column. You could take tehecz solution and modify it slightly to get

\documentclass{scrartcl}
\newenvironment{tabitemize}[1][5cm]{\begin{minipage}[t]{#1}\begin{itemize}}{\end{itemize}\end{minipage}}
\begin{document}
\begin{tabular}{ll}
a & \begin{tabitemize}[5cm]
\item first item
\item second item
\end{tabitemize}\\
\end{tabular}
\end{document}


Unfortunately, I had to introduce a new grouping (unless tohecz knows about to do this more directly) to tell the minipage that I wanted the baseline set on the first line. That's what the optional argument [t] to the minipage environment is doing.

-
It would be good if the width of the minipage uses the remaining textwidth space –  azetina Dec 7 '12 at 14:24