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. – John Kormylo Feb 16 '18 at 15:26
  • I tried endfloats but it just put the figures in the end of the document not separate file. Right? – NuminousName Feb 16 '18 at 15:28
  • The file is there. It has an .fff extension. – John Kormylo Feb 16 '18 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) – NuminousName Feb 16 '18 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. – John Kormylo Feb 16 '18 at 15:45

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}




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.