# How to use URW-Arial font for both text and Mathematics in Xetex?

This is related to my another question How to use URW-Arial font in pdflatex for both text and Mathematics in stack exchange. I want to use Arial fonts for mathematics as well has text. Ulrike Fischer has pointed out quoting the answer https://tex.stackexchange.com/a/309120/2388 that using URW-Arial is not a good idea. I had earlier tried to do it using xelatex. Here is a Minimal Working Example.

\documentclass[12pt]{article}
\usepackage[notext]{stix}
\usepackage[fleqn]{amsmath}
\usepackage{mathspec}
\setmainfont{Arial}
\setallmainfonts(Latin){Arial}
\newcommand{\R}{\ensuremath{\mathbb{R}}}
\begin{document}\raggedright
The curve is increasing between $$0$$ and $$\frac{1}{4}$$ and the
minimum value is attained at $$x=0$$.  The sum of the areas of these
blue rectangles is less than the area under the curve.

We define the \textbf{upper sum} $$U(P,f\,)$$ by
$$U(P,f)=\sum_{i=1}^n M_i\Delta_i\label{def-uppersum}$$ and the \textbf{lower sum} $$L(P,f)$$ by\index{Lower Sum}
$$L(P,f)=\sum_{i=1}^n m_i\Delta_i\label{def-lowersum}$$

Evaluate
$\int_0^2 \frac{1}{1+t^2}\,dt.$
\end{document}


However, this has other problems. Here is a screen shot of the output.

In the fraction 1/4, the four is too close the next line. In L(P,f) and U(P,f), the f is touching the closing bracket. In the integral, the superscript 2 is too close to t. Can these problems be fixed?

You can try something like this. But be aware that text fonts are not math fonts: they are missing a number of font dimens and glyphs needed for good math. So using them for math is always only a work-around. Be also aware that the range option of unicode-math is a bit buggy.

\documentclass[12pt]{article}

\usepackage[fleqn]{amsmath}
\usepackage{unicode-math,xfrac}
\setmainfont{Arial}
\setmathfont{STIX2Math.otf}
\setmathfont{Arial Italic}[range={it,bfit}]
\setmathfont{Arial}[range=up/{num}]
\setmathfont[range=\int]{STIX2Math.otf}
\newcommand{\R}{\ensuremath{\mathbb{R}}}
\begin{document}\raggedright
The curve is increasing between $$0$$ and $$\sfrac{1}{4}$$ and the
minimum value is attained at $$x=0$$.  The sum of the areas of these
blue rectangles is less than the area under the curve.

We define the \textbf{upper sum} $$U(P,f\,)$$ by
$$U(P,f)=\sum_{i=1}^n M_i\Delta_i\label{def-uppersum}$$ and the \textbf{lower sum} $$L(P,f)$$ by\index{Lower Sum}
$$L(P,f)=\sum_{i=1}^n m_i\Delta_i\label{def-lowersum}$$

Evaluate
$\int_0^2 \frac{1}{1+t^2}\,dt.$
\end{document}


• maybe the \, in U(p,f) from OP should be removed, or also used in L(P,f) for consistency ? – user4686 Nov 9 '17 at 12:26
• @Ulrike Fischer Thanks a lot. I have to use a ugly hack for getting the superscripts correct. I use the following command for correctly positioning the superscripts. \newcommand{\mysup}[3][3mu]{#2^{\mkern #1 #3}} I was hoping such hacks could be avoided. From what you say, this doesn't look possible. – S. Venkataraman Nov 15 '17 at 8:45
• @Ulrike Fischer I experimented with winfonts package. The problem of interline spacing and improper positioning of superscripts, etc., still persist because, as you remarked, some font dimensions are missing. However, in the case of pdflatex, we are using virtual fonts. Is it possible to somehow provide these dimensions in this case? How difficult is this? If this can be done please give me some pointers as to what should I read to be able to do this. (Relevant chapters in TeX Book, Latex companion or any other documentation.) – S. Venkataraman Nov 23 '17 at 7:19