12

Is there an easy method to compile a LaTeX document ignoring contents of \begin{figure} ... \end{figure} blocks altogether?

I am looking for an equivalent for draft and demo options (as in \documentclass[demo]{article} or \usepackage[draft]{graphics}) that will ignore figure environment completely. Specifically, don't want to see any placeholders nor figure captions, just continuous text.

Is there a way to do the same thing for table environments?

Klara
  • 223
  • 2
  • 5
  • 2
    You don't want to keep any space there? – Sigur Jan 26 '15 at 11:58
  • Maybe try: \renewenvironment{figure}{}{} – Benjamin McKay Jan 26 '15 at 12:16
  • @Sigur No, not really. It is for purpose of text editing - I have quite some figures in my paper and it would be a great option to save both on ink and paper. – Klara Jan 26 '15 at 12:26
  • @BenjaminMcKay It would have worked if figures had no captions, but it just throws a bunch of errors: Package caption Error: \caption outside float. \caption – Klara Jan 26 '15 at 12:28
  • I believe that Memoir has an MSS (or similarly named) option which duplicates a typewritten manuscript --- it may also turn off all graphics (or maybe it moves them all to the end). – WillAdams Jan 26 '15 at 12:44
  • @WillAdams Could you give some link/more specific reference? I found the Memoir class, but after short search I can't find the feature you mention in the documentation. – Klara Jan 26 '15 at 12:55
  • Try adding \let\caption\relax – cmhughes Jan 26 '15 at 12:56

1 Answers1

14

You can use endfloat, telling it that it shouldn't process the delayed floats:

\documentclass{article}
\usepackage{graphicx}

%%% Remove the next two lines if you want the figures at their place    
\usepackage[figuresonly,nolists,nomarkers]{endfloat}
\renewcommand{\processdelayedfloats}{}

\usepackage{lipsum}% mock text

\begin{document}

\lipsum[1]

\begin{figure}
\includegraphics[width=.3\textwidth]{example-image-a}
\caption{Whatever}
\end{figure}

\lipsum[2]

\begin{figure}
\includegraphics[width=.3\textwidth]{example-image-a}
\caption{Whatever}
\end{figure}

\lipsum[3]

\begin{table}[htp]
A table
\caption{Something}
\end{table}

\lipsum[4]

\end{document}

If you want to also omit tables, remove the figuresonly option.

egreg
  • 1,121,712