3

Relevant to those:

I'm trying to change the font at math-mode:
If it's with "s": \setmathsfont - it doesn't compile, if it's without the "s: it's doesn't change the font...

Here is MWE:

\documentclass{scrartcl}


\usepackage{unicode-math}
\setmathfont{Arial}

\begin{document}

\[
a+b^{2}+5
\]

\end{document}

The output is:
enter image description here

Can you help to understand how to change the font at math-mode?

Thank you!!

8
  • 4
    you can not use Arial as the main math font using unicode-math, \setmathfont requires an OpenType Math font (that is the font has an internal MATH table giving math typesetting layout parameters) Commented Nov 9, 2019 at 13:42
  • 1
    Arial is a text font, not a math font.
    – Mico
    Commented Nov 9, 2019 at 13:45
  • 1
    And \setmathsfont is defined by the mathspec package, but not the unicode-math package.
    – Mico
    Commented Nov 9, 2019 at 13:52
  • Thank you all for your answers!! @DavidCarlisle - Those fonts are good? tug.org/FontCatalogue/mathfonts.html
    – heblyx
    Commented Nov 9, 2019 at 13:55
  • 1
    there is this answer but that;s 2014 more are available now it could be updated.... tex.stackexchange.com/questions/219392/… Commented Nov 9, 2019 at 14:12

1 Answer 1

3

If you want to change it in one section, and be able to change back, declare a math version.

\usepackage{unicode-math}

\defaultfeatures{Scale = MatchLowercase}
\setsansfont{Fira GO}
\setmathfont[version=sans]{Fira Math}

Then in the document:

\sffamily\mathversion{sans}

If you want to be able to use Arial letters with your math font, but do not need to switch between different math fonts, use the range= option.

\setmathfont{Fira Math}
\setmathfont[range=up]{Arial}
\setmathfont[range=it]{Arial Italic}
\setmathfont[range=bfup]{Arial Bold}
\setmathfont[range=bfit]{Arial Bold Italic}

Alternatively, you can load mathastext.

Unfortunately, the range= and version= options of \setmathfont do not work together (as of 2019}, so you cannot switch to and from a math version with Arial letters.

3
  • And it must be something with math support ? I.e, from here: tug.org/FontCatalogue/mathfonts.html
    – heblyx
    Commented Nov 30, 2019 at 12:44
  • @heblyx That’s a list of legacy 8-bit fonts. You wouldn’t use them with unicode-math, but you could load them with mathspec.
    – Davislor
    Commented Dec 1, 2019 at 5:59
  • @heblyx A font that you use with \setmathfont[version=... must have OpenType math support. A math font that you load with \setmathfont[range=... need only contain whatever glyphs are in that range.
    – Davislor
    Commented Dec 1, 2019 at 6:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .