Adjusting the presentation of section numbers

The general issues of adjusting the appearance of section headings are pretty complex, and are covered in the question on the style of section headings.

However, people regularly want merely to change the way the section number appears in the heading, and some such people don't mind writing out a few macros. This answer is for them.

The way the section number is typeset is determined by the \@seccntformat command, which is given the "name" (section, subsection, ...) of the heading, as argument. Ordinarily, it merely outputs the section number, and then a \quad of space. Suppose you want to put a stop after every section (subsection, subsubsection, ...) number, a trivial change may be implemented by simple modification of the command:

\renewcommand*{\@seccntformat}[1]{%
  \csname the#1\endcsname.\quad
}

Many people (for some reason) just want a stop after a section number. To do this, one must make \@seccntformat switch according to its argument. The following technique for doing the job is slightly wasteful, but is efficient enough:

\let\@@seccntformat\@seccntformat
\renewcommand*{\@seccntformat}[1]{%
  \expandafter\let\expandafter\@tempa
    \csname @seccntformat@#1\endcsname
  \ifx\@tempa\relax
    \expandafter\@@seccntformat
  \else
    \expandafter\@tempa
  \fi
    {#1}%
}
which looks to see if a second-level command has been defined, and uses it if so; otherwise it uses the original. The second-level command to define stops after section numbers (only) has the same definition as the original "all levels alike" version:
\newcommand*{\@seccntformat@section}[1]{%
  \csname the#1\endcsname.\quad
}
Note that all the command definitions of this answer are dealing in LaTeX internal commands, so the above code should be in a package file, for preference.

The Koma-script classes have different commands for specifying changes to section number presentation: \partformat, \chapterformat and \othersectionlevelsformat, but otherwise their facilities are similar to those of "raw" LaTeX.

KOMA script bundle
macros/latex/contrib/koma-script (zip, browse)

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=seccntfmt