My goal is to process a LaTeX tex file with the draft
option enabled for the document class, but from a terminal without having to edit the tex file or even open it to look at what class is being used, given that I know it's a class which has the draft option. The option pdflatex -draftmode
isn't what I'm looking for since it doesn't produce a pdf.
For example, suppose main.tex
contains the following:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{myfig}
\end{document}
Using \documentclass[draft]{article}
should of course produce a box with the text "myfig.xxx" in it. The solution given to the question Add option to class with command would almost be enough. I would use
pdflatex \PassOptionsToClass{draft}{article} \input{main}
But this isn't satisfactory since I have to know that the class is article
rather than book
or anything else.
As perhaps a second issue that might affect an answer; this solution doesn't even seem to entirely work given article
, since it produces the image normally and not the box with its title inside. This surprises me since passing the option 12pt
in this manner seems to work properly. But I guess the option doesn't get passed through to graphicx
or globally to other packages this way.