# memoir package chapter style definition

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.

• Welcome to TeX.SX! Apart from an error due to the misplaced \afterchapskip in \afterchaptertitle, I have no problem with \chapter. Can you make a complete example showing the issue? Jan 29 '16 at 21:25
• What is \so supposed to do?
– cfr
Jan 29 '16 at 23:59
• \so is defined neither by the LaTeX kernel nor by memoir. Jan 30 '16 at 0:00
• @egreg: I edited it to be a complete example. The error message is from the log file. In the console it flags \chapter as the undefined control sequence.
– gcc
Jan 30 '16 at 0:00
• No it is saying that \so is undefined. The last command on that line, it complains of. The control sequence at the end of the top line...
– cfr
Jan 30 '16 at 0:01

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.

• Hi Enrico. How are you doing? No unsung hero badge sorry. :)
– user11232
Jan 30 '16 at 1:39