I have seen this question, but in making an MWE I discovered that this happens without fontspec loaded at all. I would expect that siunitx's mode detection would cause output to match the numerals in either text or math mode in the rest of the document.

This works as I'd expect with two fonts including oldstyle numerals (cfr-lm and mathpazo): the numerals used in \num{560} correspond to those used in 560, and the same for \(\num{560}\) and \(560\).

But using adobe-garamond with mathdesign, I get oldstyle numerals with \(\num{560}\) while getting uppercase numerals with \(560\). The behavior is the same if I use $ $ or \( \) to delimit math mode. I tried to find a free font that also has this issue, but was unsuccessful; so I apologize in advance for that inconvenience.

How can I use siunitx with \usepackage[adobe-garamond]{mathdesign} and have siunitx's mode detection function properly?


%\usepackage{cfr-lm} % this works as expected
%\usepackage[osf]{mathpazo} % this works as expected
%\usepackage{mathpazo} % this also works as expected
\usepackage[adobe-garamond]{mathdesign} % this doesn't work as expected (siunitx typesets oldstyle figures)
%\sisetup{detect-all} % tried this; it has no effect

Here, a test of numerals in text mode: 560

And numerals in mathematics mode: \(560\)

And numerals in \textsf{siunitx} macros (text): \num{560}

And numerals in \textsf{siunitx} macros (math): \(\num{560}\)

% for Joseph's comment:
With mathnormal: $\mathnormal{560}$

With mathrm: $\mathrm{560}$


enter image description here

*I realize that the sans serif fonts are bitmapped in my MWE; I just didn't load anything else for the purpose of keeping the MWE minimal.

  • I don' have the font here, but my suspicion is \mathrm versus \mathnormal. Could you try a 'reference rendering' using them?
    – Joseph Wright
    Mar 12 '14 at 20:13
  • @JosephWright you mean something like comparing $\mathrm{560}$ to $\mathnormal{560}$, correct? Mar 12 '14 at 20:19
  • Yes, exactly: the standard settings in siunitx use \mathrm, but that may not always be the best choice.
    – Joseph Wright
    Mar 12 '14 at 20:20
  • @JosephWright I edited this in... now I'm even more confused... why would math mode digits be slanted/italicized? Mar 12 '14 at 20:26
  • @JosephWright I just found that mdpgd.sty doesn't set \mathnormal, so a default or fall-back is likely to be used. I don't know much of the TeXnical details behind math alphabets, but it seems to me that this might be relevant? Mar 13 '14 at 17:26

The mechanisms used by siunitx assume more-or-less 'well-behaved' setting of LaTeX font commands. In particular, in math mode the package uses \mathrm to typeset output as standard. If that fails, using \mathnormal is the usual fall back but here that does not appear to apply. I would therefore go to the second fall back of using \ensuremath:

\sisetup{number-math-rm = \ensuremath}

which will essentially force 'normal math mode' on the output. This of course will mess up formatting if you have any letters inside a number, but as that is unlikely you should be OK.

  • It works here for me, and I don't think I'll have any issues with letters in numbers. If I do, they'll be few enough in number to handle case-by-case I think. Mar 13 '14 at 17:48

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.