10

The Problem

I'm using unicode-math and the font TeX Gyre Pagella Math. Also, I use siunitx to denote my quantities. Unfortunately, the option \micro of siunitx doesn't get expanded to µ, but is dropped.

(The same behaviour can be observed when using mathspec in XeLaTeX)

Minimal working example

Compile with Xe/LuaLaTeX.

\documentclass{standalone}
\usepackage{unicode-math}
\setmathfont{TeX Gyre Pagella Math}
\usepackage[mode = math]{siunitx}
\begin{document}
\SI{10}{\micro\m}
\end{document}

Output

real

Expected output

expected

Henri Menke
  • 109,596

2 Answers2

8

As explained in an answer by nlogax to microtype + siunitx and \micro - mysterious warnings Unicode has—besides the Greek Small Letter Mu character µ—a special Micro Sign µ.

That is to be used here. For some reason this is not present in unicode-math.
I assume that you also use TeX Gyre Pagella as your text font so we can use it from there with \text.

Code

\documentclass{standalone}
\usepackage{unicode-math}
\setmainfont{TeX Gyre Pagella}
\setmathfont{TeX Gyre Pagella Math}
\usepackage[mode = math]{siunitx}
\sisetup{math-micro=\text{µ},text-micro=µ}
\begin{document}
\SI{10}{\micro\m}
\SI[mode=text]{10}{\micro\m} % just for reference
\end{document}

Output

enter image description here

Qrrbrbirlbel
  • 119,821
  • Just for more information: the character can also be input in the \sisetup line as ^^b5, if it's somehow difficult to use the Unicode character directly. – egreg Jun 12 '13 at 21:24
6

This seems to work

\documentclass{standalone}
\usepackage{unicode-math}
\setmainfont{TeX Gyre Pagella}
\setmathfont{TeX Gyre Pagella Math}
\usepackage[mode = math]{siunitx}
\def\SIUnitSymbolMicro{\textup{μ}}
\begin{document}


\SI{10}{\micro\m}
\end{document}

Note I needed to specify a text font as well.

enter image description here

David Carlisle
  • 757,742
  • Why \def and not \cs_set:Npn \SIUnitSymbolMicro {\textup{μ}}? – Marco Daniel Jun 12 '13 at 21:10
  • 1
    @MarcoDaniel should be \newcommand probably. the packages use l3 internally but that doesn't mean you have to (or should) use l3 in the document preamble. \def is shorter than \newcommand so reduces the chance of a typo:-) – David Carlisle Jun 12 '13 at 21:26