Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

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}
share|improve this answer
    
Thanks, I went for an xparse definition. titlesec was rewriting too much of the already defined memoir styles. –  Nyiti Jan 8 '12 at 12:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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