‘OT1/xcmss/b/n’ 未定义,请改用‘OT1/xcmss/bx/n’

‘OT1/xcmss/b/n’ 未定义,请改用‘OT1/xcmss/bx/n’

知道如何消除这个警告吗?

我在书籍类中使用默认的无衬线字体并使用 pdfLaTeX 进行编译。我还使用小型大写 sansmathfonts。

出现这些警告的所有行看起来都没问题,所以我无法确定问题所在。

梅威瑟:

\documentclass{book}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath}                                                     
\usepackage{amssymb}
\usepackage{sansmathfonts}                                              
\usepackage{slantsc}
\renewcommand{\familydefault}{\sfdefault}

\begin{document}

\textbf{Lorem Ipsum} is simply dummy text of the {\fontseries{bx}printing} 
and typesetting industry. Lorem Ipsum has been the industry's standard dummy 
text ever since the 1500s, when an unknown printer took a galley of type and 
scrambled it to make a type specimen book.

\end{document}

答案1

这是无害的。由于历史原因,Computer Modern 将其粗体字体称为bxBold Extended。

在 NFSS 中,有四个字体参数:编码(OT1,即原始的 7 位 TeX 编码)、字体系列(cmss、Computer Modern Sans Serif)、形状(ni或有时是其他东西,如小型大写字母或直立斜体)和系列。后者结合了粗细(b用于粗体)和宽度(x用于扩展)。这种命名方案可以追溯到 MS-DOS 将所有文件名限制为八个字符、一个点和三个字符的文件类型的时候,因此它们必须简洁。

您可以通过更改\bfseries命令(可能在您的听力格式中)来删除它,\fontseries{bx}或选择其他字体。

您可以替换\textbf{...}{\fontseries{bx}...}创建宏

\DeclareRobustCommand{\bxseries}{\fontseries{bx}\selectfont}
\DeclareTextFontCommand{\textbx}{\fontseries{bx}}

并分别使用\bxseries\textbx代替\bfseries\textbf

但最好的解决方案是更新到 LuaLaTeX 和fontspec,这样你就可以使用现代字体了。这可以立即清除上个世纪的大量技术债务。

预计到达时间:现在您已添加 MWE:问题来自sansmathfonts。如果我在 TeX Live 2020 中更改\bfseries\fontseries{bx}\selectfont,警告也会消失。

预计到达时间:您需要\selectfont执行\fontseries此操作才能生效。

答案2

该警告无害,您可以放心忽略它。使用当前版本的 LaTeX(2020-02-02),您可以告诉 LaTeX 您希望默认使用 bx:

\documentclass{book}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{sansmathfonts}
\usepackage{slantsc}
\renewcommand{\familydefault}{\sfdefault}
\DeclareFontSeriesDefault[sf]{bf}{bx}
\begin{document}

\textbf{Lorem Ipsum} is simply dummy text of the {\bfseries printing}
and typesetting industry. Lorem Ipsum has been the industry's standard dummy
text ever since the 1500s, when an unknown printer took a galley of type and
scrambled it to make a type specimen book.

\end{document}

相关内容