# Export each figure as a separate PDF-file

I am using .pdf_tex files to insert and label figures in LaTeX:

\begin{figure}
\centering
\graphicspath{{Graphics/FiltersCa/}}
\input{Graphics/FiltersCa/COMB_filter_activeZ2b.pdf_tex
}
\caption{...
}
\label{fig:FiltersCa}
\end{figure}


Is it possible to export each figure as a separate PDF-file?

• I don’t think so. The compiler only produces one PDF. So you’d have to make a script in a different language that divided it up into multiple .tex-files. Mar 25, 2018 at 17:44
• Maybe you can find some useful information here: Generating a separate pdf file of tables and figures from a latex file? and here: Splitting figures/tables into separate files Mar 25, 2018 at 18:10
• thanks for your answer....I had a look at the work-arounds. I was just wondering, if there is a easier way. I need to use an online compiler that fails compiling my figures using .pdt_tex-files. Therefore I need to create complete figures, i can just include. Mar 25, 2018 at 18:43
• If you have just a couple of pictures then maybe have a look at the standalone package and document class: ctan.org/pkg/standalone Mar 25, 2018 at 19:58

The endfloat package will export all the figures (LaTeX source) to a .fff file.

\documentclass{article}
\usepackage{endfloat}
\usepackage{graphicx}

\makeatletter
\efloat@openpost{fff}
\efloat@iwrite{fff}{\string\textwidth=\the\textwidth}% pass \textwidth to fff file
\makeatother

\begin{document}

\begin{figure}
\centering
\includegraphics{example-image}
\caption{Test caption}
\end{figure}

\end{document}


Standalone can create a PDF file containing one figure/page. Labels and counter values will be lost.

\documentclass[multi=figure]{standalone}
\usepackage{graphicx}

\makeatletter
\renewenvironment{figure}%
{\def\@captype{figure}%
\minipage{\textwidth}}%
{\endminipage}
\makeatother

\let\efloatseparator=\empty

\begin{document}
\input{test5.fff}
\end{document}


This version loses the caption.

\documentclass[multi=figure]{standalone}
\usepackage{graphicx}

\renewenvironment{figure}{\ignorespaces}{\unskip}
\renewcommand{\caption}[2][]{\ignorespaces}
\let\efloatseparator=\empty

\begin{document}
\input{test5.fff}% previously created fff file
\end{document}

• Almost perfect solution. Is there now a simple way to suppress the caption of each figure with one command at the beginning of the document. I would like to have the figures in the final PDF without caption and don't want to change everywhere caption to caption*. <\captionsetup{format=empty}> doesn't work for me :/ Mar 26, 2018 at 19:57
• \renewcommand{\caption}[2][default]{\ignorespaces} should take care of it. If you are losing the caption, you don't need the minipage either. Mar 26, 2018 at 21:17

Quick update with my current work-around (figure-by-figure):

• I open the original PDF-output with Inkscape (I recommend Poppler/Cairo import). You can select the page containing a specific figure.

• Create an rectangle (F4) that outlines the region of the page, you would like to export (Figure with or without caption).

• Press Shift and click on the imported PDF-page and the rectangle.

• Right mouse click on the rectangle and choose Set Clip

• Press Shift+Ctrl+D, click on Resize page to content... in the Custom size section and click Resize page to rawing or selection

• In the File-menu, you can safe it as a PNG or PDF file. For PDF I would suggest to Convert text to path in order to maintain the original LaTeX font.

Best wishes, Markus

• Ah, the old elbow-grease method :-) Aug 5, 2018 at 14:29