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.

user
  • 4,745
  • 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 –  Sep 18 '17 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 '17 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 '17 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) –  Sep 18 '17 at 16:08
  • memoir can style the captions for you, so caption is not needed. memoir can also create new float types, so package newfloat is also not needed. Many packages that work with the standard classes do not work with memoir or KOMA-script classes, as they have a much more complex and feature rich functionality. – Johannes_B Sep 18 '17 at 16:11
  • standard class -> simple, many third party add-ons available. KOMA and memoir -> complex, featurerich, third party add-ons not needed, everything is already built in. – Johannes_B Sep 18 '17 at 16:12
  • @ChristianHupfer, the warning says nothing useful at all. Saying I need to use the caption interface instead of the memoir caption interface is not something I need to be remembered every single day of my life. It is enough put it on the memoir's documentation. – user Sep 18 '17 at 16:54
  • No idea, i guess it can be found in the memoir manual. I don't want to read one manual to know what you need and search for it in the memoir manual. – Johannes_B Sep 18 '17 at 16:57
  • I canot even find \DeclareCaptionType in any manual. – Johannes_B Sep 18 '17 at 17:02
  • Surprisingly, the command is simply called newfloat and works almost the same as the command \DeclareFloatingEnvironment from package newfloat which you are using. – Johannes_B Sep 18 '17 at 17:17
  • @user: I leave it too you then. –  Sep 18 '17 at 18:16
  • 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 '17 at 02:29

2 Answers2

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}
Johannes_B
  • 24,235
  • 10
  • 93
  • 248
  • 1
    And the corkscrew is...? The analogy would be meaningful if there was an actual explanation of why some other package works better... –  Nov 18 '19 at 21:49
  • 1
    @SV I guess, not using the caption package is the key here. – Johannes_B Nov 19 '19 at 05: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? –  Nov 19 '19 at 18:13
  • 1
    @SV caption is only needed with standard classes. You don't need it with memoir. – Johannes_B Nov 19 '19 at 19:15
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}
user
  • 4,745