[Tex/LaTex] memoir package chapter style definition

memoir

I defined a chapter style for memoir as follows:

\documentclass[10pt]
{memoir}

\let\STARTCODE\relax 
\let\STOPCODE\relax 

\STARTCODE
\usepackage{color}
\definecolor{nicered}{rgb}{.647,.129,.149}
\makechapterstyle{mym}{

    \renewcommand\chapnamefont{\normalfont\Large\scshape\raggedleft\so}
    \renewcommand\chaptitlefont{\normalfont\Huge\bfseries\scshape \color{nicered}}
    \renewcommand\printchapternonum{}
    \renewcommand\printchaptertitle[1]{\chaptitlefont ##1}
    \renewcommand\afterchaptertitle{\par\nobreak\bigskip\hrule\vskip0.5in}
}
\STOPCODE

\setlength\afterchapskip {\onelineskip }
\setlength\beforechapskip {\onelineskip }
\usepackage{lipsum}

\chapterstyle{mym}

\begin{document}

   \chapter{Chapter 1}
   \lipsum

\end{document}

when I run this through latex I get an error message

! Undefined control sequence.
\chapnamefont ... \Large \scshape \raggedleft \so 

l.33 \chapter{Chapter 1}

The control sequence at the end of the top line
of your error message was never \def'ed.

but thereaftere everything works as intended.
I tried to figure out what's wrong by reading memman.pdf, but it is intimidating.

Best Answer

The macro \so is defined by soul; but there's a better method for obtaining the “letter space” effect, with microtype:

\documentclass{memoir}

\usepackage{microtype}
\usepackage{color}
\definecolor{nicered}{rgb}{.647,.129,.149}
\makechapterstyle{mym}{%
  \renewcommand\chapnamefont{\normalfont\Large\scshape\raggedleft\lsstyle}%
  \renewcommand\chaptitlefont{\normalfont\Huge\scshape\color{nicered}\lsstyle}%
  \renewcommand\printchapternonum{}%
  \renewcommand\printchaptertitle[1]{\chaptitlefont ##1}%
  \renewcommand\afterchaptertitle{\par\nobreak\bigskip\hrule\vspace{0.5in}}
}

\setlength\afterchapskip{\onelineskip}
\setlength\beforechapskip{\onelineskip}
\usepackage{lipsum}

\chapterstyle{mym}

\begin{document}

\chapter{Test}

\lipsum

\end{document}

I've fixed some other glitches in the code. The main correction is removing \bfseries. Only a few fonts have boldface small caps, but in any case this would be too much: you already have \Huge and color.

enter image description here

Related Question