2

I have a latex document that looks something like this

\documentclass{report}

\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
\usepackage[default,osf]{sourcesanspro}

\begin{document}

\tableofcontents

\chapter{Introduction} This chapter's content... \clearpage
\section{Structure} This section's content... \clearpage
\subsection{Top Matter} This subsection's content... \clearpage
\section{More Structure} This section's content... \clearpage
\subsection{More Top Matter} This subsection's content... \clearpage

\chapter{Chapter} This chapter's content... \clearpage
\section{Structure} This section's content... \clearpage
\subsection{Top Matter} This subsection's content... \clearpage
\section{More Structure} This section's content... \clearpage
\subsection{More Top Matter} This subsection's content... \clearpage

\chapter{Chapter} This chapter's content... \clearpage
\section{Structure} This section's content... \clearpage
\subsection{Top Matter} This subsection's content... \clearpage
\section{More Structure} This section's content... \clearpage
\subsection{More Top Matter} This subsection's content... \clearpage

\chapter{Chapter} This chapter's content... \clearpage
\section{Structure} This section's content... \clearpage
\subsection{Top Matter} This subsection's content... \clearpage
\section{More Structure} This section's content... \clearpage
\subsection{More Top Matter} This subsection's content... \clearpage

\end{document}

Resulting in a TOC that looks like this:

TOC

The alignment of the page numbers looks pretty bad:

pagenumbers

As you can see I've defaulted the document to oldstyle figures but that doesn't look good in the TOC. I'd prefer to using tabular lining (or perhaps tabular oldstyle) figures for the TOC page numbers.

How can I set the TOC to use tabular lining figures?

One wrinkle ... I believe there might be a way to do this with fontspec but my microtype options don't seem to work with XeLaTeX or LuaLaTeX

2
  • It looks OK to me with the page numbers matching the entry titles (bold chapter name and bold page number). The tocloft package may be of assistance; perhaps I'll look at that at some time. – Peter Wilson Feb 23 '19 at 19:37
  • The issue is the alignment of the numbers. Currently the numerals are proportional old style. I’m trying to figure out how to change them to lining tabular just for the TOC. – agf1997 Feb 25 '19 at 9:27
2

The sourcesanspro package doesn't provide a command to change to tabular lining figures, but you can easily create one:

\newcommand\tabularnums{%
  \def\sourcesanspro@figurealign{T}%
  \def\sourcesanspro@figurestyle{LF}%
  \def\familydefault{SourceSansPro-TLF}%
  \fontfamily{SourceSansPro-TLF}%
  \selectfont
}

Then

{\tabularnums
 \tableofcontents
}

will yield:

toc

3
  • How can this be extended to do lining numbers for the TOC instead of old style? – agf1997 Feb 26 '19 at 19:33
  • @agf1997 sorry, wasn't reading closely enough... – Robert Feb 26 '19 at 22:13
  • no worries. I actually figured it out myself and then decided I prefer the old style anyway. I’m not sure if that’s improper usage of old style but it just looks better IMHO. Thanks for adding to the answer though as others might find it helpful – agf1997 Feb 26 '19 at 22:18

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.