# Within table, vertically align top of a list and normal text in horizontally adjacent cells

I am making a table where two of the columns constitute a pros/ cons list. I have created a custom list environment with minimal white space around it for this purpose. However, I still find that the top of the lists are rendered a little below the corresponding normal text in the Methods column to their left. Based on the diagram here, I thought this would be accomplished with \topsep=0em \parsep=0em \partopsep=0em but that still leaves a vertical discontinuity.

Below is a MWE example of where I am currently, along with the output. Can someone tell me how to modify this to vertically align tops of the list text and normal text, e.g. align "One downside" with "First method name" and "Good results" with "Second method."

\documentclass[12pt, oneside]{report}
\renewcommand{\baselinestretch}{1.2}

\usepackage[english]{babel}

\usepackage{booktabs}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{array}

\newenvironment{compactlist}{ % List with minimal white space to fit in small areas, e.g. table cell
\begin{list}{$\bullet$}{\leftmargin=0.5em \rightmargin=0em \topsep=0em \parskip=0em \parsep=0em \listparindent=0em \partopsep=0em \itemsep=0pt \itemindent=0em \labelwidth=\leftmargin\labelsep+0.25em}
}{
\end{list}
}

\begin{document}

\begin{table}[htpb]
\centering
\footnotesize

\begin{tabular}{ p{2cm} | p{3cm} | p{4cm}  | p{4cm}}
\toprule
\cmidrule(r){1-2}

\centering \textbf{Class} & \textbf{Method} & \textbf{Pros} & \textbf{Cons} \\
\midrule

\multirow{2}{*}{\begin{minipage}[c]{\linewidth}\centering \textbf{Class 1 name}\end{minipage}}

& First method name with linebreak
& \begin{compactlist}
\item One downside
\end{compactlist}
& \begin{compactlist}
\item Another downside with longer text to create a linebreak or two
\end{compactlist} \\

& Second method
&  \begin{compactlist}
\item Good results
\item Fast
\end{compactlist}
& \begin{compactlist}
\item Expensive
\end{compactlist} \\
\bottomrule
\end{tabular}
\end{table}
\end{document}


-
Please have a look at: Enumerate/itemize without margins in table cell best practice –  Marco Daniel Oct 30 '11 at 19:50

You should enclose the list within a \minipage:

\newenvironment{compactlist}{ % List with minimal white space to fit in small areas, e.g. table cell
\begin{minipage}{\linewidth}\begin{list}{$\bullet$}{\leftmargin=0.5em \rightmargin=0em \topsep=0em \parskip=0em \parsep=0em \listparindent=0em \partopsep=0em \itemsep=0pt \itemindent=0em \labelwidth=\leftmargin\labelsep+0.25em}
}{
\end{list}\end{minipage}
}


and if you include the [t] optional parameter as in \begin{minipage}[t]{\linewidth} you get:

Update: As the OP commented, the data in the first column was slightly below where it should be. One way to fix that is to use the [t] option as mentioned above along with:

\multirow{2}{*}{\begin{minipage}[c]{\linewidth}\centering \textbf{Class 1 name}\end{minipage}}


Here is the complete code:

\documentclass[12pt, oneside]{report}
\renewcommand{\baselinestretch}{1.2}

\usepackage[english]{babel}

\usepackage{booktabs}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{array}

\newenvironment{compactlist}{ % List with minimal white space to fit in small areas, e.g. table cell
\begin{minipage}[t]{\linewidth}\begin{list}{$\bullet$}{\leftmargin=0.5em \rightmargin=0em \topsep=0em \parskip=0em \parsep=0em \listparindent=0em \partopsep=0em \itemsep=0pt \itemindent=0em \labelwidth=\leftmargin\labelsep+0.25em}
}{
\end{list}\end{minipage}
}

\begin{document}

\begin{table}[htpb]
\centering
\footnotesize

\begin{tabular}{ p{2cm} | p{3cm} | p{4cm}  | p{4cm}}
\toprule
\cmidrule(r){1-2}

\centering \textbf{Class} & \textbf{Method} & \textbf{Pros} & \textbf{Cons} \\
\midrule

\multirow{2}{*}{\begin{minipage}[c]{\linewidth}\centering \textbf{Class 1 name}\end{minipage}}

& First method name with linebreak
& \begin{compactlist}
\item One downside
\end{compactlist}
& \begin{compactlist}
\item Another downside with longer text to create a linebreak or two
\end{compactlist} \\

& Second method
&  \begin{compactlist}
\item Good results
\item Fast
\end{compactlist}
& \begin{compactlist}
\item Expensive
\end{compactlist} \\
\bottomrule
\end{tabular}
\end{table}
\end{document}


Another option is to enclose the list content within a \parbox, but I think the \minipage solution is simpler.

-
Hi Peter, thanks! That mostly fixes the problem. But I notice that now the class name (first column) has dropped slightly below the Method column entry. Do you know why this is? I tried non-bold, and also tried changing its minipage parameter to [t] but neither of these helped. Do you know how to fix this? Thanks. –  SSilk Oct 30 '11 at 2:06
@SSilk: You could fix this new problem by replacing the daunting-looking string \multirow{2}{*}{\begin{minipage}[c]{\linewidth}\centering \textbf{Class 1 name}\end{minipage}} with \multicolumn{1}{c}{\textbf{{Class 1 name}}}. Cheers. –  Mico Oct 30 '11 at 13:00
@Mico: Your suggestion causes the data to go across into the next column as opposed to flowing vertically. –  Peter Grill Oct 30 '11 at 19:29
@SSilk: Have updated the solution per your comment. –  Peter Grill Oct 30 '11 at 19:29
@PeterGrill: Thanks. I guess \centering \textbf{Class 1 name} avoids this problem. –  Mico Oct 30 '11 at 21:12