# Soul letterspacing in memoir sections with \setsecheadstyle

I realize I have asked almost the same question earlier.

There, the answer involved xparse or titlesec. Titlesec however gets into conflicts with memoir's pagestyles (running header settings, \leftmark and so on), and a new command \Section with xparse bypasses the useful mechanisms of memoir for the default \section.

I tend to think it shouldn't be too difficult use memoir's \setsecheadstyle, but somehow I'm not getting the command definition right.

So I'm trying to add soul letterspacing to the \section formatting in a memoir document. The docs recommend \setsecheadstyle.

\newcommand\sectionFmt[1]{%
\MakeUppercase{\soSection{#1}}%
}


It errors out with ! A <box> was supposed to be here. However, \textit{#1} works fine.

It seems I'm just not passing the argument properly. How to do this right?

MWE:

\documentclass{memoir}

\makeatletter

\usepackage{soul}
\sodef\soSection{}{.1em}{.5em plus.1em}{.1em plus.1em minus.1em}

\newcommand\sectionFmt[1]{%
% This errors out with: '! A <box> was supposed to be here.'
\MakeUppercase{\soSection{#1}}%
% But \textit{} works.
%\MakeUppercase{\textit{#1}}%
}

\makeatother

\begin{document}

And most conclusive of all, there are the two hideous results which the doctor
obtained from a certain pair of formulae during his final investigations.

\section{Monstrous Implications}

Results which virtually proved the authenticity of the papers and of their
monstrous implications at the same time that those papers were borne forever
from human knowledge.

-- The Case of Charles Dexter Ward, H.P. Lovecraft

\end{document}

• The main problem is that the head style is not just fed the actual text, it also get a lot of formatting as well, and soul does not handle that very well. Try just letting \sectionFmt return the input unaltered plus type it to the log via \typeout{#1}, then you will see the difference. Perhaps microtype might help better (untested). – daleif Mar 28 '14 at 9:35

This works using microtype instead, you may need to fine tune it a bit, see the microtype manual (it might be a bit hard to understand, I did not)
\usepackage[T1]{fontenc}