TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I use mathspec's \setmathsfont and hyperref, and try to typeset a URL, most of the URL uses monospace, as it should. Good.

However, digits use the maths font. Anyone know how to fix this?



\setmathsfont(Digits){Minion Pro}
\setmonofont{Source Code Pro}

\nolinkurl{abc123def} % same problem with \url{..}


enter image description here

share|improve this question
@Qrrbrbirlbel: Thanks for the edit. I didn't have enough reputation to embed the image myself, of course. – Andy Morris Feb 24 '13 at 21:28
up vote 5 down vote accepted

The problem is due to the fact that mathspec makes the digits of type mathord not mathalpha. Then the work done by hyperref to set up to use the ttfamily does not conclude successfully for the digits, as it proceeds in math mode.


\setmathsfont(Digits){Minion Pro}


% \setmonofont{Source Code Pro}

\nolinkurl{abc123def} % same problem with \url{..}

digits in mono

share|improve this answer
Works perfectly! Thankyou so much. – Andy Morris Feb 25 '13 at 1:14
You're welcome! I looked for an option to mathspec package to do this, but there does not seem to be one, so I just copied-pasted from mathspec.sty and replaced \mathord by \mathalpha. The point is that hyperref does its things in math mode (after having set-up the font to be the mono font). – jfbu Feb 25 '13 at 8:46
I also ran into this problem. Now I'm wondering, is this a bug? If so, in which package, hyperref or mathspec? – ph0t0nix Jan 27 at 17:09
@ph0t0nix The legacy LaTeX setup declares the digits of variable family type (aka "mathalpha") in order to be able to access old style figures via \mathnormal: $\mathnormal{0123456789}$. Package mathspec perhaps decided this did not make sense anymore in the context of Unicode type fonts. As per hyperref, well, it can not have to think about all possibilities; perhaps include a note in its documentation. Same can be said of mathspec. – jfbu Jan 28 at 13:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.