2

I'm trying to write a class file with certain options (e.g centered title, vs title on the left). When I compile a *.tex file that calls this class, I get the an undefined control sequence error for \@centeredtrue:

! Undefined control sequence.
\ds@centered ->\@centeredtrue 

Below is my MWE class file; I drew on how to declare options from the article.cls file. I don't understand why I'm getting this error, when the article.cls class file has similar option declarations for its oneside and twoside options, but the article.cls file doesn't throw this error.

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mwe}[2014/02/18 v0.0.1 Example Class For Errors]

\DeclareOption{centered}{\@centeredtrue}
\DeclareOption{flank}{\@centeredfalse}
\ExecuteOptions{centered}
\ProcessOptions

\endinput

My intent is to run conditional code dictated by my class's option.

2
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mwe}[2014/02/18 v0.0.1 Example Class For Errors]

\newif\if@centered  \@centeredfalse %%%%%%%%%%%%%%%%%%%%%  
\DeclareOption{centered}{\@centeredtrue}
\DeclareOption{flank}{\@centeredfalse}
\ExecuteOptions{centered}
\ProcessOptions

\endinput
  • Thank you! I didn't think about adding the \newif because the article class doesn't have it for its \@twosidefalse and \@twosidetrue options. – EarthIsHome Feb 19 '14 at 14:40
  • they are defined in latex.ltx – user2478 Feb 19 '14 at 15:37

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.