I I have a usrdefn.tex file in which I defined some commends/environments used a lot, also there are two version of theorem environments based on the language (english/chinese). Then I want to pass an option to the documentclass and choose the block automatically. The mme looks like:
FOR CHINESE:
\documentclass[zh]{ctexart}
\usepackage{amsthm}
\input usrdefn
\begin{document}
\begin{thm}
中文定理
\end{thm}
\end{document}
FOR ENGLISH
\documentclass[en]{amsart}
\begin{document}
\begin{thm}
English Theorem
\end{thm}
\end{document}
with the usrdefn.tex
\usepackage{etoolbox}
\newtoggle{langen}
\makeatletter
\DeclareOption{en}{\toggletrue{langen}}
\DeclareOption{zh}{\togglefalse{langen}}
\makeatother
\iftoggle{langen}{
\newtheorem{thm}{Theorem}
}{
\newtheorem{thm}{定理}
}
This is not work, since it tells me that
|4 error| \RequirePackage or \LoadClass in Options Section.
OK, I see, I need to \ProcessOptions after the \DeclareOption stuff, which solved my problem!!