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'd like to change the format for \subsection{} without using special packages. On report.cls we find its definition

                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%

But I'd like to use different fonts for the counter and for the title.

For example, for the \section{} command I'm using


How to do the same for \subsection?

Edit: here is the adapted code for \section{}.

\def\@section[#1]#2{\ifnum \c@secnumdepth >\z@
                         {\protect{\color{black!30} %
                         {\fontsectionnumbertoc\numberline{\thesection.}}} {\normalfont #1} \hspace{1em} %
%                    \if@twocolumn
%                      \@topnewpage[\@makechapterhead{#2}]%
%                    \else
  \vskip 5mm
  {\parindent \z@ \raggedright 
    \ifnum \c@secnumdepth >\m@ne
%        \vskip 0\p@
%    \large\MakeUppercase{#1} \par\nobreak
    \vskip 2mm %2.3ex \@plus.2ex
share|improve this question
What is the definition of \fontsectionnumber and \fontsection? – Werner Jan 29 '13 at 18:42
@Werner, they are command for personal fonts: \def\fontsectionnumber{\fontsize{9}{16}\usefont{LY1}{SyntaxStd-TLF}{a}{n}} \def\fontsection{\fontsize{9}{16}\usefont{LY1}{SyntaxStd-TLF}{m}{n}} – Sigur Jan 29 '13 at 18:44
@Sigur: I'm just curious: why not packages? – n.r. Jan 29 '13 at 22:53
@nicolai.rostov, I'll send my file to many people to compile it on different distributions and so on. So I'd like to use many default commands as possible. – Sigur Jan 29 '13 at 22:58
\@startsection contains the definition of the headers. If you want to provide your own definition you have to use \secdef for \subsection, too. – Marco Daniel Mar 17 '13 at 9:31
up vote 4 down vote accepted

The standard way to cope with this kind of problems is to use \@seccntformat, the macro that takes care of formatting the section number (any level below chapter, in the standard classes).

The usual definition is

\csname the#1\endcsname \quad

where #1 is the counter associated to the current section level. So if you define

  {\csname font#1number\endcsname\csname the#1\endcsname}\quad}

you can obtain any effect you prefer.

If you don't define \font<level>number, the command would be the same as \relax, so it won't raise errors.





  {\csname font#1number\endcsname\csname the#1\endcsname}\quad}

    {-3.5ex \@plus -1ex \@minus -.2ex}%
    {2.3ex \@plus.2ex}%

    {-3.25ex\@plus -1ex \@minus -.2ex}%
    {1.5ex \@plus .2ex}%



\section{This is a section title}


\subsection{This is a subsection title}



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.