5

Siunitx does not recognise the oldstyle numbers, despite the detect-all setting, can you help me?

MNWE:

\documentclass{standalone}

\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella}

\newfontfamily\oldstyle[Numbers={Monospaced,OldStyle}]{TeX Gyre Pagella}

\usepackage[detect-all]{siunitx}

\begin{document}
  \oldstyle\num{123}123
\end{document}

This results in:

enter image description here

7

Just convince siunitx to use your newly created font family by:

\sisetup{text-rm=\oldstyle}

full example:

\documentclass{standalone}

\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella}

\newfontfamily\oldstyle[Numbers={Monospaced,OldStyle}]{TeX Gyre Pagella}

\usepackage[detect-all]{siunitx}

\AtBeginDocument{
\sisetup{text-rm=\oldstyle}
}

\begin{document}
  \oldstyle\num{123}123
\end{document}

enter image description here


You are forced to do that, as said in the manual:

The siunitx package controls the font used to print output independently of the surrounding material. The standard method is to ignore the surroundings entirely, and to use the current body fonts.

To work against that, there are just a few possibilities:

detect-all combines the following four single commands

  • detect-weight
  • detect-family
  • detect-shape
  • detect-mode

So it does not detect all - the name is therefore a little misleading.

The number style is a rather particular font setting which is not included in detect-all.


As siunitx is intended to be used for scientific notations of numbers and units it is rather comprehensible that the number style can't be changed that easily as it wouldn't look "scientific" anymore. I'm using old-style numbers in my thesis as well for chapter numbers etc. and I was actually expecting siunitx to adapt this setting at first, but gladly welcomed that it doesn't.

  • Explicitly setting it is not really the point of detect, is it? – MaxNoe Apr 28 '15 at 18:07
  • @MaxNoe have a look at my edit. – thewaywewalk Apr 28 '15 at 18:31

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.