# How to change section numbering formatting

I’m looking for a way (or a package) to change or control the formatting of the numbers of a section. By formatting, I mean the fonts and the like, not the formatting of the number

As far as I can see, the only way seems to redefine the @sect command, for example. But I’d prefer to avoid this: as you can see, I’m not a TeX expert.

• There are the packages sectsty and titlesec. The package titlesec is more complicated then sectsty, but can do more. If I understand your question correctly, I think sectsty would be sufficient for you. – Piet van Oostrum Nov 28 '16 at 16:34
• Could you be more precise about what changes you have in mind? Surely \@sect is not the macro to act on, anyway. – egreg Nov 28 '16 at 16:38
• Which class are you using? There are some classes with predefined styles, see e.g. ftp.dante.de/tex-archive/info/MemoirChapStyles/… – user36296 Nov 28 '16 at 16:55
• @egreg I’d like to change, say, the typeface of the number. – giorgio_v Nov 30 '16 at 7:55
• @PietvanOostrum Thanks for the suggestions. I’ll try them out. – giorgio_v Nov 30 '16 at 7:56

For extensive changes to the sectional titles, titlesec is the package to go. For less extensive changes, you can go with internals.

\documentclass{article}

\makeatletter
\renewcommand{\@seccntformat}[1]{%
\begingroup
{\@nameuse{the#1}}%
\endgroup
}
\newcommand{\setformat}[2]{%
}
\makeatother

\setformat{section}{\itshape}
\setformat{subsection}{\normalfont}
\setformat{subsubsection}{\fbox}

\begin{document}

\section{Example of section}

\subsection{Example of subsection}

\subsubsection{Example of subsubsection}

\end{document}


The last token in the second argument to \setformat can take an argument, like in the example for \subsubsection.