# How can I produce s separate PDFs for each one of my floats, when their code isn't self-contained

I've written this document (say it's an `article`) with a bunch of float - figures and tables. Some of them are just `\includegraphics`, so the figure essentially exists outside as well inside the document, and can be easily made into a PDF if it isn't one already. But some of them depend heavily on code elsewhere in the document - earlier and later.

I'd like to be able see each of the figures and tables as a separate PDF. This is obviously possible theoretically (after all, typesetting into the main document is not so different from typesetting into a separate one) - but can I achieve this practically without writing lots of deep voodoo code?

Note: I don't mind whether this is done ex-post-facto on the final PDF, or as part of the production of that PDF (i.e. the regular execution of pdflatex or xelatex), or as a separate process on the sources.

• I don't understand your question exactly, but you could just include your figures/tables in a new document, so that you have now new `pdf`'s which only contain the objects that you want (in this case figure/tables) … – current_user Aug 4 '18 at 23:12
• @current_user: No, I couldn't just place them in a new document - if their content or layout depends on previous or later LaTeX code. – einpoklum Aug 4 '18 at 23:15
• I mean, that you just leave your main code how it is and just typeset a completely new document with the figures/tables … – current_user Aug 4 '18 at 23:16
• You can use endfloat to extract all the source code for the figures or tables into separate files (.fff and .ttt). You could then run those through standalone, although IIRC the figure and table environments are not yet defined. – John Kormylo Aug 5 '18 at 0:49
• @JohnKormylo: That should not work. I mean, the entire source of the document is necessary to determine the contents of the float (think: numbered bibliographic references; document-defined commands; packages and their options affecting spacing, fonts, etc.) – einpoklum Aug 5 '18 at 6:36