I have a document, where for different reasons, I use unicode-math and siunitx. When I load unicode-math some units whose symbols are usually slanted (as math variables) are not slanted anymore.

Why is that? Do you know a workaround?

Here it is the minimal example:


\usepackage{unicode-math}% this makes e appear straight (not math)


\SI{1.234}{\planckbar^{-4}\elementarycharge^{2}} %the outcome depends on loading unicode-math

$1.234 \hbar^{-4} e^2$ %this is always ok


Output (note the e symbol, electron charge, it should appear slanted)



The answer by egreg provides a perfectly good solution, but it might be useful to understand why this is happening.

Internally, siunitx resolves input into constructs of the form


so here


With classical TeX, switching math-text-math gets us 'back to normal' in font terms so we can the normal italic font for letters without any explicit formatting. However, with unicode-math this doesn't seem to happen: nested font changes stay active. As as result, the usual set up gives incorrect results.

I'll see whether this can be addressed at the unicode-math end or whether a change in siunitx is needed.


Something weird is happening when \text is processed in the argument of \SI. Here's a fix:


\usepackage{unicode-math}% this makes e appear straight (not math)




$1.234\, \hbar^{-4} e^2$ %this is always ok


enter image description here

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.