5

I am using pdflatex with libertineas my main font. For the numbering of my pages, chapters, my figures and tables (and only of these), I would like to use oldstyle numerals. Any suggestions on how to achieve this result?

Here is a MWE:

\documentclass[
a4paper,
final, 
12pt, 
numbers=noendperiod,
BCOR=5.00mm, 
bibliography=totoc,
listof=totoc,
headinclude
]{scrreprt}

\usepackage{libertine}
\usepackage[scaled=.83]{beramono}
\usepackage[libertine]{newtxmath}

\usepackage{blindtext}

\begin{document}
\blinddocument
\end{document}

Edit: The solution provided by tohecz below works, but shows a conflict, as soon as hyperref package is included.

Working Example with hyperref:

\documentclass[
a4paper,
final, 
12pt, 
numbers=noendperiod,
BCOR=5.00mm, 
bibliography=totoc,
listof=totoc,
headinclude
]{scrreprt}

\usepackage{libertine}
\usepackage[scaled=.83]{beramono}
\usepackage[libertine]{newtxmath}

\usepackage{blindtext}

\usepackage{hyperref}

\begin{document}
\blinddocument
\end{document}

Not working anymore with hyperref:

\documentclass[
a4paper,
final, 
12pt, 
numbers=noendperiod,
BCOR=5.00mm, 
bibliography=totoc,
listof=totoc,
headinclude
]{scrreprt}

\usepackage{libertine}
\usepackage[scaled=.83]{beramono}
\usepackage[libertine]{newtxmath}

\usepackage{blindtext}

