24

I'm using itemize and tables like the following

\begin{tabularx}{\textwidth}{>{\ttfamily}llX}
 \toprule
 \textbf{\rmfamily Operator} & \textbf{Typen} & \textbf{Regel} \\
 \midrule
 = & Alle Typen &
  \begin{itemize}
   \item This is how we roll
   \item Maybe we can talk?
  \end{itemize} \\
 \bottomrule
\end{tabularx}

But it keeps inserting a vertical space before the itemized list. How can I prevent it from doing so?

2 Answers 2

32

Lists like itemize act differently if they are used within a minipage environment. Specifically, they don't insert that vertical space before. So, you could use a minipage environment inside the table cell for the itemize list. There's a trick which is more handy - define this command:

\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother

Now just use \compress before \begin{itemize}. You could even use it within the column definition, if you also load the array package:

\usepackage{array}
...
\begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\compress}X}

Output of your example using this command:

alt text

The vertical space before itemize is gone. If you would like to compress the lists even more, have a look at

  • the paralist package, which offers a compactitem environment for that purpose, or

  • the enumitem package which allows easy customization of list environments, for example \begin{itemize}[itemsep=0pt], it even provides global configuration commands for lists.

But even with \begin{itemize}[itemsep=0pt,topsep=0pt] I would additionally use \compress.

7
  • Ohh i see. Any idea why it adds that space by default? Is that so one doesn't have to issue a ` \\ ` in the normal usecase before the lists? Where can one find information such as \@minipagetrue? Is that listed in some manual somewhere? What other stuff is affected by that special "magic" command? I'm trying to avoid a minipage, because I generally don't know the width of the X column of the table, but I would need to know it for the minipage. Commented Dec 4, 2010 at 3:13
  • 1
    \begin{itemize}[itemsep=0pt,topsep=0pt] was the first thing I tried. It had a smaller amount of space, but it was still there. I didn't look into why. Do you have any idea why?
    – TH.
    Commented Dec 4, 2010 at 6:59
  • 2
    @TH.: Lists use \addvspace. This command doesn't add vertical space if @minipage is true. This way the minipage environment avoids extra vertical space at the top. We do the same here for lists - so \topsep and perhaps other values used at the beginning of the list don't matter any more.
    – Stefan Kottwitz
    Commented Dec 4, 2010 at 13:54
  • 2
    @Johannes: In source2e.pdf, 16.5 Vertical spacing, you can find the information regarding \addvspace and @minipage. List items then set \@minipage to false using \everypar.
    – Stefan Kottwitz
    Commented Dec 4, 2010 at 13:58
  • 1
    Ah, thanks. I'm not sure I understand the rationale behind that design. As this question shows, there are situations other than minipages one might wish to not have such space.
    – TH.
    Commented Dec 4, 2010 at 22:14
2

Also consider something like this:

\usepackage{enumitem}
....
\begin{itemize}[nosep, leftmargin=5mm]
    \item Satisfy individual's needs for affiliation
    \item Develop individual's sense of identity
    \item Reduce individual's axiety and feelings of insecurity and powerlessness
\end{itemize}

The nosep kills all vertical spacing, leftmargin halves the horizontal space between the table left border and the bullets

1

You must log in to answer this question.

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