I saw a similar question few years ago here, however there is no effective answer.

The question is it possible to automatically export every figure and table in a specific document to separate files (with or without the figure/table caption). Following are a more specific list of requirements.

  1. Export figures created with tikz/pgfplots, to a separate pdf files (with and without the caption, and to be numbered as in the document)
  2. Export tables that uses tabular, tabularx, and longtable (with and without the caption)
  3. When extracted is there a way to remove/hide (and its caption) the figure/table from the document while preserving references to that figure/table.

I have created a sample document below which contains a figure and a table so contributers can use it in their answers.



\author{John Doe}


\section{a Section}
In Figure \ref{fig:one} \lipsum[1]
    \node(a)[draw, rectangle, ultra thick] at (0,0) {Test};
    \node(b)[draw, rectangle, ultra thick] at (2,2) {Test};
\caption{Sample caption for figure 1}

\section{another Section}
    colA&colB&colC \\
\caption{Table A}
  • Most of what you want could be done by endfloat and standalone, but you need to externalize to generate extra PDFs. Commented Feb 16, 2018 at 15:26
  • I tried endfloats but it just put the figures in the end of the document not separate file. Right? Commented Feb 16, 2018 at 15:28
  • The file is there. It has an .fff extension. Commented Feb 16, 2018 at 15:29
  • I checked, there are two files (.fff for figures) and (.ttt for tables). The files include the raw latex code for the figures/tables. This not what i meant, i want it to be extracted as pdf. because the user will convert each of these figures manually to pdf it can be difficult process (imagine you have 50 figures and 50 tables). I want an automated process to have pdfs (e.g., fig1.pdf, table1.pdf, etc) Commented Feb 16, 2018 at 15:36
  • You can't generate two PDFs with one LaTeX, unless you start another process to perform a completely different LaTeX job (which is what TikZ externalize does). What I meant was you could run \documentclass{standalome}[multi={figure}], although you would need to define a figure environment wrapper. Commented Feb 16, 2018 at 15:45

1 Answer 1


This demonstrates how one could use standalone to process a .fff file.

The 5in width was a guess. You can use \the\textwidth to print what you should use for each document.

\caption{A figure without subfigures}

  \caption{first part}
  \caption{(second part)}
\caption{A figure with subfigures}




You must log in to answer this question.

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