2

I tried this based on Suppress warning from natbib/multibib with silence and How do you suppress specific warnings generated by pdflatex? but does not worked:

\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}

I still keep getting it:

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.

This warning just do not help me in anything as there is nothing to be fixed or I could do. It is just pollution, distracting of things which are importante and I need to take care of.

12
  • 1
    I don't see why this warning troubles you at all. It is a warning only. A text running on the screen during compilation and in the log file. It is hardcoded in the memoir.cls file and I don't see any possibility to get rid of it other than editing the class file, which is not recommended. You're distracting yourself and giving this warning too much attention
    – user31729
    Sep 18, 2017 at 15:38
  • I think this warning is just doing its job. Tell you that you need to use the caption interface instead of the memoir interface to change the appearance of captions. Why is this pollution?
    – Johannes_B
    Sep 18, 2017 at 15:41
  • 1
    Is not pollution, It is warning you that you are looking for problems using caption with memoir, so you should opt for remove the caption package or otherwise ignore at least all the command explained un section 10.6 and 10.7 from the memoir manual. For instance, you have \captionnamefont{\sffamily} in memoir working and "Figure 1." is perfectly in sans serif font ... until you have the occurrence of load the package caption. Memoir should not warn you? Would it be better let to you to break your head trying to figure out what's going on?
    – Fran
    Sep 18, 2017 at 15:47
  • I get no warning at all after commenting out the loading of package silence and the WarningFilter thing. Incidentally I needed to use example-image-a not example-image-A which troubles me as my Mac's file system is supposedly case insensitive. (this seems to be a kpsewhich feature)
    – user4686
    Sep 18, 2017 at 16:08
  • 2
    I disagree with the "just ignore it, it's only a warning" philosophy. If your screen output is cluttered up with warnings, they hide the messages that are important. Personally I always switch on a "treat all warnings as errors" flag for software development, if it exists!
    – alephzero
    Sep 19, 2017 at 2:29

2 Answers 2

4

For me, this is clearly an XY question. Use the proper tool. Don't use a scredriver to open a bottle of wine. Use a corkscrew.

\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}
5
  • 1
    And the corkscrew is...? The analogy would be meaningful if there was an actual explanation of why some other package works better...
    – user181417
    Nov 18, 2019 at 21:49
  • 1
    @SV I guess, not using the caption package is the key here.
    – Johannes_B
    Nov 19, 2019 at 5:14
  • Thank you for the clarification. I am getting the same error, if I removed the caption package would the captions in my figures and tables still work?
    – user181417
    Nov 19, 2019 at 18:13
  • 1
    @SV caption is only needed with standard classes. You don't need it with memoir.
    – Johannes_B
    Nov 19, 2019 at 19:15
  • Thank you very much.
    – user181417
    Nov 19, 2019 at 21:11
0

As I can understand, the warning is only saying:

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.

That I am using memoir package with caption and need to configure the captions with the caption's package interface, which is something I can learn reading the documentation.

The warning will be useful if it is telling me that I am using memoir's interface to configure caption, instead of the caption interface. Anyways I finally silenced the warning after changing:

\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.}

to

\WarningFilter*{memoir}{You are using the caption package with the memoir class}

Full example:

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.