# OldStyle numbers, the Fira Sans font and the siunitx package: incorrect % symbol

I am working on a document where I regularly use percentages. For that I'd like to use the siunitx package so that I can write \SI{56}{\%}. I also prefer to use OldStyle (or Lining) numbers. Currently I'm using XeLaTeX and the Mozilla Fira Sans font and all seems to go well, except the % symbol which seems to come from the default Computer Modern font.

Here's my MWE:

\documentclass[a4paper]{scrartcl}

\usepackage[]{mathspec}
\setmainfont[Numbers=OldStyle,BoldFont={Fira Sans SemiBold}]{Fira Sans Book}
\setsansfont[Numbers=OldStyle,BoldFont={Fira Sans SemiBold}]{Fira Sans Book}
\setmonofont{Fira Mono}
\setmathsfont(Digits,Latin,Greek){Fira Sans Book}
\setmathsf[]{Fira Sans Book}

\usepackage[]{siunitx}

\begin{document}

\begin{itemize}
\item Some numbers in text mode: 1234567890.

\item  Some numbers using the \texttt{siunitx} package:
\SI{1234567890}{m/s}. This works well.

\item However, specifying percentages doesn't use the \% symbol I
would like: \SI{24.5}{\%} or \SI{24.5}{\percent}. Compared to
regular text: 24.5 \%.
\item Another font check: SI \SI{9}{million} vs regular 9 million.
\end{itemize}

\end{document}


Any idea how to tell the mathspec package (or something else) to take the % symbol from the Fira Sans font? I also tried the detect-all option of the siunitx package, but that didn't work either.

Strangely enough, if I remove the Numbers=OldStyle option for the fonts and use detect-all for siunitx the correct symbol is used:

• Does it help if you do \SI[mode=text]{24.5}{\%} or \SI[mode=text]{24.5}{\percent}? – Arash Esbati Jan 7 '16 at 21:01
• Thanks for the quick reply! Adding [mode=text] indeed works. Although it will be a bit tedious add that for each percentage. Time to do some RegExp replacing ;-). Thanks! – ph0t0nix Jan 7 '16 at 21:05
• You're welcome. It depends on your document, but I tend to do \sisetup{mode=text} in the preamble if I use a font with no proper math support. Otherwise, use the answer provided by @egreg. – Arash Esbati Jan 7 '16 at 21:20

Redefine \% to do the right thing:

\documentclass[a4paper]{scrartcl}

\usepackage[]{mathspec}
\setmainfont[Numbers=OldStyle,BoldFont={Fira Sans SemiBold}]{Fira Sans Book}
\setsansfont[Numbers=OldStyle,BoldFont={Fira Sans SemiBold}]{Fira Sans Book}
\setmonofont{Fira Mono}
\setmathsfont(Digits,Latin,Greek){Fira Sans Book}
\setmathsf[]{Fira Sans Book}

\usepackage[]{siunitx}

\DeclareRobustCommand{\%}{\ifmmode\textnormal{\symbol{\%}}\else\symbol{\%}\fi}
\DeclareSIUnit{\percent}{\%}

\begin{document}

\begin{itemize}
\item Some numbers in text mode: 1234567890.

\item  Some numbers using the \texttt{siunitx} package:
\SI{1234567890}{m/s}. This works well.

\item However, specifying percentages doesn't use the \% symbol I
would like: \SI{24.5}{\%} or \SI{24.5}{\percent}. Compared to
regular text: 24.5 \%.
\item Another font check: SI \SI{9}{million} vs regular 9 million.
\end{itemize}

\end{document}


• Thanks @egreg! That's even better than the [mode=text] suggestion by @Arash Esbati. – ph0t0nix Jan 7 '16 at 21:15