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?

David Carlisle
  • 757,742
Rasmus
  • 1,256
  • 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 http://tex.stackexchange.com/questions/29100/using-old-style-numerals-in-xelatex-in-math-mode#comment57071_29100, it and the next comments are interesting to read. – خالد حسني Jun 30 '13 at 01: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 (http://tex.stackexchange.com/questions/352447/how-to-write-like-old-mathematical-papers/356414#356414). I hope that my post will be helpful to you. Cheers. – God bless Mar 03 '17 at 09:57
  • Does \usepackage{etoolbox} then \AtBeginEnvironment{equation}{\addfontfeatures{Numbers={Monospaced,Lining}}} work? – Doc Octal Jul 17 '21 at 22:36

0 Answers0