7

The following MCE displays \unit{\micro\gram} as expected, that is with the (upright mu) Micro Sign character:

\documentclass{article}
\usepackage{fontspec}
\usepackage{siunitx}
\setmainfont{TeX Gyre Schola}
% \setmainfont{RobotoFlex-VariableFont.ttf}
\begin{document}
\begin{itemize}
\item Greek Small Letter Mu/Unicode char 03BC: μ/\char"03BC
\item Micro Sign/Unicode char 00B5: µ/\char"00B5
\item \verb|\unit{\micro\gram}|: \unit{\micro\gram}
\end{itemize}
\end{document}

enter image description here

However, if the TeX Gyre Schola font is replaced with the Roboto Flex font, \unit{\micro\gram} is displayed with a slanted mu, so not with a Micro Sign:

enter image description here

I assume this is a bug in the Roboto Flex font, but is there anything that can be done on the (Lua)LaTeX side to resolve the issue?

2
  • 1
    Unsure whether you can call this a bug. It rather seems to be a choice of the font designers to let the micro sign have an italic glyph. See: fonts.google.com/specimen/Roboto+Flex?preview.text=3%20%C2%B5m … but the other Roboto fonts indeed seem to have an upright glyph Commented 19 hours ago
  • @JasperHabicht In any case, to my knowledge, this choice would go against the recommendations of the International Bureau of Weights and Measures (BIPM). Commented 17 hours ago

2 Answers 2

4

I can offer a workaround:

\documentclass{article}
\usepackage{fontspec}
\usepackage{siunitx}

\setmainfont{RobotoFlex-VariableFont.ttf}

%\DeclareSIPrefix{\micro}{\symbol{"03BC}}{-6}
\DeclareSIPrefix{\micro}{\textup{μ}}{-6}

\begin{document}

\verb|\unit{\micro\gram}|: \unit{\micro\gram}

\end{document}

Curiously, swapping the comments results in the same output, but removing \textup makes the symbol print in italics.

output

3

The siunitx package uses 00B5 as default to get an upright mu (see https://github.com/josephwright/siunitx/issues/822#issuecomment-3228015058). You can overwrite this definition to use 03BC again. This should be done after \begin{document} because siunitx sets the default in \AtBeginDocument.

MWE:

\documentclass{article}
\usepackage{fontspec}
\usepackage{siunitx}
\setmainfont{RobotoFlex-VariableFont.ttf}
\begin{document}
\ExplSyntaxOn
\siunitx_declare_prefix:Nne \micro  { -6 } { \__siunitx_unit_non_latin:n { "03BC } }
\ExplSyntaxOff
\begin{itemize}
\item Greek Small Letter Mu/Unicode char 03BC: μ/\char"03BC
\item Micro Sign/Unicode char 00B5: µ/\char"00B5
\item \verb|\unit{\micro\gram}|: \unit{\micro\gram}
\item \verb|\unit{\ug}|: \unit{\ug}
\end{itemize}
\end{document}

Result:

screenshot showing upright mu in unit

There might be unintended side effects of this redefinition that I am not aware of, test carefully (or wait until Joseph Wright provides a proper explanation and solution...)

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.