# Special formatting for section numbers

In these Mathematical Writing notes prepared by Knuth et al. (worth checking out the first few pages if you write technical articles), they use a certain typography for Section numbers. Aside from the \S symbol, a special formatting is applied to the number itself, such that it appears more "squat" than usual.

I quite like this style (it is somehow elegant and familiar) but I don't know how to recreate it in TeX. Any ideas on how this special formatting of the number was done?

-
They are Old Style Numbers, I think. Try \oldstylenums{1234567890} to see the effect. Then try something like \renewcommand{\thesection}{\S\oldstylenums{\arabic{section}}.} – karlkoeller Aug 28 '13 at 16:50
– lockstep Aug 28 '13 at 16:51
Thanks folks. I hadn't heard of old style numbers before. I'm slightly embarrassed: seems like there's a tag for them and everything. :) @karlkoeller, if you write that comment as an answer, I'll be happy to accept. – badroit Aug 28 '13 at 17:55
@badroit Done, as per your request... – karlkoeller Aug 28 '13 at 18:43

The style you've observed is the (so called) "Old Style".

You can use that style with the default font using the command \oldstylenums. To see the effect, write \oldstylenums{1234567890}:

To have sections numbered as in the document you have linked, you can type

\renewcommand{\thesection}{\S\oldstylenums{\textbf{\arabic{section}}}.}


as in the following MWE

\documentclass{article}

\renewcommand{\thesection}{\S\oldstylenums{\textbf{\arabic{section}}}.}

\begin{document}

\section{First section}

\oldstylenums{1234567890}

\end{document}


which gives

Clearly this is not the right way to use "old style" numbers. For example, when referencing a section defined as above, you will get both the number in bold and the period, which is not a desired behavior.

You should choose fonts with specific support for "old style" numbers. For more information see the thread Utilizing oldstyle figures without resorting to \oldstylenums mentioned by lockstep.

For example, I find Kp-fonts very nice used together with "old style" numbers. Below is an example.

\documentclass{article}

\usepackage[oldstylenums]{kpfonts}  % load with the option fulloldstylenums
% if you also want old style numbers in math mode
\usepackage{titlesec}
\usepackage{lipsum}     % just for the example

\renewcommand{\thesection}{\S\arabic{section}}
\titleformat{\section}{\normalfont\bfseries}{\thesection.}{1em}{}[]

\begin{document}

\section{Notes on Technical Writing}\label{sec:first}
\lipsum[2]

\section{Referencing}
This a reference to \ref{sec:first} and this is a list of digits: 1234567890.

\end{document}


Note that I've used titlesec's \titleformat command to redefine the section heading so to include the period.

-
I wouldn't actually anclude punctuation, since that will end up in a reference as well. – Werner Aug 28 '13 at 20:12
@Werner I agree, it was just to reproduce the style observed in the linked document. – karlkoeller Aug 28 '13 at 20:14

If you use oldstyle digits for section numbers, you should use them for all “nonmath” numbers, that is, all numbers not used in their proper mathematical sense, such as page numbers in addition to section numbers.

Some font families provide oldstyle digits, but not Computer Modern other than with the clumsy \oldstyle command. However, you can use cfr-lm that uses the Latin Modern fonts, which are almost identical to Computer Modern. With cleveref it becomes easy adding the § mark in front of the number in references. For the section number in titles, just modify \@seccntformat. I would use oldstyle digits also for equation numbers, as they are just markers, but in the following code there's a line that can change them to lining digits.

\documentclass{article}
\usepackage[
rm={oldstyle=true},
]{cfr-lm}
\usepackage{amsmath}

\makeatletter
% Uncomment the following line for lining digits in equation numbers
%\renewcommand\maketag@@@[1]{\hbox{\m@th\normalfont\lstyle#1}}
\makeatother

\usepackage{cleveref}
\crefformat{section}{\S#2#1#3}

\begin{document}

\section{Introduction}\label{sec:intro}

Here we talk about something, with an equation
$$\label{eq:good} 1+1=2$$

Here's a ref to the present section, which is \cref{sec:intro}, and
one to equation~\eqref{eq:good}.

\end{document}


What are the advantages in doing this? The \thesection command doesn't get touched, remaining fully expandable and usable with packages such as refcount. The cleveref package is very powerful and recommendable for getting uniform references across the document. Finally, the call to cfr-lm can be changed to

\usepackage[osf,sc]{mathpazo}


to use Palatino with oldstyle digits, without any other change to your document.

-