3

How can I test within a document, whether or not the initial

\documentclass[a4paper,11pt,twoside,fleqn,draft]{report}

includes the "draft" option? My naive attempt

\newif\ifmydraft
\mydraftfalse
\DeclareOption{draft}{\mydrafttrue}

does not work, and breaks a later \usepackage command.

1

2 Answers 2

5

Perhaps you can use the "ifdraft" package and use one of these:

\ifdraft{draftcase}{finalcase}  
\ifoptiondraft{option draft is given}{option draft is not given} 
\ifoptionfinal{option final is given}{option final is not given}
1
  • If I understand the short code ifdraft.sty correctly, what was missing in my attempt was the command \ProcessOptions*\relax.
    – Joachim W
    Apr 23, 2015 at 9:12
5

the draft option just does

\setlength\overfullrule{5pt}}

so you can use the test

\ifdim\overfullrule>0pt
    draft
\else
    not draft
\fi

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .