2

Using xelatex, fontspec and unicode-math, old style nums work just fine. But when using xfrac, the oldstylenums seems to be reverted to some basic version of the command, using a pixely computer modern font. How can I avoid this?

comparison of output (with and without xfrac)

MWE:

\documentclass[11pt,paper=a4,parskip=half,ngerman]{scrartcl}
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella}
\usepackage{mathtools,amssymb,amsthm}
\usepackage{xfrac}
\usepackage{unicode-math}
\setmathfont{TeX Gyre Pagella Math}


\begin{document}

with xfrac \oldstylenums{10827}

\end{document}

xelatex outputs the following (only when using xfrac), and I understand this is the problem, but why does it happen and how do I keep xfrac from doing this?

LaTeX Font Warning: Font shape `TS1/TeXGyrePagella(0)/m/n' undefined
(Font)              using `TS1/cmr/m/n' instead on input line 12.

(And, btw: Is this an okay way to setupfontspec and unicode-math using xelatex? I am just switching from pdflatex.)

7

xfrac loads the textcomp package, and textcomp redefines \oldstylenums. Load xfrac before fontspec, than the definition of fontspec will win:

\documentclass[11pt,paper=a4,parskip=half,ngerman]{scrartcl}
\usepackage{xfrac}
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella}

\begin{document}

with xfrac \oldstylenums{10827}

\end{document}

enter image description here

  • Thank you! Is that kind of a bug that should be reported? (And if so, for which packet?) – Marian Jan 22 at 13:11
  • I'm discussing this already on the latex team list, imho we should avoid that textcomp redefines oldstylenums in such cases. – Ulrike Fischer Jan 22 at 13:54
6

I can’t explain the innards of xfrac, but if you want lowercase numbers and vulgar fractions with Palatino, you don’t need xfrac.

Instead, get FPL Neu, which, unlike TeX Gyre Pagella, defines the dnom and numr features needed for arbitrary fractions. Then use the \vfrac command provided by xltxtra:

\documentclass{article}
\usepackage{xltxtra}% loads fontspec, realscripts, and metalogo
\setmainfont{FPL Neu}[Numbers=OldStyle]
\begin{document}
10827

\vfrac{123}{456}
\end{document}

output

  • I've chosen Ulrike's answer as the "accepted" one as it most closely answers the exact question, but yours also helps. Thank you! – Marian Jan 22 at 13:15

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.