I'm preparing an exam and I want an illustration next to a multiple-choice problem. Usually for this purpose I put the question and/or choices in a multicols
environment; however for this particular question the fifty-fifty split of the page width by multicols
makes the text of every option wrap, while the image is fairly narrow.
I thought I could get what I wanted by putting the choices in a minipage
, but the minipage changes the spacing between the choices:
\documentclass{article} %% 'exam' class not needed for MWE
\begin{document}
\begin{enumerate}
\item
This is a standard nested enumeration.
\begin{enumerate}
\item Spacing within wrapped text and between lines of the enumeration
looks okay to me.
\item adsflkj adsflkj
\item qeworui qeworui
\item zcx,vmn zcx,vmn
\item lkjasdf lkjasdf
\item mbnnert mbnnert
\end{enumerate}
\item
The possible answers to this question are in a minipage,
to accomodate an image to the right
\begin{minipage}[t]{0.6\linewidth}
\begin{enumerate}
\item Spacing within wrapped text is the same, but the spacing
between items is different.
\item adsflkj adsflkj
\item qeworui qeworui
\item zcx,vmn zcx,vmn
\item lkjasdf lkjasdf
\item mbnnert mbnnert
\end{enumerate}
\end{minipage}
\hfill
\fbox{Tikz image here}
\end{enumerate}
\end{document}
The difference annoys me. How can I repair it?
(I can hack it away, more or less, by doing \addtolength{\itemsep}{-1ex}
in the minipage. But displaying \the\itemsep
in various places shows that \itemsep
isn't actually the length that's being secretly changed. I'd rather understand what's actually happening.)
Best Answer
A
minipage
does explicitly reset the list depth, seelatex.ltx
for this, in line 4886 following code can be found:The important thing is
\@mplistdepth\z@
,meaning zero list depth -- The innerenumerate
environment behaves like being on the first level again, using the\itemsep
value 'appropiate' for this level, being4.0pt plus 2.0pt minus 1.0pt
in this case. (The same is true foritemize
). The other spacings are used then as well as if would be on the first level of an enumeration/itemize environment, this is the reason for the indentation of(a)
etc. as can be seen from the image in the OP.Interestingly, the enumeration counter format is not reset, because
\@enumdepth
still has the value 2 then (being the second level).One cheap trick is to set the
\@mplistdepth
counter explicitly to1
, manually, how ever.A 'better' way is to patch
@iiiminipage
(the innermost level of theminipage
'environment' and make it aware that it should preserve the list depth, depending on a conditional:Say
\mpsavelistdepthtrue
if the preserving should be enabled and\mpsavelistdepthfalse
to disable it.This works for
enumerate
environments only, since\@enumdepth
deals withenumerate
, not withitemize
(the relevant depth counter is\@itemdepth
then)