0

When I have the following class:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{CustomClass}
\LoadClass[11pt]{article}

\DeclareOption{option1}{ \texttt{Text 1} \clearpage \texttt{Text 2} \clearpage }

\DeclareOption{option2}{ \texttt{Text 3} \clearpage \texttt{Text 4} \clearpage }

\AtBeginDocument{ \ProcessOptions }

\endinput

And I use it in the following way:

\documentclass[option1]{CustomClass}

\begin{document}

\end{document}

No Pdf is generated. But when I use ExecuteOptions{option1|option2} is work but its static. So my option I specify when specifying the document class does not work.

Why is this happening?

Kaskorian
  • 127

1 Answers1

3

You need to run \ProcessOptions within the class or package file, so it knows which options to process.

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{CustomClass}
\LoadClass[11pt]{article}

\DeclareOption{option1}{ \AtBeginDocument{% \texttt{Text 1}% \clearpage \texttt{Text 2}% \clearpage }% }

\DeclareOption{option2}{ \AtBeginDocument{% \texttt{Text 3}% \clearpage \texttt{Text 4}% \clearpage }% }

\ProcessOptions

\endinput

David Carlisle
  • 757,742