4

Many (all?) document classes have a draft option. Some packages, such as microtype and hyperref, can detect whether or not the class is in draft mode, and take action accordingly.

How do packages know whether or not the document is in draft mode? I see that the memoir class has a draftdoc boolean that is set in draft mode, but this does not appear to be standard among other document classes.

For example:

\documentclass[draft]{article} % or any other class
\begin{document}
\ifdraftmode % pseudo-code. This I what I seek.
  yes
\else
  no
fi
\end{document}

So, what I want to know is, what would I really test, rather than the fictitious ifdraftmode?

  • 2
    There is the ifdraft package that provides the macro \ifdraft{draft mode}{final mode}. – Peter Grill Dec 04 '17 at 05:00
  • @PeterGrill I hadn't located that duplicate question, or the ifdraft package. Seems pertinent. In my own case, draft mode does more than set an overflow rule, but that's beside the point. –  Dec 04 '17 at 15:44
  • @HeikoOberdiek Your ifdraft package does what I need, and actually does more than I need, by addressing certain situations. –  Dec 04 '17 at 15:49

0 Answers0