7

I have a class file which declares some options. One of them is called draft. This places a watermark on all pages that says DRAFT.

\DeclareOption{draft}{  
    \RequirePackage{draftwatermark}
    \SetWatermarkText{\textbf{DRAFT}}
}

I include the following line because I thought that it stops any declared options getting passed along when I call \LoadClass

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}

Followed by

\ProcessOptions\relax
\LoadClass[a4paper, 12pt]{article}

However, whenever I pass the class my draft argument, it is getting passed to article, and getting rid of all my figures.

What am I doing wrong ?

Mensch
  • 65,388
Ferguzz
  • 587
  • 1
    Any option in the \documentclass line is passed to all packages loaded afterwards, including graphicx. You can avoid it by saying \usepackage[final]{graphicx} – egreg Oct 04 '12 at 12:45
  • 1
    You might find this question useful on removing options: http://tex.stackexchange.com/q/33245/86 – Andrew Stacey Oct 04 '12 at 12:47

1 Answers1

6

Passing draft to article does not affect graphic inclusion. But global options are seen by all packages so a [draft] on \documentclass stops figure inclusion unless you use final on \usepackage[final]{graphicx} or on the individual calls \includegraphics[draft=false]{...} or use \setkeys{Gin}{draft=false} to reset the graphics draft flag.

Ulrike Fischer
  • 327,261
David Carlisle
  • 757,742
  • Your statement that "global options are seen by all packages" and egreg's "any option in the \documentclass line is passed to all packages" leave me confused, since the definition of \ProcessOptions says \@ifstar\@xprocess@ptions\@process@ptions and \@process@ptions doesn't copy class options. – Ahmed Musa Oct 04 '12 at 16:32
  • They are not passed down by the same mechanism but processoptions, if it is not handling a .cls file process the saved class options: \def\@process@ptions{% \@for\CurrentOption:=\@declaredoptions\do{% \ifx\CurrentOption\@empty\else \@expandtwoargs\in@{,\CurrentOption,}{% ,\ifx\@currext\@clsextension\else\@classoptionslist,\fi \@curroptions,}% \ifin@ \@use@ption \expandafter\let\csname ds@\CurrentOption\endcsname\@empty \fi \fi}% \@process@pti@ns} – David Carlisle Oct 04 '12 at 16:36
  • \ifx\@currext\@clsextension\else\@classoptionslist being the bit to stare at – David Carlisle Oct 04 '12 at 16:38
  • OK, seen it. Airheaded here. – Ahmed Musa Oct 04 '12 at 16:46