21

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'}
3
  • 4
    It is warning you about an error in your document so the best way is to fix the error. use \documentclass{PhDThesisPSnPDF} not \documentclass{Classes/PhDThesisPSnPDF} Feb 15, 2017 at 22:40
  • 1
    thanks, that solved the problem, I also copied the class file beside the main tex file
    – Sadegh
    Feb 15, 2017 at 22:44
  • 1

3 Answers 3

25

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).

6
  • 5
    While compartmentalisation might be important, consider option 2.
    – Werner
    Feb 15, 2017 at 22:45
  • 1
    I copied the cls file to the same path ot tex file and changed \documentclass{Classes/PhDThesisPSnPDF} to \documentclass{PhDThesisPSnPDF} that solved the problem. I suppose your answer solve it as well so I accept it.
    – Sadegh
    Feb 15, 2017 at 22:48
  • 1
    can you please edit the title of question so it can be more useful for others?
    – Sadegh
    Feb 15, 2017 at 22:49
  • 1
    @DavidCarlisle: Sorry, I reconfigured the layout. (2) was already in use.
    – Werner
    Feb 15, 2017 at 22:49
  • 1
7

The following is directly from the templates README file:

Troubleshooting warnings

W1: I get the LaTeX Warning: You have requested document class Classes/PhDThesisPSnPDF, but the document class provides PhDThesisPSnPDF, should I be concerned?

No! Do nothing, or if you don't want any warning messages change the line near the top of the class file to \ProvidesClass{Classes/PhDthesisPSnPDF} if you're not going to install the class file in a more standard location. You can install it in a standard location like /usr/share/texmf/tex/latex/ and run texhash to reconfigure.

Please see also issue 112

1

I encountered the same problem and for me I do not have the possibility of moving the .cls file because it has some dependencies on the files that live within that directory (imported as a Git submodule). And my custom class needs to be useable also within its own directory. My solution was to do this, at the beginning of the .cls file:

    \IfFileExists{./<your class name>.cls}{
        \ProvidesClass{<your class name>}[<your class description>]
    }{
        \ProvidesClass{./<subdirectory>/<your class name>}[<your class description>]
    }

And it removed the warning when compiling both inside the .cls subdirectory and in the top directory.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .