I am trying to use STIX Two Math
for math. font
as a non math font (symbol-wise, letters will be the only thing for math mode), but only for the letters involved in math, i. e. abcdefghijklmnopqrstuvwxyz and ABCDEFGHIJKLMNOPQRSTUVWXYZ.
\documentclass{article}
\usepackage{fontspec}
\usepackage[math-style = upright]{unicode-math}
% ======================================================
\renewcommand{\normalsize}{\fontsize{10}{11}\selectfont}
\newcommand{\currentFont}{
ItalicFont = font Italic,
BoldFont = font Bold,
BoldItalicFont = font Bold Italic,
}
\newcommand{\normalFontFeatures}{
Kerning = On,
Style = Historic,
Ligatures = {Historic, Rare},
}
% ======================================================
\setmainfont[
Language = English,
\currentFont
\normalFontFeatures
]{font}
\setmathfont[range = {"0028-"1D7CB}, StylisticSet = 008]{STIX Two Math}
\setmathfont[range = {"41-"7B,}]{font} % range = unicode range for alphabet
% ------------------------------------------------------
\setmathfont[range = {"41-"7B}]{font} % Ignore, check NOTE
\setmathfont[range = bfup -> up]{font Bold} % Ignore, check NOTE
\setmathfont[range = it -> up]{font Italic} % Ignore, check NOTE
\setmathfont[range = bfit -> up]{font Bold Italic} % Ignore, check NOTE
% ======================================================
\begin{document}
\textit{F=ma}
$$ \mathbfit{F=ma} \quad \mathbf{F=ma} \quad F=ma \quad \mathit{F=ma}$$
\end{document}
NOTE: unicode-math not deciding what font to use for Bold Italic is a problem with my particular font files. Because of this I am currently using a work-around for getting it to display the way the image shows. But this feels so unnatural and inconvenient to be the correct way though.
Will Robertson solved it But I still have a problem with bfit
. It refuses to show \mathbfit{F=ma}
with the proper font, this could be fixed though, just by adding
\setmathfont[range = bfit -> up]{Bold Italic}
in the preamble.
Thanks.
$abc$
or$\mathrm{abc}$
or ... ? Have you tried[range=it]
or[range=up]
(or both?) ? It would be much clearer if you used a minimal example to demonstrate your problem.[range = it]
and[range = up]
are fine but\nabla
stops working since it search on my alphabet font for that symbol, which it does not have.[range = up]
overlaps with\nabla
, so it searches for\nabla
in the font intended for just latin letters.