在mathspec
命令\mathbit
未定义的情况下,我遵循了这里是 Ulrike以便对其进行定义,但它却依然顽固地停留在《计算机现代》中:
\documentclass{article}
\DeclareMathAlphabet {\mathbfit}{OML}{cmm}{b}{it}
\usepackage{mathspec}
\setmainfont{NotoSans-Regular}[
Extension = .ttf,
Ligatures = TeX,
BoldFont = NotoSans-Bold,
ItalicFont = NotoSans-Italic,
BoldItalicFont = NotoSans-BoldItalic,
Numbers = Lining
]
\setmathfont(Digits,Latin,Greek)[
Extension = .ttf,
Ligatures = TeX,
BoldFont = NotoSans-Bold,
ItalicFont = NotoSans-Italic,
BoldItalicFont = NotoSans-BoldItalic,
Numbers = Lining
]{NotoSans-Regular}
\setmathrm[
Extension = .ttf,
Ligatures = TeX,
BoldFont = NotoSans-Bold,
ItalicFont = NotoSans-Italic,
BoldItalicFont = NotoSans-BoldItalic,
Numbers = Lining
]{NotoSans-Regular}
\setmathfont[range=\mathbfit/{num,latin,Latin,greek,Greek},
Extension = .ttf,
Ligatures = TeX,
Numbers = Lining]{NotoSans-BoldItalic}
\begin{document}
Blabla $x, \mathbf{x}, \mathbfit{x}, \mathrm{sin}(x)$
\end{document}
给出
换句话说,除了部分之外,所有内容都是 Noto Sans(并不是说我喜欢 Noto,但我用它来举例说明广泛使用的字体存在的问题)\mathbfit
。我该如何解决这个问题?
(我从某处读到我需要使用unicode-math
。好的,但是,首先,我无意用 Unicode 输入数学符号;其次,我遇到了兼容性问题,例如“必须先加载 amsmath 包”,尽管我没有请求任何amsmath
包……)
答案1
您可以根据主字体设置数学字母表。
\documentclass{article}
\usepackage{mathspec}
\setmainfont{NotoSans}[
Extension = .ttf,
NFSSFamily = NotoSans,
Ligatures = TeX,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic,
Numbers = Lining
]
\setmathfont(Digits,Latin,Greek)[
Extension = .ttf,
Ligatures = TeX,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic,
Numbers = Lining
]{NotoSans}
\setmathrm[
Extension = .ttf,
Ligatures = TeX,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic,
Numbers = Lining
]{NotoSans}
\DeclareMathAlphabet{\mathbfit}{TU}{NotoSans}{b}{it}
\begin{document}
Blabla $x, \mathbf{x}, \mathbfit{x}, \mathrm{sin}(x)$
\end{document}