TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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 see in memoir that \section is implemented like so:

  \@startsection{section}{1}%  level 1
      {\secindent}%            heading indent
      {\beforesecskip}%        skip before the heading
      {\aftersecskip}%         skip after the heading
      {\normalfont\secheadstyle}} % font
  \setbeforesecskip{-3.5ex \@plus -1ex \@minus -.2ex}
  \setaftersecskip{2.3ex \@plus .2ex}
%%%  \setsecheadstyle{\Large\bfseries\raggedright}

I thought I'd try color'izing my section numbers, and first tried:


This didn't work, since the scope of the blue was everything after and including the section. Next I tried:


This is better, but color'izes the section number and the section title. I can't see in the \section implementation above where the counter is, so I think I'm looking in the wrong place.

Here's a MWE for my busted attempt:




\subsection{more stuff}
\subsubsection{even more stuff}


This produces

attempt at colorizing

I also see that I've lost subsection and subsubsection numbers (which I had with the book class). So two questions:

  • How can I get back my sub and subsub section numbers?
  • How would one color just the section numbers (and subsection numbers once I get them back)?
share|improve this question
up vote 6 down vote accepted

To control the level up to which sectional units will be numbered, you can use \setsecnumdepth{<sectional unit>}; to color the sectional unit numbers, you can use \setsecnumformat:


\setsecnumformat{\color{blue}\csname the#1\endcsname\quad}


\subsection{more stuff}
\subsubsection{even more stuff}


enter image description here

share|improve this answer

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.