# Produce PDFs with only the figures/tables without captions and with only the captions without figures/tables

I'm submitting the final copy of a journal paper and got the following requirements:

• Camera-ready copies of all figures and tables in a single pdf/ps file (that is, produce a single ps/pdf file with all the figures and table contained in the manuscript).
• Figure and table captions in a single pdf/ps file (that is, produce a single ps/pdf file with all the figures and table captions).
• [..]
• Soft copy of figures and tables, that is one file per each figure or table.

I read that the way that I need to have:

• one PDF with only the figures and tables, but apparently without the captions. I presume one figure or table per page.
• one PDF with the captions alone. One per page as well maybe?
• one PDF or other file per figure or table.
This is fine because all my figures or tables are either direct PDFs or done using the standalone class.

Is there an easy way to suppress everything but the figures and tables without the \caption? Then do the same but only with the captions? I guess using endfloat and then cutting the last pages of the PDF would work once the captions are dealed with, but a way which produces a PDF with only the figures directly would be nicer!

-
If you use the endfloat package and redefine \processdelayedfloats to relax, you'll get the captions without figures and tables. Within the figures/tables document, you could \include the fff and ttt files produced by the other document to get the figures and tables (without captions). –  Axel Sommerfeldt May 27 '12 at 16:44
The "figure and table captions in a single file" almost sounds like they want the list of figures and list of tables separately. As for the figures and tables in a single file, if they are all pdfs, a non LaTeX solution would be to use pdftk to concatenate them into one file. But it is hard to figure out exactly what they actually mean since their links on the site do not really work –  ArTourter May 27 '12 at 18:25

Here's a possible way. First of all the main document (changing \iftrue to \iffalse will make possible to typeset it normally, with figures and tables.

\documentclass{article}

\iftrue % change to \iffalse for production version
\usepackage{expl3,environ}
\makeatletter
\newsavebox{\@gobblefloatbox}
\newif\ifcrazy@label
\def\crazy@label#1{\gdef\crazy@thislabel{#1}\xdef\crazy@currentlabel{\@currentlabel}\global\crazy@labeltrue}
\let\figure\relax\let\endfigure\relax
\NewEnviron{figure}[1][\fps@figure]{\crazy@float{figure}}
\let\table\relax\let\endtable\relax
\NewEnviron{table}[1][\fps@table]{\crazy@float{table}}
\def\crazy@float#1{%
\csname crazy_save:nn\expandafter\endcsname\expandafter{\BODY}{#1}%
\begin{lrbox}{\@gobblefloatbox}\begin{minipage}{\textwidth}%
\renewcommand{\caption}[2][]{\refstepcounter{#1}##2}%
\let\label\crazy@label
\BODY
\end{minipage}\end{lrbox}%
\ifcrazy@label\edef\@currentlabel{\crazy@currentlabel}\label{\crazy@thislabel}\global\crazy@labelfalse\fi
}
\ExplSyntaxOn
\seq_new:N \g_crazy_floats_seq

\cs_new:Npn \crazy_save:nn #1 #2
{
\seq_gput_right:Nn \g_crazy_floats_seq { \begin{#2} #1 \end{#2} }
}
\iow_new:N \crazy_output_w
\cs_new:Npn \crazy_write:
{
\iow_open:Nn \crazy_output_w { \c_job_name_tl.ftl }
\seq_map_inline:Nn \g_crazy_floats_seq
{ \iow_now:Nn \crazy_output_w { ##1 } }
\iow_close:N \crazy_output_w
}
\AtEndDocument{\crazy_write:}
\ExplSyntaxOff
\fi

\usepackage{kantlipsum}

\begin{document}

\author{A. U. Thor}
\title{A crazy article}

\maketitle

\section{A section}

\kant[1-2]

\begin{figure}[tp]
\centering
A figure
\caption{A caption}\label{fig:a}
\end{figure}

Here we have a reference to figure \ref{fig:a}

\kant[3-4]

\section{B section}

\kant[1-2]

\begin{table}[tp]
\centering
A table
\caption{A caption\label{tab:b}}
\end{table}

\kant[3-4]

\end{document}


If the document is called mydoc.tex, at the end a file mydoc.ftl will be created, containing all the floating objects in the order specified in the document. It will be sufficient to create a new document

\documentclass{article}
% the necessary packages

\begin{document}
\input{mydoc.ftl}
\end{document}


The separate files for figures are easy; for tables it's harder: if they are not so many, editing the produced .ftl file may be the easiest solution. After all the allowed number of pages is rather limited.

What are we doing? The figure and table environments are redefined with \NewEnviron to first save their contents in a LaTeX3 sequence; then the same contents is typeset in a box in order to establish references and read the label; the box will then be discarded. At the end the collected material is written off in the .ftl file.

Note: I chose the prefix the internal macros on purpose. Maybe the people who ask to comply with such crazy requirements will understand.

-
+1 for crazy ;-) –  Marco Daniel May 27 '12 at 20:26