[Tex/LaTex] You have requested document class X but the document class provides Y warning

document-classestemplateswarnings

I got this warning:

You have requested document class `Classes/PhDThesisPSnPDF',
           but the document class provides `PhDThesisPSnPDF'.

How can I silence it? It looks like a multiline warning and I don't know how to copy it in \WarningFilter command. Here is my attempt that failed:

 \WarningFilter{latex}{ `Classes/PhDThesisPSnPDF',but the document class provides `PhDThesisPSnPDF'}

Best Answer

This stems from the fact that you have PhDThesisPSnPDF.cls inside a Classes subfolder. So, the way you normally include it is to use

\documentclass[..]{Classes/PhDThesisPSnPDF}

right? Well, there should be similarity between what is supplied within \documentclass's mandatory argument - the class - and what is written inside the mandatory argument of \ProvidesClass inside PhDThesisPSnPDF.cls. If they don't match, LaTeX throws the warning you see.

You can't use the silence package for this unless you load it before calling \documentclass. Moreover, you don't have to supply the full warning message in order to filter it; just a matching start would do.

How can you rectify this warning? One of a number of ways:

  1. Edit the PhDThesisPSnPDF.cls file inside the Classes subfolder and change

    \ProvidesClass{PhDThesisPSnPDF}
    

    to

    \ProvidesClass{Classes/PhDThesisPSnPDF}
    

    and then directly use

    \documentclass[..]{Classes/PhDThesisPSnPDF}
    

    inside your document.

  2. Move PhDThesisPSnPDF.cls from the Classes folder to where you have your .tex source.

  3. Move PhDThesisPSnPDF.cls to your local TeXMF folder and rerun texhash (making it available for all documents).