我有以下两个 MWE:
\documentclass[preview]{standalone}
\usepackage{stix2}
\usepackage{amsmath}
\begin{document}
$\mathbfscr{A}$
\end{document}
和
\documentclass[preview]{standalone}
\usepackage{stix2}
\usepackage{amsmath}
\begin{document}
$\boldsymbol{\mathscr{A}}$
\end{document}
虽然两者都如预期的那样产生了粗体字样A
,但这封信也发出了一系列警告,即
LaTeX Font Warning: Font shape `LS2/stix2ex/b/n' in size <10> not available
(Font) Font shape `LS2/stix2ex/m/n' tried instead on input line 7.
LaTeX Font Warning: Font shape `LS2/stix2ex/b/n' in size <7.5> not available
(Font) Font shape `LS2/stix2ex/m/n' tried instead on input line 7.
LaTeX Font Warning: Font shape `LS2/stix2ex/b/n' in size <6> not available
(Font) Font shape `LS2/stix2ex/m/n' tried instead on input line 7.
LaTeX Font Warning: Font shape `LS1/stix2bb/b/n' in size <10> not available
(Font) Font shape `LS1/stix2bb/m/n' tried instead on input line 7.
LaTeX Font Warning: Font shape `LS1/stix2bb/b/n' in size <7.5> not available
(Font) Font shape `LS1/stix2bb/m/n' tried instead on input line 7.
LaTeX Font Warning: Font shape `LS1/stix2bb/b/n' in size <6> not available
(Font) Font shape `LS1/stix2bb/m/n' tried instead on input line 7.
LaTeX Font Warning: Font shape `LS1/stix2bb/b/it' in size <10> not available
(Font) Font shape `LS1/stix2bb/m/it' tried instead on input line 7.
LaTeX Font Warning: Font shape `LS1/stix2bb/b/it' in size <7.5> not available
(Font) Font shape `LS1/stix2bb/m/it' tried instead on input line 7.
LaTeX Font Warning: Font shape `LS1/stix2bb/b/it' in size <6> not available
(Font) Font shape `LS1/stix2bb/m/it' tried instead on input line 7.
LaTeX Font Warning: Font shape `LS2/stix2cal/b/n' in size <10> not available
(Font) Font shape `LS2/stix2cal/m/n' tried instead on input line 7.
LaTeX Font Warning: Font shape `LS2/stix2cal/b/n' in size <7.5> not available
(Font) Font shape `LS2/stix2cal/m/n' tried instead on input line 7.
LaTeX Font Warning: Font shape `LS2/stix2cal/b/n' in size <6> not available
(Font) Font shape `LS2/stix2cal/m/n' tried instead on input line 7.
LaTeX Font Warning: Font shape `LS2/stix2tt/b/n' in size <10> not available
(Font) Font shape `LS2/stix2tt/m/n' tried instead on input line 7.
LaTeX Font Warning: Font shape `LS2/stix2tt/b/n' in size <7.5> not available
(Font) Font shape `LS2/stix2tt/m/n' tried instead on input line 7.
LaTeX Font Warning: Font shape `LS2/stix2tt/b/n' in size <6> not available
(Font) Font shape `LS2/stix2tt/m/n' tried instead on input line 7.
为什么其中一个会发出所有这些警告,而另一个却不会?stix2.sty
字母定义如下:
\DeclareSymbolFont{symbols} {LS1}{stix2scr}{m}{n}
\SetSymbolFont {symbols}{bold}{LS1}{stix2scr}{b}{n}
\DeclareSymbolFontAlphabet{\mathscr}{symbols}
\DeclareMathAlphabet{\mathbfscr} {LS1}{stix2scr}{b}{n}
据我所知,\mathbfscr
链接到{LS1}{stix2scr}{b}{n}
和\boldsymbol
使用链接到bold
的模式。所以在我看来,这两者应该完全相同,但显然它们不是。有什么区别?为什么它们不一样?\mathscr
{LS1}{stix2scr}{b}{n}
附加问题:我只使用了粗体形式\mathscr
,为什么会出现针对各种字母和不同字体大小的所有其他警告,我从未尝试使用它们?
答案1
这基本上在回答您以前的问题时已经解释过了,但我将尝试在这里用不同的方式来解释。
首先要注意的\boldsymbol{x}
是\text{\boldmath$x$}
本地切换全部所有的数学字体\textstyle
,\scriptstyle
以及\scriptscriptstyle
大小都设置为粗体,因此如前所述,stix2
定义了很多字体,几乎所有字体都不是粗体,所以你会收到警告。
归根结底的原因是 Stix Two OpenType 数学字体没有粗体,如果您尝试使用测试文件,则会unicode-math
得到:
\documentclass[preview]{standalone}
\ifx\directlua\undefinded
\usepackage{stix2}
\else
\usepackage{unicode-math}
\setmathfont{Stix Two Math}
\fi
\usepackage{amsmath}
\begin{document}
\boldmath
$\mathscr{A}$
\end{document}
LaTeX Font Warning: Font shape `TU/StixTwoMath(1)/b/n' undefined
(Font) using `TU/StixTwoMath(1)/m/n' instead on input line 13.
LaTeX Font Warning: Font shape `TU/StixTwoMath(2)/b/n' undefined
(Font) using `TU/StixTwoMath(2)/m/n' instead on input line 13.
LaTeX Font Warning: Font shape `TU/StixTwoMath(3)/b/n' undefined
(Font) using `TU/StixTwoMath(3)/m/n' instead on input line 13.
StixTwoMath
OpenType 字体有数千个字符。对于 pdftex,该stix2
软件包将其拆分为多个字体,每个字体有 256 个字符,因此您会收到有关更多字体的警告,但本质上是完全相同的问题。
LaTeX Font Warning: Font shape `LS2/stix2ex/b/n' in size <10> not available
(Font) Font shape `LS2/stix2ex/m/n' tried instead on input line 13
.
LaTeX Font Warning: Font shape `LS2/stix2ex/b/n' in size <7.5> not available
(Font) Font shape `LS2/stix2ex/m/n' tried instead on input line 13
.
LaTeX Font Warning: Font shape `LS2/stix2ex/b/n' in size <6> not available
(Font) Font shape `LS2/stix2ex/m/n' tried instead on input line 13
.
(/usr/local/texlive/2022/texmf-dist/tex/latex/stix2-type1/ls1stix2frak.fd)
(/usr/local/texlive/2022/texmf-dist/tex/latex/stix2-type1/ls1stix2bb.fd)
LaTeX Font Warning: Font shape `LS1/stix2bb/b/n' in size <10> not available
(Font) Font shape `LS1/stix2bb/m/n' tried instead on input line 13
.
LaTeX Font Warning: Font shape `LS1/stix2bb/b/n' in size <7.5> not available
(Font) Font shape `LS1/stix2bb/m/n' tried instead on input line 13
.
LaTeX Font Warning: Font shape `LS1/stix2bb/b/n' in size <6> not available
(Font) Font shape `LS1/stix2bb/m/n' tried instead on input line 13
.
LaTeX Font Warning: Font shape `LS1/stix2bb/b/it' in size <10> not available
(Font) Font shape `LS1/stix2bb/m/it' tried instead on input line 1
3.
LaTeX Font Warning: Font shape `LS1/stix2bb/b/it' in size <7.5> not available
(Font) Font shape `LS1/stix2bb/m/it' tried instead on input line 1
3.
LaTeX Font Warning: Font shape `LS1/stix2bb/b/it' in size <6> not available
(Font) Font shape `LS1/stix2bb/m/it' tried instead on input line 1
3.
(/usr/local/texlive/2022/texmf-dist/tex/latex/stix2-type1/ls2stix2cal.fd)
LaTeX Font Warning: Font shape `LS2/stix2cal/b/n' in size <10> not available
(Font) Font shape `LS2/stix2cal/m/n' tried instead on input line 1
3.
LaTeX Font Warning: Font shape `LS2/stix2cal/b/n' in size <7.5> not available
(Font) Font shape `LS2/stix2cal/m/n' tried instead on input line 1
3.
LaTeX Font Warning: Font shape `LS2/stix2cal/b/n' in size <6> not available
(Font) Font shape `LS2/stix2cal/m/n' tried instead on input line 1
3.
(/usr/local/texlive/2022/texmf-dist/tex/latex/stix2-type1/ls1stix2sf.fd)
(/usr/local/texlive/2022/texmf-dist/tex/latex/stix2-type1/ls2stix2tt.fd)
LaTeX Font Warning: Font shape `LS2/stix2tt/b/n' in size <10> not available
(Font) Font shape `LS2/stix2tt/m/n' tried instead on input line 13
.
LaTeX Font Warning: Font shape `LS2/stix2tt/b/n' in size <7.5> not available
(Font) Font shape `LS2/stix2tt/m/n' tried instead on input line 13
.
LaTeX Font Warning: Font shape `LS2/stix2tt/b/n' in size <6> not available
(Font) Font shape `LS2/stix2tt/m/n' tried instead on input line 13
请注意,对于 luatex 和 pdftex 来说,警告都位于\boldmath
(隐藏在\boldsymbol
原文中)设置所有粗体数学字体的位置,因此即使您不使用这些字符,也会收到警告。
通常通过在普通数学版本中添加粗体字体作为附加字体\bm
来避免切换整个数学版本的成本\boldsymbol
,但如前所述,stix2
使用了很多字体,所以没有空闲空间,因此\bm
会退回到\boldsymbol
没有粗体字体的 stix,所以你会收到警告。
lualatex 和 xelatex 可以“动态”修改字体并生成粗体字体,因此如果(如@Davislor 在评论中所建议的)您还设置了粗体字体:
\documentclass[preview]{standalone}
\ifx\directlua\undefinded
\usepackage{stix2}
\else
\usepackage{unicode-math}
\setmathfont{Stix Two Math}
\setmathfont{STIX Two Math}[version=bold, FakeBold=1.2]
\fi
\usepackage{amsmath}
\begin{document}
\boldmath
$\mathscr{A}$
\end{document}
然后该文档由 lualatex 处理,没有任何字体警告。
答案2
第一次使用 中的符号时,会出现此错误\mathversion{bold}
。它指出某些字母的数学版本的定义bold
无效。这是软件包中的一个错误。例如,这也会触发它:
\documentclass[preview]{standalone}
\usepackage{stix2}
\usepackage{amsmath}
\begin{document}
\boldmath\(x\)
\end{document}
\boldmath
删除后警告也随之消失。
使用unicode-math
可以解决上个世纪遗留的 8 位字体格式的难题。我建议您在可以时这样做,并在必要时在 PDFTeX 中解决这些问题。