我尝试过抑制来自 natbib/multibib 的警告并保持静默和如何抑制 pdflatex 生成的特定警告?但没有起作用:
\documentclass[10pt,a5paper,twoside]{memoir}
\usepackage{silence}
\WarningFilter*{memoir}{Class memoir Warning: You are using the caption package with the memoir class. To prepare we will now reset all captioning macros and configurations to kernel defaults, and then let the caption package take over. Please remember to use the caption package interfaces in order to configure your captions.}
\usepackage{caption}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{capt-of}
\usepackage{graphicx,newfloat}
\DeclareCaptionType{InfoBox}
\begin{document}
\fboxsep=8pt\relax
\fboxrule=2pt\relax
\begin{center}
\fbox{\centering
\includegraphics[width=2in]{example-image-A}}\par
\captionof{InfoBox}{Here is my caption\label{fg:A}}
\end{center}
\begin{InfoBox}[ht]
\centering
\fbox{\centering\medskip
\includegraphics[width=2in]{example-image-B}}\par
\caption{Here is my caption\label{fg:B}}
\end{InfoBox}
\end{document}
我还是不断得到这样的信息:
Class memoir Warning: You are using the caption package with the memoir class.
To prepare we will now reset all captioning macros and configurations to kernel
defaults, and then let the caption package take over. Please remember to use
the caption package interfaces in order to
configure your captions.
这个警告对我没什么帮助,因为没有什么可以修复或我可以做的。它只是污染,分散了我需要处理的重要事情的注意力。
答案1
对我来说,这显然是一个 XY 问题。使用适当的工具。不要使用螺丝刀来开酒瓶。使用开瓶器。
\documentclass[10pt,a5paper,twoside]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{capt-of}
\newfloat{InfoBox}{loib}{InfoBox}
\begin{document}
\fboxsep=8pt\relax
\fboxrule=2pt\relax
\begin{center}
\fbox{\centering
\includegraphics[width=2in]{example-image-a}}\par
\captionof{InfoBox}{Here is my caption\label{fg:A}}
\end{center}
\begin{InfoBox}[ht]
\centering
\fbox{\centering\medskip
\includegraphics[width=2in]{example-image-b}}\par
\caption{Here is my caption\label{fg:B}}
\end{InfoBox}
\end{document}
答案2
据我了解,警告只是说:
类 memoir 警告:您正在将 caption 包与 memoir 类一起使用。为了做好准备,我们现在将所有字幕宏和配置重置为内核默认值,然后让 caption 包接管。请记住使用 caption 包接口来配置您的字幕。
我正在使用memoir
带有的包,caption
并且需要使用包接口来配置标题caption
,这是我可以通过阅读文档来学习的东西。
如果警告告诉我我正在使用 memoir 的界面来配置字幕,而不是使用 caption 界面,那么这个警告将很有用。无论如何,在更改以下内容后,我最终消除了警告:
\WarningFilter*{memoir}{Class memoir Warning: You are using the caption package with the memoir class. To prepare we will now reset all captioning macros and configurations to kernel defaults, and then let the caption package take over. Please remember to use the caption package interfaces in order to configure your captions.}
到
\WarningFilter*{memoir}{You are using the caption package with the memoir class}
完整示例:
\documentclass[10pt,a5paper,twoside]{memoir}
\usepackage{silence}
\WarningFilter*{memoir}{You are using the caption package with the memoir class}
\usepackage{caption}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{capt-of,graphicx,newfloat}
\DeclareCaptionType{InfoBox}
\begin{document}
\fboxsep=8pt\relax
\fboxrule=2pt\relax
\begin{center}
\fbox{\centering
\includegraphics[width=2in]{example-image-A}}\par
\captionof{InfoBox}{Here is my caption\label{fg:A}}
\end{center}
\begin{InfoBox}[ht]
\centering
\fbox{\centering\medskip
\includegraphics[width=2in]{example-image-B}}\par
\caption{Here is my caption\label{fg:B}}
\end{InfoBox}
\end{document}