I'm using oldstyle numbers in my thesis and noticed that the pagenumbers in the table of contents are not providing a straight left line. The following image shows this behaviour for the numbers from a section with 11 subsections.
In the case of the KOMA-Script classes, the numbers of chapters (or sections in scrartcl
) can be modified by adding the Numbers=Monospaced
font feature to the sectionentrypagenumber
. However, this is not supported (as far as I know) for the lower level sectioning.
How can I get monospaced oldstyle numbers in the TOC?
EDIT: I used @egreg's solution to get the monospaced numbers and added the line
\addtokomafont{disposition}{\rmfamily\addfontfeatures{Numbers=Monospaced}}
to typeset all sectioning in monospaced numbers, too.
Unfortunately, @egreg's solution broke the siunitx
package, which started to use normal text font instead of math font. I solved this problem by adding the following line:
\sisetup{math-rm=\symrm}
\documentclass[a5paper,DIV=9]{scrartcl}
\addtokomafont{disposition}{\rmfamily}
\usepackage{fontspec}
\setmainfont{Latin Modern Roman}[Numbers=OldStyle]
\usepackage{lipsum}
\begin{document}
\tableofcontents
\section{a}
\subsection{a}
\lipsum
\subsection{a}
\lipsum
\subsection{a}
\lipsum
\section{a}
\subsection{a}
\lipsum
\subsection{a}
\lipsum
\subsection{a}
\lipsum
\section{a}
\subsection{a}
\lipsum
\subsection{a}
\lipsum
\subsection{a}
\lipsum
\section{a}
\subsection{a}
\lipsum
\subsection{a}
\lipsum
\subsection{a}
\lipsum
\subsection{a}
\lipsum
\subsection{a}
\lipsum
\end{document}