4

With LuaTeX, all of a sudden the first digits of any numbers outside $math$ (and siunitx's \num) are turned into superscripts if I set \defaultfontfeatures[\rmfamily,\sffamily]{Fractions=On} -- independent of the fonts I use. In each case only the last digit of a number is in normal font, the first digits are superscript.

% -*- mode: latex; TeX-engine: luatex; coding: utf-8; -*-
\documentclass{scrartcl}
\PreventPackageFromLoading{fixltx2e}
\usepackage{siunitx}
\usepackage{luatextra}
\defaultfontfeatures[\rmfamily,\sffamily]{Fractions=On} % <-- that's it
\setmainfont{Linux Libertine O}
% \setmainfont{Libertinus Serif}
\setsansfont{Libertinus Sans}
\setmonofont{Libertinus Mono}
\begin{document}
blabla 6176 787347 125\footnote{bla 123} \num{10} \num{19827}

$1234 + 567 = 8910$

\medskip
\textsf{blabla 6176 787347 125\footnote{bla 123} \num{10} \num{19827}}

$\mathsf{1234 + 567 = 8910}$
\end{document}
  • BTW: As far as I can see LuaTeX created something in the first run because luaotfload has been changed. – Alexander Wittmann Sep 28 '18 at 17:45
  • I get same here, I pinged the luaotfload maintainers in this site's chat,. – David Carlisle Sep 28 '18 at 18:07
  • it also happens for xelatex – user2478 Sep 28 '18 at 18:27
  • it doesn't happen in texlive 2017 but it seems to be due to a font update rather than luatex or luaotfload. – David Carlisle Sep 28 '18 at 19:29
  • 1
    See also tex.stackexchange.com/q/234857 – Thérèse Oct 15 '18 at 11:11
3

The OpenType fractions feature should not be enabled globally, and should instead be enabled selectively for parts of text containing fractions (some fonts try to make it work globally, but it is often buggy since this kind of behavior is hard to achieve with OpenType features):

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Libertinus Serif}
\setsansfont{Libertinus Sans}
\setmonofont{Libertinus Mono}
\begin{document}
blabla 6176 787347 125\footnote{bla 123} 10 19827
{\addfontfeatures{Fractions=On} 1234/1234}

$1234 + 567 = 8910$

\medskip
\textsf{blabla 6176 787347 125\footnote{bla 123} 10 19827
{\addfontfeatures{Fractions=On} 1234/1234}}

$\mathsf{1234 + 567 = 8910}$
\end{document}

With XeTeX this gives: XeTeX output

As a bonus, with XeTeX1 if you use fraction slash (U+2044) the fraction (or numerator and denominator) feature will be activated automatically for the sequence of numbers around it:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Libertinus Serif}
\setsansfont{Libertinus Sans}
\setmonofont{Libertinus Mono}
\begin{document}
blabla 6176 787347 125\footnote{bla 123} 10 19827 1234⁄1234

$1234 + 567 = 8910$

\medskip
\textsf{blabla 6176 787347 125\footnote{bla 123} 10 19827 1234⁄1234}

$\mathsf{1234 + 567 = 8910}$
\end{document}

1 That is actually a HarfBuzz feature, following Unicode recommendation, so it works anywhere HarfBuzz is used, e.g. In Firefox and Google Chrome.

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.