possible memoir bug with font sizes and \tightlists

It looks to me like memoir is not honoring \tightlists for certain font sizes (nor firmlists, btw). A picture is worth a thousand words:

The source code for the screenshot is included below. You can comment/uncomment the \tightlists and \firmlists to see what happens. Only with both lines commented do we correcly get decreasing-height boxes. (but then the lists are not tight anymore :-)

Did I really find a bug, or did I miss something obvious ?

MWE:

\documentclass[12pt]{memoir}
% \documentclass[12pt]{article}

\usepackage{printlen}

\newlength{\demoboxheight}

\newcommand{\demo}[1]{%
\settoheight{\demoboxheight}{\fbox{\parbox{.5\textwidth}{\begin{#1}
\begin{itemize}
\item dummy
\item dummy
\item dummy
\end{itemize}
\end{#1}
}}}
\fbox{\parbox{.5\textwidth}{\begin{#1}
\begin{itemize}
\item font size: #1
\item height: \uselengthunit{pt}\printlength{\demoboxheight}
\item which is: \uselengthunit{mm}\printlength{\demoboxheight}
\end{itemize}
\end{#1}
}}
}

\tightlists
% \firmlists

\begin{document}

\demo{Large}

\demo{large}

\demo{normalsize}

\demo{small}

\demo{footnotesize}

\demo{scriptsize}

\demo{tiny}

\end{document}



In common with the standard article class, memoir only sets up a full set of size parameters for some of the available sizes. If you switch to \tiny for example the list parameters are not changed so the list gets the prevailing settings, which are the ones for normalsize here as all the changes are in local groups, but if you switch from \footnotesize to \tiny you would get the footnotesize settings in the tiny list.

Some aspects are tied to the font size, such as the linespacing and bullet etc, but the spacing between items and before and after lists is not specified at most font changes.

The relevant code is copied below, it is the setting (or not) of \@listi for first level lists that is of interest here.

\ProvidesFile{mem12.clo}%
[2010/10/19 v0.4b memoir class 12pt size option]
\renewcommand{\normalsize}{%
\@setfontsize\normalsize\@xiipt{14.5}%
\abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@
\abovedisplayshortskip \z@ \@plus3\p@
\belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
\belowdisplayskip \abovedisplayskip
\let\@listi\@listI}
\normalsize
\newcommand{\small}{%
\@setfontsize\small\@xipt{13.6}%
\abovedisplayskip 11\p@ \@plus3\p@ \@minus6\p@
\abovedisplayshortskip \z@ \@plus3\p@
\belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
\def\@listi{\leftmargin\leftmargini
\topsep 9\p@ \@plus3\p@ \@minus5\p@
\parsep 4.5\p@ \@plus2\p@ \@minus\p@
\itemsep \parsep
%%               \itemindent\z@
}%
\belowdisplayskip \abovedisplayskip
}
\newcommand{\footnotesize}{%
\@setfontsize\footnotesize\@xpt\@xiipt
\abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
\abovedisplayshortskip \z@ \@plus3\p@
\belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
\def\@listi{\leftmargin\leftmargini
\topsep 6\p@ \@plus2\p@ \@minus2\p@
\parsep 3\p@ \@plus2\p@ \@minus\p@
\itemsep \parsep
%%               \itemindent\z@
}%
\belowdisplayskip \abovedisplayskip
}
\newcommand*{\miniscule}{\@setfontsize\miniscule\@viipt{8}}
\newcommand*{\tiny}{\@setfontsize\tiny\@viiipt{9.5}}
\newcommand*{\scriptsize}{\@setfontsize\scriptsize\@ixpt\@xpt}
\newcommand*{\large}{\@setfontsize\large\@xivpt{18}}
\newcommand*{\Large}{\@setfontsize\Large\@xviipt{22}}
\newcommand*{\LARGE}{\@setfontsize\LARGE\@xxpt{25}}
\newcommand*{\huge}{\@setfontsize\huge\@xxvpt{30}}
\ifextrafontsizes
\newcommand*{\Huge}{\@setfontsize\Huge\@xxxpt{37}}
\newcommand*{\HUGE}{\@setfontsize\HUGE\@xxxvipt{45}}
\else
\let\Huge=\huge
\let\HUGE=\huge
\fi


So it's expected that some sizes handle lists more completely, however \tightlists compounds the problem by setting list settings to 0pt via setting for example) \itemsepi to 0. This means that the sizes that do not customise lists get the tight spacing, but sizes that do customize lists do not, as they do not use \itemsepi they directly set \itemsep.

Fortunately there appears to be a tightlist (no s) you can use after a size change to reset (some of) the parameters to zero. but it has to be used inside the list:

\documentclass[12pt]{memoir}
% \documentclass[12pt]{article}

\usepackage{printlen}

\newlength{\demoboxheight}
\makeatletter
\newcommand{\demo}[1]{%
\settoheight{\demoboxheight}{\fbox{\parbox{.5\textwidth}{\begin{#1}
\begin{itemize}\tightlist
\item dummy
\item dummy
\item dummy
\end{itemize}
\end{#1}
}}}
\fbox{\parbox{.5\textwidth}{\begin{#1}
\begin{itemize}\tightlist
\item font size: #1
\item height: \uselengthunit{pt}\printlength{\demoboxheight}
\item which is: \uselengthunit{mm}\printlength{\demoboxheight}
\item \texttt{\meaning\@listi}
\item \texttt{\the\itemsep}
\end{itemize}
\end{#1}
}}
}

\tightlists
% \firmlists

\begin{document}

\demo{Large}

\demo{large}

\demo{normalsize}

\demo{small}

\demo{footnotesize}

\demo{scriptsize}

\demo{tiny}

\end{document}

• Thanks David. All your explanation is way above my head, and at the end of the day I still don't know whether this behaviour is a bug or a feature (even memoir seems to have its lot of counter-intuitive impossible-to-guess voodoo !). But your \tightlist workaround does what I wanted, so I'm going to stick to that for now. Cheers.
– Gyom
Oct 23, 2014 at 8:42
• @Gyom yes sorry about that I don't really know memoir I started to answer one way (as if it had been article) then looking at the sources I saw the situation is more complicated in memoir. It may be worth submitting a report to the memoir maintainers pointing at this (one reason I put full references to the sources, in case they pass by:-) you may or may not be amused by something I posted to chat earlier this morning: chat.stackexchange.com/transcript/message/18284212#18284212 Oct 23, 2014 at 8:53
• Yep, amusing indeed ! I am now going to report a but though, because I noticed that even with both \tightlists and \tightlist, "small" and "footnotesize" itemizes do get too much whitespace around them: i.imgur.com/a8owzi6.png
– Gyom
Oct 23, 2014 at 9:23
• I would say it is a bit of a bad choice. As analysed by @DavidCarlisle the \def\@listi{ kills it. Though I have not quited figured out why it actually work in the first place as \normalsize also resets it (though does not redefine it) to a stored value. IMO the list features in memoir is not that great, and people should really use enumitem as I've also mentioned in the manual. I'll add a warning. (This might also explain some strange typography features I've seen in the manual ;-) Nov 5, 2014 at 10:12

So I followed daleif's comment, which solved my issue. Thanks daleif !

For posterity, the moral of the story: instead of saying \tightlists, use enumitem:

\usepackage{enumitem}
\setlist{nosep}