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?

7
  • 2
    You don't want to keep any space there?
    – Sigur
    Jan 26, 2015 at 11:58
  • Maybe try: \renewenvironment{figure}{}{} Jan 26, 2015 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, 2015 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, 2015 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, 2015 at 12:44

1 Answer 1

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.

12
  • Thanks for this answer, that is exactly the kind of solution I was looking for. I was not not familiar with endfloat package at all.
    – Klara
    Jan 26, 2015 at 13:56
  • This doesn't seem to remove longtabu environment Nov 24, 2017 at 17:50
  • @raffamaiden This excludes figure and table environments, yours is a different problem.
    – egreg
    Nov 24, 2017 at 17:53
  • @egreg how can I remove longtabu and longtable environments? \renewenvironment{longtabu}{}{} does not work. The table is still there but badly formatted Nov 24, 2017 at 17:58
  • @raffamaiden Look at the comment package.
    – egreg
    Nov 24, 2017 at 18:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .