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!!

heblyx
  • 2,571
  • 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) – David Carlisle Nov 09 '19 at 13:42
  • 1
    Arial is a text font, not a math font. – Mico Nov 09 '19 at 13:45
  • 1
    And \setmathsfont is defined by the mathspec package, but not the unicode-math package. – Mico Nov 09 '19 at 13:52
  • Thank you all for your answers!! @DavidCarlisle - Those fonts are good? https://www.tug.org/FontCatalogue/mathfonts.html – heblyx Nov 09 '19 at 13:55
  • not all of them I think, I believe there is an answer here that listed the opentype math fonts available at the time, I'll see if I can find. – David Carlisle Nov 09 '19 at 14:10
  • 1
    there is this answer but that;s 2014 more are available now it could be updated.... https://tex.stackexchange.com/questions/219392/state-of-unicode-math-typesetting-fonts – David Carlisle Nov 09 '19 at 14:12
  • @DavidCarlisle https://tex.stackexchange.com/questions/425098/which-opentype-math-fonts-are-available – Davislor Nov 09 '19 at 17:00
  • @Davislor thanks – David Carlisle Nov 09 '19 at 18:12

1 Answers1

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.

Davislor
  • 44,045
  • And it must be something with math support ? I.e, from here: https://www.tug.org/FontCatalogue/mathfonts.html – heblyx Nov 30 '19 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 Dec 01 '19 at 05: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 Dec 01 '19 at 06:01