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.

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}
  • If I understand the short code ifdraft.sty correctly, what was missing in my attempt was the command \ProcessOptions*\relax. – Joachim W Apr 23 '15 at 9:12
2

the draft option just does

\setlength\overfullrule{5pt}}

so you can use the test

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

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.