I am writing a document which is mostly typeset with the STIX TWO fonts and compiled via XeLaTeX
. Math mode is configured via unicode-math
.
In certain contexts, I need an Arial/Helvetica/Tex Gyre Heros type sans-serif font. (It's ok if these sections come out a bit rugged, i.e. the missing scshape is no problem at all. I want to manually annotate diagrams which are itself set in Arial.)
For the normal text font, I set up a newfontface
.
Now I want to do the same for the math font, which I tried to achieve by defining a dedicated mathversion
. Unfortunately this blocks the use of unicode-math range parameters, as range
and version
do not play well together.
As there is no such math font (using Fira Math compiles, but it looks quite different from Arial), I tried to use NFSS commands for that version definition.
Eventually, this fails with:
LaTeX Font Warning: Font shape `TU/Arial/m/n' undefined
(Font) using `TU/lmr/m/n' instead on input line 29.
! Math formula deleted: Insufficient symbol fonts.
\resetMathstrut@ ->\setbox \z@ \hbox {$($
}\ht \Mathstrutbox@ \ht \z@ \dp \Ma...
l.29 \begin{equation}
I put together a minimal example that demonstrates my problem:
\documentclass[english]{scrartcl}
\usepackage[math-style=ISO, bold-style=ISO]{unicode-math}
\defaultfontfeatures{Scale = MatchUppercase}
\setmainfont[Scale=0.97]{STIX Two Text}
\setmathfont[Scale=0.97]{STIX Two Math}
\setsansfont[Scale=1.07]{Libertinus Sans}
\newfontface\rootsans{Arial}
%\setmathfont[version=rootsans]{Fira Math} % <-- This works but Fira!=Arial
\DeclareMathVersion{rootsans} %<-- Tried an alternative approach, so far without success
\SetSymbolFont{letters}{rootsans}{TU}{Arial}{m}{n}
\SetSymbolFont{operators}{rootsans}{TU}{Arial}{m}{n}
\SetSymbolFont{symbols}{rootsans}{TU}{Arial}{m}{n}
\SetSymbolFont{largesymbols}{rootsans}{TU}{Arial}{m}{n}
\SetMathAlphabet{\mathrm}{rootsans}{TU}{Arial}{m}{n}
\begin{document}
\textsc{Euler}'s identity in normal mode:
\begin{equation}
e^{i\phi} + 1 = 0
\end{equation}
\rootsans
\mathversion{rootsans}
\textsc{Euler}'s identity with special font setting:
\begin{equation}
e^{i\phi} + 1 = 0
\end{equation}
\end{document}
If I omit the mathversion
everything works, but equation (2) does not match its the preceding line.
Is there anything I can do or do I have to live with Fira Math as Arial companion?