3

I'm using newtxtext/newpxtext together with scrbook and I'd like to use oldstyle numbers only for page numbers, but also for page numbers in the toc.

The former package offers the macro \useosf, which is not allowed in combination with

\addtokomafont{pagenumber}{\osf}

as it can only be used in the preamble. But \addtokomafont also ends up within the document when shipped out.

As a workaround I can use

\newcommand\oldstylenumbers{\fontencoding{TS1}\selectfont}
\addtokomafont{pagenumber}{\oldstylenumbers}

But it does not affect the page numbers in the toc. The only possible option I know of is:

\addtokomafont{chapterentrypagenumber}{\oldstylenumbers}

which is not available for sections and subsections etc.

How can I change all page numbers in the toc to oldstyle numbers?

I also read that changing \thepage is not recommended as it would break hyperref. That is not desirable.

Full MWE

\documentclass{scrbook}

\usepackage{newtxtext}
\usepackage{siunitx}
\usepackage{blindtext}
\renewcommand{\sfdefault}{\rmdefault}

\newcommand\oldstylenumbers{\fontencoding{TS1}\selectfont}
\addtokomafont{pagenumber}{\oldstylenumbers}
\addtokomafont{chapterentrypagenumber}{\oldstylenumbers}

\begin{document}
\tableofcontents
\chapter{Chapter}
\section{Section}
\subsection{Subection}
123456789 \num{123456789}
\blindmathpaper
\chapter{Chapter}
\subsection{Subection}
\blindmathpaper
\subsection{Subection}
\blindmathpaper
\chapter{Chapter}
\subsection{Subection}
\blindmathpaper
\chapter{Chapter}
\subsection{Subection}
\blindmathpaper
\chapter{Chapter}
\subsection{Subection}
\blindmathpaper
\subsection{Subection}
\blindmathpaper
\chapter{Chapter}
\subsection{Subection}
\blindmathpaper
\subsection{Subection}
\blindmathpaper
\subsection{Subection}
\blindmathpaper

\end{document} 

enter image description here

6

You can change it with the tocpagenumberformat option. There is no need to define your own commands, \oldstylenums works fine.

\documentclass{scrbook}

\usepackage{newtxtext}
\usepackage{siunitx}
\usepackage{blindtext}
\renewcommand{\sfdefault}{\rmdefault}

\addtokomafont{pagenumber}{\oldstylenums}
\addtokomafont{chapterentrypagenumber}{\oldstylenums}
\RedeclareSectionCommand[tocpagenumberformat=\oldstylenums]{section}
\RedeclareSectionCommand[tocpagenumberformat=\oldstylenums]{subsection}
\begin{document}
\tableofcontents
\chapter{Chapter}
\section{Section}
\subsection{Subection}
\oldstylenums{01234}
123456789 \num{123456789}
\blindmathpaper
\chapter{Chapter}
\subsection{Subsection}
\blindmathpaper
\subsection{Subsection}
\blindmathpaper
\chapter{Chapter}
\subsection{Subsection}
\blindmathpaper
\chapter{Chapter}
\subsection{Subsection}
\blindmathpaper
\chapter{Chapter}
\subsection{Subection}
\blindmathpaper
\subsection{Subection}
\blindmathpaper
\chapter{Chapter}
\subsection{Subection}
\blindmathpaper
\subsection{Subection}
\blindmathpaper
\subsection{Subection}
\blindmathpaper

\end{document} 

enter image description here

| improve this answer | |
  • Thank you! As always my example was too minimal. \oldstylenums unfortunately breaks the numbering in case there are parts in the document with roman numbering. However, hidden in the source code of newpxtext and newtxtext I found the commands \osfstyle and \textosf which work like intended. – thewaywewalk Dec 26 '17 at 0:38
  • 1
    Addendum: You can alternatively use \RedeclareSectionCommands[tocpagenumberformat=\oldstylenums]{section,subsection}. – Schweinebacke Dec 27 '17 at 15:05
  • @Schweinebacke that does not work for me – thewaywewalk Dec 27 '17 at 16:35
  • @thewaywewalk \RedeclareSectionCommands has been implemented in the same KOMA-Script version like \RedeclareSectionCommand. So it should work for you too. Did you get an error message? Which? – Schweinebacke Dec 27 '17 at 17:55
  • @Schweinebacke I have overseen the s - it does work indeed! thanks! – thewaywewalk Dec 27 '17 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.