[Tex/LaTex] Using mathspec to change digits font in math mode isn’t working

libertinemath-modemathspec

I'd like to use the Linux Libertine font with a document, and I'm running into a problem with digits in math mode. Here is a MWE:

\documentclass[11pt]{article}

\usepackage[math]{mathspec}
\setprimaryfont{Linux Libertine O}

\begin{document}
1 $1$ $\mathrm{1}$ $\text{1}$
\end{document}

which, when compiled with XeLaTeX, produces the following (no errors reported):

enter image description here

As you can see, $1$ still gives Computer Modern. But my understanding from the mathspec documentation is that \setprimaryfont should apply to digits in math mode:

enter image description here

Perhaps I'm misunderstanding something about the documentation, or perhaps I have a problem with my fonts. I'm using TeXstudio 2.6.6 with MiKTeX 2.9 on Windows 7 64-bit.

Any help with getting $1$ to make a Linux Libertine 1 would be appreciated.

Best Answer

You can simply remove the option math when loading mathspec.

MWE

\documentclass[11pt]{article}

\usepackage{mathspec}
\setprimaryfont{Linux Libertine O}

\begin{document}
1 $1$ $\mathrm{1}$ $\text{1}$
\end{document} 

Output

enter image description here

Loading mathspec with the math option forces mathspec to load fontspec without the no-math option.

And the fontspec manual states:

If you find that fontspec is incorrectly changing the maths font when it should be leaving well enough alone, apply the [no-math] package option to manually suppress its maths font.

Related Question