# Combine arevmath (or similar) with unicode-math

Say I need to use a certain sans serif font (not Arial, but I am using this in the example, because it is widely available). As a consequence, I need to use a sans serif math font.

The main font obviously does not have the full math palette, so I need a sans serif math. My idea was to use the arevmath package, because I like the symbols and think they fit quite well -- except for the numbers. So my idea was to use unicode-math in order to use upright numbers and latin letters from the main font.

\documentclass{article}

\usepackage{fontspec}
\usepackage{arevmath}
\usepackage{unicode-math}

\setmainfont{arial}
%\setmathfont{firamath}  %% <--- using this, it will work
\setmathfont{arial}[range={up/{num,latin}}]

\begin{document}
test 123 $123$
\end{document}


The above code yields the following error:

Package unicode-math Error: No main maths font has been set up yet.
(unicode-math)                If you simply want ‘the default’, use:
(unicode-math)                  \setmathfont{latinmodern-math.otf}


I suppose this comes from the fact that arevmath uses "classic" LaTeX font selection methods whereas unicode-math relies on newer techniques, so the font is not properly "registered".

If I uncomment the line \setmathfont{firamath}, it works, except that IMHO the fonts do not match very well.

How can I use Arev (and associates) for mathematical symbols, but still use the main font for numbers and latin letters?

• imho Bitstream Vera Sans (on which arev is based) has no math font. There aren't very much unicode sans serif math fonts available, the other one beside firamath I know of is ctan.org/pkg/gfsneohellenicmath. Without unicode math the arevmath package could work, try it out perhaps together with the nomath option of fontspec. May 18 at 7:26
• AFAICS arevmath does work flawlessly, but then arev is used for all maths including numbers and latin letters. As these are (of course) available in the main font, I was hoping to use them instead of the ones from arev, because they do not match well. (I also tried GFS NeoHellenic, but the problem is the same, and I find the font too "serif-fy" for a sans font. So basically, the fonts used by arevmath cannot be used with fontspec ? May 18 at 7:41

If you want to use arevmath you can try to use the text font with it as operator font:

\documentclass{article}

\usepackage{fontspec}
\setmainfont{arial}[NFSSFamily=arial]

\usepackage{arevmath}
\SetSymbolFont{operators}    {normal}{TU}{arial}{m}{n}
\SetSymbolFont{operators}    {bold}{TU}{arial}{b}{n}

\begin{document}
test 123 $123 test$ \mathversion{bold} $123 test$
\end{document}


• Wow, that is an amazingly simple solution, but one that I would never have found by myself. One minor nitpick: the fraction bar is now much thinner than the plus or minus sign. Can this be tweaked? May 18 at 8:46
• Using \renewcommand{\frac}[2]{\genfrac{}{}{.8pt}{}{#1}{#2}} seems to do the trick for the fraction bars. May 18 at 12:52