\includegraphics*[draft=\nograph]{pic} % This gives an error
\renewcommand\nograph{\ifGraphicsDraft true\else false\fi}
\includegraphics*[draft=\nograph]{pic} % This is OK

An ifthenelse is problematic whereas the \ifGraphicsDraft works

Am I doing something stupid or is this a real bug

  • It appears that \nograph is \protected. \edef\test{\nograph} fails while \def\test{\nograph} can be printed. – John Kormylo Jul 18 '17 at 22:07
  • It's not a bug; it's how \ifthenelse works. – egreg Jul 18 '17 at 22:13

You need an expandable test, which \ifthenelse isn't.









enter image description here

  • Thank you all for pointing this out to me. I hesitate to use etoolbox for just one toggle, especially where \newcommand\nograph{\ifGraphicsDraft true\else false\fi} does what is expected. @David Carlisle Being part of a bigger machinery, I can't easily use your suggestion \newcommand\nograph{true} That's the price one has to pay for a minimal example:-) But I'll reconsider that at due time. – Jack Jul 19 '17 at 16:34

The value of the draft key has to expand to true or false, and \ifthenelse does not work via expansion. It fails for the same reason that


fails, even though \def\tmp{true}\tmp would typeset true.

You could, as you indicate use

\renewcommand\nograph{\ifGraphicsDraft true\else false\fi}

or simpler not have a switch at all and instead of having




Just have




Then \nograph directly expands to true or false.

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.