TeX - LaTeX Asked by Hering on February 4, 2021
My goal is to use a sans serif math font in all figures and I found several approaches with my favourite being the use of mathversion
and the unicode-math
package to change between different math fonts.
However, I am not able to switch between fonts due to the warning
Package fontspec Warning: Font "Latin Modern Math" does not contain requested
(fontspec) Script "Math".
that repeats for all fonts I import with a [version=]
parameter. However, I can change the math font for the whole document.
So my question: What am I doing wrong? I basically copied my code from another answer (will add the link when I find it again).
My mwe for testing is
documentclass[authoryear,preprint,5p,11pt]{scrartcl}
usepackage{amsmath}
usepackage{pgfplots}
usepackage{fontspec}
usepackage[]{unicode-math}
defaultfontfeatures{ Scale=MatchLowercase, Ligatures=TeX }
setmathfont{XITS Math}
setmathfont{Latin Modern Math}[version=lm]
setmathfont{TeX Gyre Pagella Math}[version=pagella]
begin{document}
This is some text.
And a figure with maths elements
begin{figure}[ht]
% mathversion{sansmath}
begin{pgfpicture}
pgftext[x=0.691229in,y=0.540666in,,top]{sffamilyselectfont 125}%
pgftext[x=0.354158in,y=0.432447in,left,base]{sffamilyselectfont (displaystyle frac{-pi}{2})}%
pgftext[x=1.054158in,y=0.432447in,left,base]{sffamilyselectfont (displaystyle 10^{3123x} cdot 12389)}%
end{pgfpicture}
end{figure}
and a formula
[ frac{pi}{2.42132}= beta]
and some math in another font
mathversion{lm}
[ frac{pi}{2.42132}= beta]
and yet another one
mathversion{pagella}
[frac{123456} {some text}]
end{document}
The full logfile is here: https://pastebin.com/kS3quC7A
The only OpenType sans serif math font I know of is GFS Neohellenic Math.
documentclass{article}
usepackage{amsmath}
usepackage{fontspec}
usepackage[]{unicode-math}
setsansfont{GFSNeohellenic}[
Extension=.otf,
UprightFont=*,
ItalicFont=*It,
BoldFont=*Bold,
BoldItalicFont=*BoldIt,
]
setmathfont{Latin Modern Math}
setmathfont{GFSNeohellenicMath.otf}[version=sansmath]
begin{document}
This is some text.
And a figure with maths elements
begin{figure}[ht]
centering
sffamilymathversion{sansmath}
[
125+frac{-pi}{2}+10^{3123x} cdot 12389+sin3
]
caption{Whatever}
end{figure}
and a formula
[ frac{pi}{2.42132}= beta]
end{document}
Answered by egreg on February 4, 2021
Your log shows that xelatex is finding mathjax fonts:
LatinModernMathJax_Size1-Regular/OT
and similar for Pagella: GyrePagellaMathJax_Symbols-Regular/OT
and these fonts confuses it.
Try if it works if you use filenames like latinmodern-math.otf
instead of the font names.
Answered by Ulrike Fischer on February 4, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP