9

My main font numbers are set to OldStyle. How can I set Lining numbers for:

  • Titles (chapter, section, subsection, &c...),
  • Beginning of enumeration,
  • Page number, and
  • Footnote numbers (but not footnote itself)?


MWE:

\documentclass{article}

\usepackage{fontspec}
\usepackage{enumerate}
\usepackage{biblatex}

\setmainfont[Scale=1.0,Numbers={OldStyle,Proportional},Ligatures=TeX]{Minion Pro}

\begin{document}

\section{Section}
Text with numbers; 123 456 seven \& eight.

\begin{enumerate}
\item Item1 with footnote.\footcite{001}
\end{enumerate}

\end{document}


Current Output:
Current output Note:

  1. Ignore that the actual footnote has not been properly compiled.
  2. This is my first post; I apologise if it doesn't comply with guidelines. Please let me know if anything is wrong and I will make note for future reference.

2 Answers 2

7

Define a font family with the same font name, but with the Numbers=Lining option and change all places where lining numbers are desired.

I don't think you really want this, though. I used Linux Libertine because I don't have Minion Pro.

\documentclass{book}

\usepackage{fontspec}
\usepackage{enumitem}
\usepackage{biblatex}
%\usepackage{etoolbox} % already loaded by biblatex

\setmainfont[Numbers={OldStyle,Proportional},Ligatures=TeX]{Linux Libertine O}
\newfontfamily{\liningmainfont}[Numbers=Lining,Ligatures=TeX]{Linux Libertine O}

\setlist[enumerate]{font=\liningmainfont}
\makeatletter
\renewcommand{\@makefnmark}{%
  \hbox{\@textsuperscript{\normalfont\liningmainfont\@thefnmark}}%
}
\renewcommand\@seccntformat[1]{{\liningmainfont\@nameuse{the#1}\quad}}
\patchcmd{\@makechapterhead}{\thechapter}{{\liningmainfont\thechapter}}{}{}
\patchcmd{\chaptermark}{\thechapter}{{\liningmainfont\thechapter}}{}{}
\patchcmd{\sectionmark}{\thesection}{{\liningmainfont\thesection}}{}{}
\patchcmd{\ps@plain}{\thepage}{{\liningmainfont\thepage}}{}{}
\patchcmd{\@oddhead}{\thepage}{{\liningmainfont\thepage}}{}{}
\patchcmd{\@evenhead}{\thepage}{{\liningmainfont\thepage}}{}{}
\makeatother

\begin{document}

\chapter{Chapter}

\section{Section}
Text with numbers; 123 456 seven \& eight.

\begin{enumerate}
\item Item1 with footnote.\footcite{001}
\end{enumerate}

\clearpage
Even page
\clearpage
Odd page

\end{document}

Maybe there are other places where oldstyle numbers pop out; follow the same pattern: find the command that prints the number and patch it.

2
  • Is there any drawback in using this very approach to patch \@arabic only (since it is done only once and would work for all of the counters)?
    – henrique
    Sep 13, 2013 at 16:25
  • @henrique \@arabic should be expandable, which it wouldn't be with the patch you propose.
    – egreg
    Sep 13, 2013 at 16:35
7

You can use the command \addfontfeature{Numbers=Lining} to switch to lining numbers. In the following I defined the command \liningnumbers:

\newcommand\liningnumbers{\addfontfeature{Numbers=Lining}}

This can now be used as any other font switch like \small, \sffamily, etc. So now you only have to find a way to change the font for your four cases. This strongly depends on the class you are using. Here I demonstrate it only for the enumeration using the package enumitem:

% !TEX TS-program = lualatex
\documentclass{article}

\usepackage{fontspec}
\usepackage{enumitem}

\setmainfont[Scale=1.0,Numbers={OldStyle,Proportional},Ligatures=TeX]{TeX Gyre Pagella}
\newcommand\liningnumbers{\addfontfeature{Numbers=Lining}}

\setlist[enumerate]{font=\liningnumbers}

\begin{document}

\section{Section}
Text with numbers; 123 456 seven \& eight.

\begin{enumerate}
\item 1 Item1 without footnote.
\item 2 two
\item 3 three
\end{enumerate}

\end{document}

enter image description here

You must log in to answer this question.

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