josephwright / siunitx

A comprehensive (SI) units package for LaTeX
LaTeX Project Public License v1.3c
356 stars 26 forks source link

mode = text not working. Oldstyle numbers are not applied. #708

Closed dflvunoooooo closed 9 months ago

dflvunoooooo commented 9 months ago

The option mode = text does not work. In the below example you can see, that the oldstyle numbers don't get applied to the numbers in \num[mode = text]{…} nor in \num[mode = match]{…}. On the other hand the depreciated option \num[detect-all]{…} does work.

\documentclass{scrreport}

\usepackage{fontspec}
\usepackage{siunitx}

\setmainfont{Libertinus Serif}  

\begin{document}
Normal
1234567890

\num[mode = text]{1234567890}

Oldstyle
\addfontfeature{Numbers=OldStyle}

1234567890

\num[mode = text]{1234567890}

\num[mode = match]{1234567890}

\num[detect-all]{1234567890}

\end{document}

Screenshot_20231221_161625

josephwright commented 9 months ago

\addfontfeature doesn't reset \rmdefault to apply old-style numbers, so siunitx doesn't either - you can set reset-text-family = false to leave the current family alone.

dflvunoooooo commented 9 months ago

Thank you for your answer. So mode = text does not apply the text settings? The option reset-text-family = false does unfortunately not work.

josephwright commented 9 months ago

You need both mode = text and reset-text-family = false, as the latter only applies in text mode.

josephwright commented 9 months ago

Thank you for your answer. So mode = text does not apply the text settings?

It does - as standard the default roman text - \addfontfeature doesn't change the defaults, only the current font.

dflvunoooooo commented 9 months ago

I see. Thank you for explaining.