# Conflict between mathdesign and memoir chapterstyle ell

I have just come across an odd interaction between mathdesign and the ell chapterstyle in memoir. I'm using TeX Live 2013 and I believe this was introduced with the update to mathdesign 2.31.

Here's the minimal code triggering the behaviour:

\documentclass{memoir}
\usepackage[charter]{mathdesign}
\chapterstyle{ell}
\begin{document}
\chapter{First chapter title}
Some text.
\end{document}


This gives the following error:

! Leaders not followed by proper glue.
\hfill
l.5 \chapter{First chapter title}


This happens regardless of which font family is chosen for mathdesign (and does not occur when mathdesign is not loaded).

The problem appears to be triggered on the memoir side by the \hrulefill in \chapterheadstart. The definition of the ell chapterstyle includes the following:

\renewcommand*{\chapterheadstart}{\begingroup
\vspace*{\beforechapskip}%
\hrulefill
\smash{\rule{0.4pt}{15mm}}


Replacing the \hrulefill with \hfill or \dotfill eliminates the error, and conversely, using the above redefinition instead of the full ell chapterstyle also causes the error. But using \hrulefill in a normal paragraph does not cause an error.

What could be the problem and how could it be fixed?

• As David mentions this is an error in mathdesign, you can see it in a non-memoir document by issuing \hrullfill with a blank line before and after. Caused by the missing \leavevmode as David remarks. The mathdesign maintainers should hopefully allready have been noticed (I was emailed about it last week). – daleif Sep 27 '13 at 13:29

well you answered this really: \mathdesign changes the definition of \hrulefill it probably shouldn't.

This restores the definition.

\documentclass{memoir}
\let\xhrf\hrulefill

\usepackage[charter]{mathdesign}
\let\hrulefill\xhrf

\vspace*{\beforechapskip}%
\hrulefill
\smash{\rule{0.4pt}{15mm}}

\begin{document}
\chapter{First chapter title}
Some text.
\end{document}


Or a definition which adds mathdesign's intended width parameter without breaking other uses:

\makeatletter