我试图消除问题中的警告bigfoot.sty:61:软件包 hyperref 警告:选项“hyperfootnotes”已被使用
我试过:
\usepackage{silence}
\WarningFilter*{hyperref}{Option `hyperfootnotes' has already been used}
\usepackage{hyperref}
\usepackage{bigfoot}
并且它可以工作,但是我只想消除指向第 61 行的那个警告,而不是所有其他以以下内容开头的警告:
Option `hyperfootnotes' has already been used
然后我尝试写:
\WarningFilter*{hyperref}{Option `hyperfootnotes' has already been used,.*setting the option has no effect on input line 61.}
和:
\WarningFilter*{hyperref}{Option `hyperfootnotes' has already been used,%
(hyperref) setting the option has no effect on input line 61.}
但它们都不起作用。如何才能使多行警告静音?
...(D:\User\Documents\latex\texmfs\install\tex\latex\oberdiek\rerunfilecheck.sty
Package: rerunfilecheck 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 2
82.
)
\Hy@SectionHShift=\skip185
) (D:\User\Documents\latex\texmfs\install\tex\latex\bigfoot\bigfoot.sty
Package: bigfoot 2015/08/30 2.1 makes footnotes work
Package hyperref Warning: Option `hyperfootnotes' has already been used,
(hyperref) setting the option has no effect on input line 61.
(D:\User\Documents\latex\texmfs\install\tex\latex\ncctools\manyfoot.sty
Package: manyfoot 2005/09/11 v1.10 Many Footnote Levels Package (NCC)
(D:\User\Documents\latex\texmfs\install\tex\latex\ncctools\nccfoots.sty
Package: nccfoots 2005/02/03 v1.2 NCC Footnotes Package (NCC)
)
...
最小示例:
\documentclass{memoir}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{silence}
\WarningFilter*{hyperref}{Option `hyperfootnotes' has already been used,
(hyperref) setting the option has no effect on input line 61.}
\usepackage{hyperref}
\usepackage{bigfoot}
\begin{document}
Bit cut\footnote{bigfoot}.
\end{document}
答案1
要使多行警告静音,您需要包含与警告相关的适当代码。让我们看看实际消息来自哪里hyperref
通过宏\Hy@WarnOptionDisabled
:
\def\Hy@WarnOptionDisabled#1{%
\Hy@Warning{%
Option `#1' has already been used,\MessageBreak
setting the option has no effect%
}%
}
该警告中包含\MessageBreak
,因此可以执行以下操作:
\documentclass{article}
\usepackage{silence}
\WarningFilter*
{hyperref}
{Option `hyperfootnotes' has already been used, \MessageBreak
setting the option has no effect}
\usepackage{hyperref}
\usepackage{bigfoot}
\begin{document}
Text.
\end{document}
但请注意,这on line 61.
并不构成警告消息的一部分。相反,on line < lineno >.
构成内核宏的一部分,该宏与导致(后续)调用的任何警告一起出现\GenericWarning
:
\def\on@line{ on input line \the\inputlineno}
%...
\DeclareRobustCommand{\GenericWarning}[2]{%
\begingroup
\def\MessageBreak{^^J#1}%
\set@display@protect
\immediate\write\@unused{^^J#2\on@line.^^J}%
\endgroup
}