# spacing in description with items wrapped in minipage

I'm trying to prevent items in description environment from breaking by wrapping each one in a minipage. (Perhaps that's not a good approach, but let's put that aside if we can for my question.)

When I do this, I have extra space above the first item, and missing space after each item. I have every vertical space dimension I can think of set to 0, trying to hunt this down. What controls these vertical spaces?

\documentclass{article}

\usepackage{enumitem,blindtext}

\setlength{\parskip}{0cm}
\setlength{\parindent}{0cm}
\setlength{\topskip}{0cm}
\setlength{\topmargin}{0cm}
\setlength{\smallskipamount}{0cm}
\setlength{\medskipamount}{0cm}
\setlength{\bigskipamount}{0cm}

\begin{document}
\blindtext%
\begin{description}[
topsep=0cm, %additional vertical space beyond regular inter-line space; applies both above and below description
partopsep=0cm, %if description starts a new paragraph, this is added to topsep
parsep=0cm, %vertical separation between paragraphs within an environment; includes between items
itemsep=0cm, % Extra separation added to parsep, but only between items
leftmargin=1cm, % Horizontal indent
rightmargin=0cm, %Horizontal cut from right edge; includes first line too.
listparindent=0cm, %For new paragraphs inside an item, how much to indent; doesn't apply to first paragraph
labelwidth=0cm, % Horizontal indentation where content picks up after title. If title is longer, content pushed right, but future items still begin this far inward
labelsep=0cm, % Horizontal space after the title
itemindent=0cm, % How much to indent first line of item
]
\begin{minipage}[t]{\linewidth}
\vspace{0pt}
\item[1.] There is extra space above this item. Where does it come from? There is missing space below this item. Where did it go?
\end{minipage}%
\par
\begin{minipage}[t]{\linewidth}
\vspace{0pt}
\item[2.]\blindtext

\blindtext
\end{minipage}%
\end{description}
There is space missing after the second item too at the end of the description.
\end{document}

• I've noted that removing the top-alignment [t] from the minipages clears up the extra space at the top, but there is still missing space under each item. Also, I'd like to understand why removing the [t] clears the space at the top. Mar 22 '15 at 18:08
• What do you mean with "breaking"? Are you referring to hyphenation? I really don't understand what you want... Please, clarify it. Apr 22 '15 at 2:05
• @CarlosViegas I mean column breaking or page breaking. So the whole item, which may contain say one to five lines, never requires you to move to a new column or page to read it through. These items are textbook exercises, and even though this will be aesthetically less pleasing, it's practical for students who sometimes fail to realize there is more to the item at the top of the next page/column. Apr 22 '15 at 4:05

I think I figured it out, but commentary is welcome. The top of the minipage is not automatically one baselineskip above the bottom of the first line in the minipage. If I put a \strut right after \item[1.], \item[2.], etc, then it ensures the top of the minipage is a full baselineskip above the base of the first line of the item. So then the top of the minipage is flush with the baseline of the preceding line, and the net effect is one baselneskip between baselines.

And if I put a \strut right after the description ends, it ensures the next line behaves as desired as well, although I understand the why behind this one less well.

To be more specific, the vertical space above the first item is caused by the \vspace{0pt} that you put at the beginning of the minipage[t]: according to TeX’s rules for computing the height of a \vtop box (the kind of box that minipage[t] constructs), this results in a box with zero height and all its contents “pushed down” below the baseline, contributing to its depth. When this box is stacked below the preceding lines, the \baselineskip glue is added in order to make the baseline of the minipage (which, for what we have just said, coincides with the upper edge of the text contained therein) 12pt apart from the previous baseline, and this is where the additional space comes from.

I’ll not dwell any longer on analyzing how the boxes of your example abut each other, also because you have already spoken of the use of \strut. Rather, I would like to comment on the use of minipage for the sake of avoiding page breaks within items, and on the fact that, indeed, this is “not a good approach”. If none of your items is more than one paragraph long, you could instead set \interlinepenalty to a value greater or equal to 10000, in order to prohibit page breaks within paragraphs. Here is a minimal working example, which also honors your request for no vertical spacing between items and above and below the whole list:

\documentclass{article}
\usepackage{enumitem,lipsum}

\begin{document}
\lipsum[1]
\begin{description}[
nosep, % kills all vertical spacing
before={\interlinepenalty=10000} % prohibit page breaks within
% paragraphs
]
\item[First label]  \lipsum[2]
\item[Second label] \lipsum[3]
\item[Third label]  \lipsum[4]
\item[Fourth label] \lipsum[5]
\item[And so on]    \lipsum[6]
\end{description}
\lipsum[7]
\end{document}


Of course, this approach still permits a page break bewteen two paragraphs of the same item, if an item happens to include more than one paragraph; but for simple situations it works neatly. Obviously, in the optional argument of the description environment you could add other keys for setting the horizontal alignment of labels.