7

I'm trying to find a good way to archive the following using fontspec, unicode-math and lualatex:

  1. almost global oldstyle figures including inline math
  2. 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:

Output with different number styles in display and inline

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?

  • 1
    What's the sense of having different figures in inline and display math? – egreg Jun 29 '13 at 22:06
  • My numbers inline are easy to interpret, e.g. magnitudes and references. In text I prefer old style figures (osf). In displayed equations I may want to avoid pitfalls of osf. Is it good style and advisable? I don't know. Testing with some smaller documents suggests it works OK (IMO). Edit: Do let me know if this breaks some typographic practices. – Rasmus Jun 29 '13 at 22:28
  • 3
    I don’t really think using old style figures in math is a good idea. A quick search gives tex.stackexchange.com/questions/29100/…, it and the next comments are interesting to read. – Khaled Hosny Jun 30 '13 at 1:17
  • 2
    I don't know if my answer will suit you but I'll try my best. Two days ago, I answered a very similar question regarding archaic fonts. You can find the post here (tex.stackexchange.com/questions/352447/…). I hope that my post will be helpful to you. Cheers. – Gregor Perčič Mar 3 '17 at 9:57

Your Answer

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

Browse other questions tagged or ask your own question.