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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 9 down vote accepted

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.

share|improve this answer
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 '12 at 1:21

Your Answer


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.