# How to save a figure with multiple sub floats to a single pdf file

How to save a figure with multiple sub floats to a single pdf file.

Here is the code:

\documentclass[12pt]{article}
\usepackage[percent]{overpic}

\begin{document}

\begin{figure}\centering
\begin{overpic}[width=0.49\textwidth]{pic.png}
\put(50,26){\textbf{A}}
\end{overpic}
\begin{overpic}[width=0.49\textwidth]{pic.png}
\put(50,26){\textbf{B}}
\end{overpic}
\begin{overpic}[width=0.49\textwidth]{pic.png}
\put(50,26){\textbf{C}}
\end{overpic}
\begin{overpic}[width=0.49\textwidth]{pic.png}
\put(50,26){\textbf{D}}
\end{overpic}
\begin{tabular}{|c|c|}
\hline test & test \\
\hline  &  \\
\hline
\end{tabular}
\caption{\label{fig-p1} caption.}
\end{figure}

\end{document}


This is what it produces:

I want to save the figure in the red square into a single pdf file (without white margins) e.g. fig1.pdf. Then next time, I can only include fig1.pdf instead of so many sub floats:

\begin{figure}\centering
\includegraphics{fig1.pdf}
\caption{\label{fig-p1} caption.}
\end{figure}


I ask this because many journals ask you to submit figures separately from the main text.

Any help would be much appreciated.

You might like the standalone class for this:

% arara: pdflatex
% !arara: indent: {overwrite: yes}
\documentclass[varwidth]{standalone}
\usepackage[percent]{overpic}
\begin{document}

\centering
\begin{overpic}[width=0.49\textwidth]{example-image-a}
\put(50,26){\textbf{A}}
\end{overpic}
\begin{overpic}[width=0.49\textwidth]{example-image-b}
\put(50,26){\textbf{B}}
\end{overpic}\\
\begin{overpic}[width=0.49\textwidth]{example-image-c}
\put(50,26){\textbf{C}}
\end{overpic}
\begin{overpic}[width=0.49\textwidth]{example-image-a}
\put(50,26){\textbf{D}}
\end{overpic}
\begin{tabular}{|c|c|}
\hline test & test \\
\hline      &      \\
\hline
\end{tabular}

\end{document}