# Problem with \caps (from soul package) in header using memoir

I am publishing my 3rd book with LaTeX. There was a long hiatus between the second book and the third, but evidently something has changed that has broken my header format. When I attempt to re-LaTeX my old files---the files used to create production PDFs of previous books---an error occurs that never occurred earlier.

I am using the soul package for better treatment of all-cap text, which I put in the page headings. For some reason the "\caps" control sequence is causing MikTeX to throw the following error: "Argument of \@uclcnotmath has an extra }"

Below is a minimal example. If I remove the "\caps" from the heading definition, the error goes away.

Any advice on how to fix this? My previous books were done about 5 years ago. I have no idea why this is no longer working.

\documentclass[a5paper,openright, onecolumn, 11pt]{memoir}
\usepackage{soul}

\createmark{chapter}{both}{nonumber}{}{}
\def\sectionmark##1{
\markright{##1}}}

\checkandfixthelayout

\begin{document}
\chapter{Chapter Title}

This is page 1

\eject

This is page 2

\eject

This is page 3

\end{document}

• try changing to \def\sectionmark##1{ \markright{\caps{##1}}}} and \makeoddhead{headings}{}{}{\rightmark}. soul-package documentation lists some stuff that won't work under section 2.2 in its documentation, § 24 Material that needs expansion. Sep 3 '16 at 9:44
• What exactly does the \caps macro for, that is different from using \nouppercaseheads  and then use \scshape\rightmark. You might even get better results via the features from the microtype package (soul is a bit limited) Sep 3 '16 at 10:01
• daleif, soul has different spacing rules than vanilla scshape. I use microtype in my manuscript in general but did not look into its specific features. Sep 3 '16 at 21:04
• @RunarTrollet Thanks! That worked great, both on my repro and the whole manuscript. Sep 3 '16 at 21:11

This problem is due to the way that soul-package does its expansions, which won't work with \rightmark.

From the documentation, section 2.2. [Some things work…] …others don't:

§ 24 Material that needs expansion:

Example: \so{\romannumeral\year}

In this example \so would try to put space between \romannumeral and \year, which can, of course, not work. You have to expand the argument before you feed it to soul, or even better: Wrap the material up in a com- mand sequence and let soul expand it: \def\x{\romannumeral\year} \so\x. soul tries hard to expand enough, yet not too much.

We can circumvent this by instead putting it into your definiton of \sectionmark:

\def\sectionmark##1{\markright{\caps{##1}}}}


since this will exand correctly, and removing the \caps{} from your \makeoddhead.

### Code

\documentclass[a5paper,openright, onecolumn, 11pt]{memoir}
\usepackage{soul}

\createmark{chapter}{both}{nonumber}{}{}
\def\sectionmark##1{\markright{\caps{##1}}}}

\checkandfixthelayout

\begin{document}
\chapter{Chapter Title}

This is page 1

\eject

This is page 2

\eject

This is page 3

\end{document}

• I do wonder why it worked earlier (in 2011, when I published my earlier manuscript using the same code). It seems that the soul package was last changed in 2003... Sep 5 '16 at 16:34
• I do not know. Haven't really been using LaTeX for more than a year, but maybe memoir have changed. Just guesswork really, Sep 5 '16 at 16:46