\usepackage{hyperref}
\makeatletter
\renewcommand*\@arabic[1]{\oldstylenums{\number#1}}
\newcommand*\@Arabic[1]{\number#1}
\newcommand*\Arabic[1]{\expandafter\@newarabic\csname c@#1\endcsname}
\makeatother

\begin{document}
\blinddocument
\end{document}
3
  • 1
    What about page numbers?
    – Mico
    Commented Nov 1, 2014 at 14:13
  • Page numbers being oldstyle numerals would be nice as well! Did not think of this.
    – Vlad030691
    Commented Nov 1, 2014 at 14:15
  • General use of oldstyle numbers in text is nice too. To achieve this, load libertine with option osf. However I don't that if your chapter numbering is something like 1. My First Chapter, it would be nice to have 1 in old style.
    – Bernard
    Commented Nov 1, 2014 at 14:51

2 Answers 2

4

You want to change the digits in math mode:

\documentclass[
  a4paper,
  final, 
  12pt, 
  numbers=noendperiod,
  BCOR=5.00mm, 
  bibliography=totoc,
  listof=totoc,
  headinclude
]{scrreprt}

\usepackage[oldstyle]{libertine}
\usepackage[scaled=.83]{beramono}
\usepackage[libertine]{newtxmath}

\usepackage{hyperref}

\DeclareSymbolFont{liningdigits}{\encodingdefault}{LinuxLibertineT-TLF}{m}{n}
\SetSymbolFont{liningdigits}{bold}{\encodingdefault}{LinuxLibertineT-TLF}{b}{n}
\DeclareMathSymbol{0}{\mathalpha}{liningdigits}{`0}
\DeclareMathSymbol{1}{\mathalpha}{liningdigits}{`1}
\DeclareMathSymbol{2}{\mathalpha}{liningdigits}{`2}
\DeclareMathSymbol{3}{\mathalpha}{liningdigits}{`3}
\DeclareMathSymbol{4}{\mathalpha}{liningdigits}{`4}
\DeclareMathSymbol{5}{\mathalpha}{liningdigits}{`5}
\DeclareMathSymbol{6}{\mathalpha}{liningdigits}{`6}
\DeclareMathSymbol{7}{\mathalpha}{liningdigits}{`7}
\DeclareMathSymbol{8}{\mathalpha}{liningdigits}{`8}
\DeclareMathSymbol{9}{\mathalpha}{liningdigits}{`9}

\begin{document}

Example\label{x}

\begin{enumerate}
\item math: $123$
\item text: 123
\item ref: \pageref{x}
\end{enumerate}

\end{document}

enter image description here

3
  • If only I could shift my answer below yours :)
    – yo'
    Commented Nov 2, 2014 at 22:41
  • Note: That last line should probably be \DeclareMathSymbol{9}{\mathalpha}{liningdigits}{`9} [note the {`9} instead of the {`0} at the end] — I mean, unless you actually want to replace all 9s with 0s :-)
    – der_herr_g
    Commented Dec 8, 2023 at 23:48
  • 1
    @der_herr_g Down with 9’s! 😉
    – egreg
    Commented Dec 9, 2023 at 7:22
4

You can change all counters using arabic numbers into oldstyle arabic numbers by re-defining the inner macro \@arabic. As well, I provided \Arabic which gives the standard arabic numbering, so for instance, if you wanted enumerate to use standard digits, you can do \renewcommand*\theenumi{\Arabic{enumi}}.

However, there is some trouble with page counter and hyperref. The way how I solved this is that we keep hyperref happy with its \thepage and use a new \Thepage in the footer. This doesn't solve the issue that now, page references will be in standard arabic rather than oldstyle, but that's just too much. (Maybe there's a simple way to do this?)

\documentclass[
a4paper,
final, 
12pt, 
numbers=noendperiod,
BCOR=5.00mm, 
bibliography=totoc,
listof=totoc,
headinclude
]{scrreprt}

\usepackage{libertine}
\usepackage[scaled=.83]{beramono}
\usepackage[libertine]{newtxmath}

\makeatletter
% redefine arabic numbering to use \oldstylenums
\renewcommand*\@arabic[1]{\oldstylenums{\number#1}}
% keep old arabic as Arabic
\newcommand*\@Arabic[1]{\number#1}
\newcommand*\Arabic[1]{\expandafter\@Arabic\csname c@#1\endcsname}
% redefine \pagenumbering so that it affects both \thepage and \Thepage
\renewcommand\pagenumbering[1]{% 
  \global\c@page\@ne
  \expandafter\ifx\csname @#1\endcsname\@arabic % if the desired numbering is arabic
    \gdef\thepage{\csname @Arabic\endcsname\c@page}% \thepage in standard arabic
    \gdef\Thepage{\csname @arabic\endcsname\c@page}% \Thepage in oldstylenums
  \else
    \gdef\thepage{\csname @#1\endcsname\c@page}% otherwise do whatever is requested
    \gdef\Thepage{\csname @#1\endcsname\c@page}% and also define \Thepage to be used in header or footer
  \fi
}
% ensure that the correct thing will happen
\pagenumbering{arabic}
\makeatother

% modify the header-footer to use \Thepage rather than \thepage
% use your prefered way of modifying the headers
\usepackage{fancyhdr}
\fancyhf{}
\fancyfoot[C]{\Thepage}
\pagestyle{fancy}

\usepackage{hyperref}

\usepackage{blindtext}
\begin{document}
\blinddocument
\end{document}
5
  • This is just about what I wanted. Thank you. However, there is one problem: Apparently, your solution leads to a conflict with the hyperrefpackage. Any idea how to solve this issue?
    – Vlad030691
    Commented Nov 1, 2014 at 17:56
  • 1
    @Vlad030691 Could you update the MWE in such a way that it works without my tweak and refuses to work with it? Then I'll hopefully be able to diagnose it ;)
    – yo'
    Commented Nov 1, 2014 at 19:18
  • I added both the working and not working examples. Thanks in advance for your help!
    – Vlad030691
    Commented Nov 2, 2014 at 18:38
  • @Vlad030691 I tried my best, see the updated answer.
    – yo'
    Commented Nov 2, 2014 at 20:42
  • 1
    @Vlad030691 You really should use what egreg suggests in the second answer. That is the correct approach.
    – yo'
    Commented Nov 3, 2014 at 9:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .