I am tinkering with the Hansen chapter style for the memoir class, as reviewed and listed in texblog. The Hansen style is unfortunately not discussed in the memoir class documentation.

I changed it to be left-aligned and use \sfstyle chapter title font. I would now like to control the color of the chapter title.

My current attempt:


% helper macros
  \parbox{\textwidth}{\chaptitlefont \strut bg\\bg\strut}}
    %\microtypesetup{protrusion=false}% add this if you use microtype
    \chaptitlefont\strut ##1\strut}%



This correctly colors numbered \chapters but not unnumbered \chapter*s, including the table of contents heading.

option 1

If I comment the statement \color{ChapTitleColor} in the macro \printchaptername and instead uncomment the color statement in the macro \chaptitlefont further below, I do get the right coloring but now the chapter title has been pushed down by a line or so.

option 2

Perhaps I have missed an end-of-line percent mark somewhere, as I am relatively unpractised at TeX's syntax.

(NB I do not know for sure if this applies to the \chapter* although I have indicated this in the image. Can I overlay a ruler grid on a latex page to check these things?)

How can I fix option 1 or option 2 without affecting the formatting?

What is the "correct" way to color this style, as intended by the developer?

1 Answer 1


You were on the right track. You can use the \chaptertitlefont modification only, just add a \leavevmode before the color command.


Since you may be tempted to ask about what \leavevmode actually does, here's a link to an explanation:

BTW, it's probably better to use xcolor instead of color.

  • Thank you @Alan Munn for going above and beyond, the link to the \leavemode thread and advice on xcolor are very welcome.
    – Andreas
    Dec 11, 2012 at 1:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .