[Tex/LaTex] Customize chapterstyle in memoir

chaptersmemoirsectioning

I like the ell chapterstyle which is built into memoir, but I want to customize it. I like the chapter number and the lines around it, but I want the chapter title to be written in the same size and font as it would be in the default chapterstyle.

How can I make this change to the built-in ell chapterstyle? (Hopefully this will also be illustrative in learning how to customize any of the built-in memoir chapterstyles.)

\documentclass{memoir}
\chapterstyle{ell}
\begin{document}
\chapter{Introduction}
I want ``Introduction'' to have the same size and font
as it would in the ``default'' chapterstyle.
\end{document}

Best Answer

As daleif suggested in his comment, all you have to do is to look at the code in memoir.cls; here's how the ell style is defined:

\makechapterstyle{ell}{%
  \chapterstyle{default}
  \renewcommand*{\chapnumfont}{\normalfont\HUGE\sffamily}
  \renewcommand*{\chaptitlefont}{\normalfont\huge\sffamily}
  \settowidth{\chapindent}{\chapnumfont 111}
  \renewcommand*{\chapterheadstart}{\begingroup
    \vspace*{\beforechapskip}%
    \begin{adjustwidth}{}{-\chapindent}%
    \hrulefill
    \smash{\rule{0.4pt}{15mm}}
    \end{adjustwidth}\endgroup}
  \renewcommand*{\printchaptername}{}
  \renewcommand*{\chapternamenum}{}
  \renewcommand*{\printchapternum}{%
    \begin{adjustwidth}{}{-\chapindent}
    \hfill
    \raisebox{10mm}[0pt][0pt]{\chapnumfont \thechapter}%
                              \hspace*{1em}
    \end{adjustwidth}\vspace*{-3.0\onelineskip}}
  \renewcommand*{\printchaptertitle}[1]{%
    \vskip\onelineskip
    \raggedleft {\chaptitlefont ##1}\par\nobreak}}

In your case, the relevant lines are

\renewcommand*{\chapnumfont}{\normalfont\HUGE\sffamily}
\renewcommand*{\chaptitlefont}{\normalfont\huge\sffamily}

which set the format for the number and title font. In the default style the number font is boldfaced and uses \huge and the title font is set to be boldfaced and \Huge and both use roman family, so you can define your own style making the appropriate changes. In the example below I changed both the number and title format to use roman family but, of course, you can change only the title format (I just thought that it is more coherent to maintain the same family for both the number and the title):

\documentclass{memoir}

\makechapterstyle{myell}{%
  \chapterstyle{default}
  \renewcommand*{\chapnumfont}{\normalfont\huge\bfseries}
  \renewcommand*{\chaptitlefont}{\normalfont\Huge\bfseries}
  \settowidth{\chapindent}{\chapnumfont 111}
  \renewcommand*{\chapterheadstart}{\begingroup
    \vspace*{\beforechapskip}%
    \begin{adjustwidth}{}{-\chapindent}%
    \hrulefill
    \smash{\rule{0.4pt}{15mm}}
    \end{adjustwidth}\endgroup}
  \renewcommand*{\printchaptername}{}
  \renewcommand*{\chapternamenum}{}
  \renewcommand*{\printchapternum}{%
    \begin{adjustwidth}{}{-\chapindent}
    \hfill
    \raisebox{10mm}[0pt][0pt]{\chapnumfont \thechapter}%
                              \hspace*{1em}
    \end{adjustwidth}\vspace*{-3.0\onelineskip}}
  \renewcommand*{\printchaptertitle}[1]{%
    \vskip\onelineskip
    \raggedleft {\chaptitlefont ##1}\par\nobreak}}

\chapterstyle{myell}

\begin{document}
\chapter{Introduction}
I want ``Introduction'' to have the same size and font
as it would in the ``default'' chapterstyle.
\end{document}

enter image description here

Of course, for minor changes, you don't have to define your own style; you can simply redefine the appropriate commands after selecting the style. The same result as above can be obtained with:

\documentclass{memoir}

\chapterstyle{ell}
\renewcommand*{\chapnumfont}{\normalfont\huge\bfseries}
\renewcommand*{\chaptitlefont}{\normalfont\Huge\bfseries}

\begin{document}
\chapter{Introduction}
I want ``Introduction'' to have the same size and font
as it would in the ``default'' chapterstyle.
\end{document}
Related Question