10

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.
<to be read again> 
    \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}%
  \begin{adjustwidth}{}{-\chapindent}%
  \hrulefill
  \smash{\rule{0.4pt}{15mm}}
  \end{adjustwidth}\endgroup}

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
13

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

\renewcommand*{\chapterheadstart}{\begingroup
  \vspace*{\beforechapskip}%
  \begin{adjustwidth}{}{-\chapindent}%
  \hrulefill
  \smash{\rule{0.4pt}{15mm}}
  \end{adjustwidth}\endgroup}


\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
\def\hrulefill{\leavevmode\leaders \hrule height \rulethickness \hfill\kern\z@}
\makeatletter
  • This just occurred for me when upgrading from Ubuntu 13.10 to 14.04. The second, shorter fix works for me. – hertzsprung May 27 '14 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.