# Mixed fonts in math mode

I have been happily using latex with default fonts for Math mode and now our school has specified that all our test HAVE TO BE IN ARIAL. This is fine for the text part but when it comes to math mode, I need everything to be in arial EXCEPT the lower case letters, such as x, y z, etc. As below:

The following code obviously does not do what I want as the math output is all in cambria.

\documentclass[a4paper,addpoints,12pt]{exam}
\RequirePackage{amssymb,amsfonts,amsmath,latexsym, mathrsfs,unicode-math}
\setmathfont{Cambria Math}
\renewcommand{\rmdefault}{phv}
\renewcommand{\sfdefault}{phv}

\begin{document}
$4x+y=ABC-2$
\end{document}

• There are several packages, which enable to use a sans font in math. I do not know, which of these is the best/most suitable, but take a look at: sfmath, sansmath, mathastext. I do use mathastext at the moment, but I do not know, which of these is the best solution (and haven't found one fully satisfying so far). – Skillmon Jun 15 '17 at 7:39
• I guess there is no arial math, but you can use something like $4x+y=\text{ABC}-2$. – Michael Fraiman Jun 15 '17 at 7:46
• @MichaelFraiman this way, x and y are not Arial. She would have to use \text{\textit{x}} for every variable in her document. I don't think this is a real option. – Skillmon Jun 15 '17 at 7:52
• @Skillmon but x and y should not be in arial. – Michael Fraiman Jun 15 '17 at 7:54
• @AngelavanWyngaard are you sure that you need to typeset math in Arial also? I guess you can search this site for questions on using sans serif in math mode. Using different font families in one expression seems odd and is not recommended. – Michael Fraiman Jun 15 '17 at 9:05

These sound like requirements set by a Word user. Now (as noted by @Michael Fraiman) I don't think there is a version of Arial with a complete set of maths glyphs. However, I think Word uses Cambria for mathematics. So, you should get away with this (compile with lualatex or xelatex).

\documentclass{article}
\usepackage{fontspec}
\usepackage{unicode-math}
\usepackage{amsmath}
\setmainfont{Arial}
\setmathfont{Cambria Math}
\begin{document}
The quick brown fox jumps over the lazy dog.
$4x+y=ABC-2$
$4x+y=\text{ABC}-2$
\end{document}


This is taken from my question Setting up a Sans Serif Document Including Math (in 2017, using pdftex).

## sansmathfonts and helvet Package

\documentclass[preview]{standalone}

\usepackage{sansmathfonts}
\usepackage[scaled=0.95]{helvet}
\renewcommand{\rmdefault}{\sfdefault}

\usepackage{mathtools}
\begin{document}
Text
$\displaystyle abc+\sum_{k=1}^{n}\int_{0}^{k}\sqrt{2}f(x)\,\text{d}x$
Text
\end{document}


If you want upright letters then use \text{ABC} (provided by amsmath package which is loaded by mathtools package). You can see the result in the d of dx in my example.