I'm trying to find a good way to archive the following using fontspec, unicode-math and lualatex:
- almost global oldstyle figures including inline math
- lining numbers for displayed equations, e.g.
equation.
My current unstable, ugly solution is the following. I say unstable because class options like fleqn will break it to the ugliness. . . well take a look:
\documentclass{article}
\usepackage{fontspec}
\usepackage{unicode-math}
\defaultfontfeatures{Numbers=OldStyle}
\setmainfont[Ligatures=TeX]{Tex Gyre Pagella}
\setmathfont[]{Tex Gyre Pagella Math}
%% PROBLEM : No +onum in this font (or Cambria Math)
%% "SOLUTION": Take numbers from normal font
\setmathfont[range=\mathup/{num}]{Tex Gyre Pagella}
%% PROBLEM : Not old style figures in display env.
%% "SOLUTION": Reload the Math variant since it ain't got onum.
\everydisplay={\setmathfont[range=\mathup/{num}]{Tex Gyre Pagella Math}}
\begin{document}
\noindent\centering
123\textit{x}\textsubscript{456}\\
$123x_{456}$
\begin{equation}
123x_{456}
\end{equation}
\end{document}
Output is something like this:

Spending quite a bit of time going through the manuals of fontspec, unicode-math and mathspec I have not been able to find a better solution. The version argument to setmathfont (of unicode-math) seems to expect stuff like bold.
Bonus question: am I breaking some typographic style?
\usepackage{etoolbox}then\AtBeginEnvironment{equation}{\addfontfeatures{Numbers={Monospaced,Lining}}}work? – Doc Octal Jul 17 '21 at 22:36