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 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}
share|improve this question
3  
just copy the code from memoir.cls and take it from there. –  daleif Mar 30 '12 at 19:13
add comment

1 Answer 1

up vote 5 down vote accepted

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}
share|improve this answer
    
Ok, I tried Gonzalo's code, but for some reason I cannot use the code and include ` \numtoName{\c@chapter}` as part of any chapterstyle. Is there a particular reason why this is failing? Specially because I know that that particular code works (Using Dalief's suggestion, copied "brotherton" and tried you code, but it does not work). Any help? –  tuxtlequino Apr 26 '12 at 8:14
    
Do you mind posting a full example? –  daleif Apr 26 '12 at 9:59
    
@daleif I figure out yesterday night a way to make it work, but I my question still stands. I will simplify Gonzalo's code as an example. \documentclass{memoir} \makechapterstyle{mytest}{% \chapterstyle{mytest} \begin{document} \chapter{Introduction} I want Introduction'' to have the same size and font as it would in the default'' chapterstyle. \end{document} –  tuxtlequino Apr 27 '12 at 4:22
    
Adding those two \renewcommand lines in the example, then the sizes are the same, so I don't see the problem –  daleif Apr 27 '12 at 12:40
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.