I'm trying to pass a key-value-pair to a class using pgfopts. The file testclass.cls:

\ProvidesClass{testclass}[A Testclass]



\pgfkeys{testclass/.is family}


\pgfkeys{testclass, testkey/.get=\optiontest}

And the file test.tex:



Trying to compile test.tex gives the following error:

Document Class: testclass A Testclass
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
ex))) (/usr/share/texlive/texmf-dist/tex/latex/pgfopts/pgfopts.sty))
! Missing number, treated as zero.
<to be read again> 


When slightly change the above from class to package it works ... what am I missing? Many thanks in advance! Is it not possible to use pgfopts with classes?

  • 3
    You need to start the optional argument to \ProvidesClass with a date ... – Joseph Wright Dec 3 '16 at 21:12
  • @Joseph Wright Thank you very much, that solved the problem. – jules Dec 3 '16 at 23:17

The syntax for \ProvidesClass requires that the first part of the optional 'description' argument is a date in the form YYYY/MM/DD. There's no check that this is there something of the right form: the required text is passed through directly to be used as numbers. As such, if there are no numbers things go wrong, as you've seen. So the fix is to either omit the optional argument or to include something of the right form (can be 0000/00/00).

| improve this answer | |

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.