Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've been trying to use lists of items in a table. This was easy to do but I could not find a way to align them in the same way as plain text in a table. Let me give an example:

\documentclass{article}

\usepackage{paralist}

\begin{document}

\begin{tabular}{|p{2cm}|p{10cm}|}
    \hline
    Blah blah & 
    \begin{compactitem}
        \item First
        \item Second
    \end{compactitem} \\    
    \hline
\end{tabular}

\end{document}

Instead of just itemize I used paralist so the list gets more compact, however there is still a lot of space added before and after the list. The result looks pretty awful, I would like to have the same spacing around "Blah Blah" as I have around the items in the right cell.

enter image description here

I've also found some tricks to reduce the space to the upper or lower \hline of the cell, but none of these could match the alignment with just plain text.

share|improve this question
Here's a solution which also provides an explanation for using \@minipagetrue: Preventing itemize environment to insert initial vertical space. Also, this question is about the very same problem: Including an itemized list within a tabular column using the paralist package. – Stefan Kottwitz Mar 9 '11 at 18:56

2 Answers

You could also use enumitem package. Using it you can access various useful settings as key-value pairs:

\usepackage{enumitem}
\begin{document}

\begin{tabular}{|p{2cm}|p{10cm}|}
    \hline
    Blah blah & \begin{itemize}[topsep=-0.5cm]\item First \item Second \end{itemize} \\    
    \hline
\end{tabular}
\end{document}

If that is not enough, you can manually kill space with \vspace*{-1.5mm}. Asterix ensures the space is added (in this case, because the number is negative, removed).

\documentclass[a4paper]{article}

\usepackage{enumitem}
\begin{document}

\begin{tabular}{|p{2cm}|p{10cm}|}
\hline
Blah blah & \vspace*{-0.2cm}\begin{itemize}[topsep=-0.5cm,leftmargin=0.3cm]\item a \item b \end{itemize}\\    
\hline
\end{tabular}

\end{document}

Both the answer and the result seem very ugly to me.

List in a table without spacing

share|improve this answer
\documentclass{article}

\usepackage{paralist,array}
\makeatletter\let\MPtrue\@minipagetrue\makeatother

\begin{document}

\begin{tabular}{|p{2cm}|p{10cm}|}
    \hline
    Blah blah & \MPtrue
    \begin{compactitem}
        \item First
        \item Second
    \end{compactitem} \\\hline
\end{tabular}

\end{document}
share|improve this answer
I don't need array for that, right? Also I do not understand what's the deal with minipage? Thx for the answer! – Nils Mar 9 '11 at 15:24
@Nils: yes, I had before >{\MPtrue}p{10cm} and then forgot to delete array. – Herbert Mar 9 '11 at 15:27
So the idea is basically to add \MPtrue to every cell which has items in it? I get very strange results with this, sometimes it appears not to work at all.. – Nils Mar 9 '11 at 15:30
@Nils: give an example where it does not work! – Herbert Mar 9 '11 at 15:32
Can't really reproduce it.. it seems to work for simple examples.. but it only removes the space before compactitem.. it's just another hack and not a real solution :( – Nils Mar 9 '11 at 15:42
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.