I'm using mathspec
with XeLaTeX
to typeset documents in a system font (Fira Sans but I don't think it matters). When I include punctuation and certain other symbols in math mode, they come out in Computer Modern.
I gather from this answer that this is a known issue with mathspec
, and I can use the code there to fix the issue for periods, commas, and the like.
But the fix doesn't seem to work for dollar signs. Here's an MWE:
\documentclass{article}
\usepackage{mathspec}
\setallmainfonts{Fira Sans Light}
\makeatletter
\DeclareMathSymbol{&}{\mathord}{\eu@LatinLowercase@symfont}{`&}
\DeclareMathSymbol{$}{\mathpunct}{\eu@LatinLowercase@symfont}{`$}
\makeatother
\begin{document}
Ampersands look good in text mode \& also in math mode: $A \,\&\, B$.\\
But dollar signs should look like thi\$, not thi$\$$.
\end{document}
\%
can help. It is also worth mentioning that Fira Math is now on CTAN, so an alternative would be\usepackage[sfdefault]{FiraSans}\usepackage{unicode-math}\setmathfont{Fira Math}
. – Ruixi Zhang Oct 19 '18 at 2:37\mathrm{\$}
. – Davislor Oct 19 '18 at 20:47