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

Like the question title says, is it possible to customize only the section and subsection numbers or titles in memoir? I know how to change the font for the entire block, but I would like to make the section numbers a bit smaller compared to the section title and to keep the subsection numbers upright while having the subsection title slanted.

Also, I would like to be able to do some stuff to the title without affecting the numbers.

share|improve this question
up vote 7 down vote accepted

It's sufficient to define suitably the "secnumformat"; its usual setup is

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

so we can modify in such a way that it executes different macros, for which I choose the names \gablinsection, \gablinsubsection and so on.


\setsecnumformat{\csname gablin#1\endcsname\quad}

\section{Test me}
\subsection{Another test}
\subsubsection{Test me too}

The idea comes from UK TUG FAQ.

share|improve this answer
A much better idea! – Ant Sep 27 '11 at 13:38
That is a good idea – daleif Sep 27 '11 at 13:55

You can define the secnumformat separately for each section level by adding a hook to the relevant sectioning command:

% I don't know what style you're using but chose this one since it
% has italic subsection titles - the same principles apply to any 
% set of heading styles.
% Make sure subsections are numbered

% Save the existing sectioning commands

% New sectioning commands use \setsecnumformat to
% redefine the number font locally. Note the extra
% pair of curly brackets to make sure that the
% \secnumformat returns to normal after the (sub)section
% definition.


\section{Test me}
\subsection{Another test}
\subsubsection{Test me too}


a set of headings with the required numbering fonts

(the final subsubsection is to show that we haven't changed the numbering font globally).

(On a typographic note, though, it's possible that what you actually want for section numbers is not small numerals but "old style" ones - if they're available in the font you use.)


@daleif has pointed out that the cunning extra groups have the unfortunate effect of breaking cross-references. An alternative that avoids this is


where, instead of defining a group within which the secnumformat is changed, the old format is explicitly saved and then restored, so that cross-references still work.

I note also that, if you don't care about restoring the old format (i.e., if you're happy to explicitly define a format for every section level you use) an easier method than the first one I showed would be

share|improve this answer
I'll add this to my todo list. But the solution above may have a side effect, it will break \label because the data \label use is locked inside the extra group – daleif Sep 27 '11 at 10:52
True! I guess the best thing to do in that case is explicitly save the old secnumformat and restore it afterwards. I'll edit to suggest this. – Ant Sep 27 '11 at 11:36
Unfortunately you'll lose all the facilities regarding optional arguments to \section and siblings. – egreg Sep 27 '11 at 12:17

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.