4

I'd like to add letterspacing to the \section commands with \setsecheadstyle in a memoir book.

I tried using soul:

\sodef\soSection{}{.1em}{.5em plus.1em}{.1em plus.1em minus.1em}
\setsecheadstyle{\sectionFont\MakeUppercase\soSection}

Of course this fails to compile because it should be \soSection{...}, but memoir inserts \secheadstyle this way:

\newcommand{\section}{%
  \sechook%
  \@startsection{section}{1}%  level 1
      {\secindent}%            heading indent
      {\beforesecskip}%        skip before the heading
      {\aftersecskip}%         skip after the heading
      {\normalfont\secheadstyle}} % font

It's possible to use a quick workaround, but it would be much neater to do this with styling.

\section[Suffering and Self-View]{\soSection{Suffering and Self-View}}

Can one set \setsecheadstyle with a soul command in it somehow?

1 Answer 1

5

The memoir class uses two optional arguments for the sectioning commands; the first optional argument is used for the ToC and the second one, for the running headers.

With the help of the xparse package you can define a new command behaving like the standard \section from memoir, but adding your \soSection command:

\documentclass{memoir}
\usepackage{soul}
\usepackage{xparse}

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

\DeclareDocumentCommand\Section{oom}{
\IfNoValueTF{#1}
  {\section{#3}}
  {\IfNoValueTF{#2}{\section[#1]{#3}}{\section[#1][#2]{#3}}}
}

\begin{document}

\Section[Suffering and Self-View][Test]{Suffering and Self-View}

\end{document}

If you are never going to use the second optional argument for \section, a simpler solution can be given (with no new commands) using the titlesec package and its explicit option:

\documentclass{memoir}
\usepackage{soul}
\usepackage[explicit]{titlesec}

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

\titleformat{\section}
  {\normalfont\Large\bfseries}{\thesection}{1em}{\soSection{#1}}

\begin{document}

\section[Suffering and Self-View]{Suffering and Self-View}

\end{document}
1
  • Thanks, I went for an xparse definition. titlesec was rewriting too much of the already defined memoir styles.
    – Gambhiro
    Jan 8, 2012 at 12:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .