fancybox 在 minted/pygments 中导致弃用字体警告

fancybox 在 minted/pygments 中导致弃用字体警告

我使用 minted 包进行语法高亮。它生成代码像这样

我最近添加了 fancybox 包并且我的所有 minted 语句立即大量发出此警告:

Class scrbook Warning: Usage of deprecated font command `\tt'!
(scrbook)              You should note, that in 1994 font command `\tt' has
(scrbook)              been defined for compatiblitiy to Script 2.0 only.
(scrbook)              Now, after two decades of LaTeX2e and NFSS2, you
(scrbook)              shouldn't use such commands any longer and within
(scrbook)              KOMA-Script usage of `\tt' is definitely deprecated.
(scrbook)              See `fntguide.pdf' for more information about
(scrbook)              recommended font commands.
(scrbook)              Note also, that KOMA-Script will remove the definition
(scrbook)              of `\tt' anytime until release of about version 3.20.
(scrbook)              But for now, KOMA-Script will replace deprecated `\tt'
(scrbook)              by `\normalfont \ttfamily ' on input line 54.

我有数百这些。为什么 fancybox 会干扰 minted,我怎样才能让它们很好地协同工作?

答案1

fancybox包使用了三次\tt,这是一个已被弃用超过 20 年的命令。:-(

您可以通过重新定义fancybox正确调用来修复此问题\normalfont\ttfamily

\usepackage{fancybox}
% fix the bad commands in fancybox.sty
{\catcode`\ =12\gdef\ttspace{{\normalfont\ttfamily }}}
\def\VerbatimFont{\normalfont\ttfamily}
\def\VerbFont{\normalfont\ttfamily}

答案2

\documentclass[enabledeprecatedfontcommands,...]{scrbook}

或者写信给软件包作者,告诉他们应该使用\ttfamily而不是\tt

相关内容