# Figure numbering without the figure

It is quite common for academic journals to require article submissions to not include the figures, which are submitted separately. Then the journal staff position the figures in the text manually. However, they still require references to the figure to remain, so that these can be linked to the figure. The specific example I am dealing with right now is PLoS ONE.

There doesn't seem to be a standard way of handling this with LaTeX. Obviously I don't want two separate files, so I've been handling it with conditional compilation, and for the submission just including the caption as a block of text, without any figure environment. See the example below. However, the problem with this is that the figure numberings are now blank. Can anyone suggest a way to retain the figure numbering, perhaps by adding a dummy counter or environment for the submission case?

Note: I observed that in the non-submit case, where the figure is included, the figure numbering also disappears if I remove the caption. I'm not sure why this is the case. I've only a very sketchy idea of how the figure counter works. UPDATE: Here is Making labels from a counter, courtesy of Werner, which explains this. To quote Werner, "This is also why you place \label after \caption, since the latter executes a \refstepcounter."

EDIT: For reference here are the relevant PLoS ONE guidelines. As can be seen, they want the detailed legend to directly follow the figure number and title. Unfortunately, figcaps as suggested by Werner doesn't quite do this. It puts all the legend/caption texts on a separate page.

Also, here is the PLoS ONE LaTeX template.

\documentclass[10pt]{article}
\def\submit{}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,calc, external}
\begin{document}
\section*{A section}
Figure~\ref{schema}. % I want this to remain "Figure 1", even in the submit case
\section*{Figures}
\subsection*{Figure 1 - Database Schema}
\ifdefined\submit
Some caption text
\label{schema}
\else
\par \mbox{}
\par
\begin{figure}[tph]
\begin{center}
\begin{tikzpicture}[auto]
\draw (0,0) --(1,2);.
\end{tikzpicture}
\caption{some caption text}
\label{schema}
\end{center}
\end{figure}
\fi
\end{document}


UPDATE: I went with

\subsection*{Figure 1 - Database Schema}
\ifdefined\submit
\figlegend Some caption text \label{schema}
[...]


where \figlegend is defined by

\newcommand{\figlegend}{% figure legend
\refstepcounter{figure}% Increment counter for correct referencing


This is a simplified version of Werner's answer.

-
Have you had a look at the figcaps package? The package doesn't allow (or issues a warning with) \tableofcontents, \listoffigures and \listoftables, but this is probably fine for journal submission. –  Werner Aug 19 '11 at 23:14
@Werner: No, I hadn't heard of this. Thanks for the pointer. PLoS, however, has fits at the idea of extra packages. They say you can only include packages listed in their template, which is basically nothing. So, I'd prefer a from scratch approach if possible. I'll check out and consider using figcaps if it works for me, for the purpose of the current submission. –  Faheem Mitha Aug 19 '11 at 23:21

As far as I can tell, from the specifications under 8. Uploading Figures to the PLoS Manuscript Submission System a special package for flushing images to end of the document does not seem necessary:

Moreover, figures need not be numbered by section. They should be sequential, as stated under 3. Titles and Legends:

Titles and legends (captions) for main figures (i.e., not Supporting Figures) should be included in the main article file, not as part of the figure files themselves. Figure legends do not need to be uploaded to the online system. Do not include author names or the article title within the figure files. Instead, list the following information for each figure at the end of the article file, after the references, but before any tables:

• Figure number (in sequence, using Arabic numerals: Figure 1, Figure 2, Figure 3, etc.)
• Short title using a maximum of 15 words. The figure title should be bold type, using sentence case ending with a period (.). For example: Figure 1. Adaptation and its potential costs.
• A detailed legend of 300 words maximum can follow the figure title. Each panel should be described in the legend.

With this in mind, I would create a macro/command that would do exactly the what is stated above and merely place them at the end of the document. Here's an example:

\documentclass{article}

\newcommand{\newfig}{% A new figure
\bigskip% Big skip between figure legends
\refstepcounter{figure}% Increment counter for correct referencing
\item \bfseries Figure~\arabic{figure}.\ \ignorespaces%
}%
\newcommand{\figlegend}{% An accompanying figure legend
\item[] \mdseries% Typeset in regular/medium font
}

\begin{document}

\section{First section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer lacinia nisl ac augue
vehicula blandit. Donec quis nulla at massa blandit aliquet sit amet id mauris.
Figure~\ref{fig:first} is here. Ut et pharetra risus. Morbi hendrerit rutrum magna, eu
porta magna imperdiet in. Proin blandit placerat justo, non blandit nisi dapibus vitae.
Nunc sollicitudin volutpat ante, ac mollis neque ultricies eget. Fusce eu dolor vitae
tortor feugiat sagittis et et neque. Figure~\ref{fig:second} is here. Pellentesque odio
enim, imperdiet egestas suscipit in, accumsan eu nisl. Nunc iaculis semper viverra.
Aliquam erat volutpat. Aliquam augue massa, gravida sed placerat ut, facilisis a ante.
Suspendisse consectetur porta convallis. Fusce auctor lacinia lobortis.

\section{Second section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer lacinia nisl ac augue
vehicula blandit. Donec quis nulla at massa blandit aliquet sit amet id mauris.
Figure~\ref{fig:third} is here. Ut et pharetra risus. Morbi hendrerit rutrum magna, eu
porta magna imperdiet in. Proin blandit placerat justo, non blandit nisi dapibus vitae.
Nunc sollicitudin volutpat ante, ac mollis neque ultricies eget.
Figure~\ref{fig:fourth} is here. Fusce eu dolor vitae tortor feugiat sagittis et et
neque. Pellentesque odio enim, imperdiet egestas suscipit in, accumsan eu nisl. Nunc
iaculis semper viverra. Aliquam erat volutpat. Aliquam augue massa, gravida sed
placerat ut, facilisis a ante. Suspendisse consectetur porta convallis. Fusce auctor
lacinia lobortis.

\section{Last section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer lacinia nisl ac augue
vehicula blandit. Donec quis nulla at massa blandit aliquet sit amet id mauris. Ut et
pharetra risus. Morbi hendrerit rutrum magna, eu porta magna imperdiet in. Proin
blandit placerat justo, non blandit nisi dapibus vitae. Figure~\ref{fig:fifth} is here.
Nunc sollicitudin volutpat ante, ac mollis neque ultricies eget. Fusce eu dolor vitae
tortor feugiat sagittis et et neque. Pellentesque odio enim, imperdiet egestas suscipit
in, accumsan eu nisl. Figure~\ref{fig:sixth} is here. Nunc iaculis semper viverra.
Aliquam erat volutpat. Aliquam augue massa, gravida sed placerat ut, facilisis a ante.
Suspendisse consectetur porta convallis. Fusce auctor lacinia lobortis.
Figure~\ref{fig:seventh} is here.

\clearpage
% Figure legends

\begin{itemize}
\newfig First figure caption.\label{fig:first}
\figlegend Legend for the first figure.

\newfig Second figure caption.\label{fig:second}
\figlegend Legend for the second figure.

\newfig Third figure caption.\label{fig:third}
\figlegend Legend for the third figure.

\newfig Fourth figure caption.\label{fig:fourth}
\figlegend Legend for the fourth figure.

\newfig Fifth figure caption.\label{fig:fifth}
\figlegend Legend for the fifth figure.

\newfig Sixth figure caption.\label{fig:sixth}
\figlegend Legend for the sixth figure.

\newfig Seventh figure caption.\label{fig:seventh}
\figlegend Legend for the seventh figure.

\end{itemize}

\end{document}


The above example has references to figures interspersed with all the figure legends at the end of the document (after \clearpage). No additional packages are loaded. Two new commands have been created: \newfig and \figlegend each of which are used in succession at the document end to produce and typeset the list (in the form of an itemize environment) of figures and legends.

I am assuming, to echo your original comment, that the journal lays this out themselves in order to make sure submissions comply to their standards. Moreover, then they have control over allowing image views in an online version of the article.

-
Thanks for your answer. This seems like what I was looking for. I think I might make some tweaks. Unfortunately, I don't understand how counters, labels and ref work in TeX/LaTeX. Specifically, how does the label associate with the counter? There can of course be multiple counters defined at any time. Can you point me to a reference? Also, you refer to defining an environment, but you seem to have defined a command instead. –  Faheem Mitha Aug 20 '11 at 18:14
After a little fiddling, it looks like one can manage with the rather simpler command f\newcommand{\figlegend}{\refstepcounter{figure}}. Your newfig could be replaced with just a Subection*. The magic command \refstepcounter is doing the heavy lifting here. –  Faheem Mitha Aug 20 '11 at 19:23
Yes, I created a macro/command, not an environment. I originally thought that would do it, but changed it since I put all the commands in the enumerate environment. I've updated my text with this correction. Regarding counters: The command \refstepcounter{<cntr>} does 2 things: increments the counter <cntr> and also marks a reference point for when you use \label{<lab>}. Using only \stepcounter{<cntr>} is the same as saying \addtocounter{<cntr>}{1} which increments the counter by 1. This reference discusses the standard counters. –  Werner Aug 20 '11 at 21:24
Thanks for the clarification. The enumerate environment doesn't seem to be necessary either. The only necessary thing seems to be to add the \refstepcounter, which is what \figlegend does. –  Faheem Mitha Aug 20 '11 at 21:27
...the Introduction section of the zref package documentation also gives a brief description of what LaTeX does in terms of counters, labels and references. As an experiment, see what happens when you use \stepcounter instead of \refstepcounter‌​. I wasn't sure what you were exactly after - part of the Q&A processes on TeX.SX - so changing \newfig to be a \subsection* is fine. –  Werner Aug 20 '11 at 21:31

You can use the comment package to enclose the \includegraphics commands, and the tikzpicture environments inside a comment environment (using/commenting out \includecomment{comment} you can show/hide the figures at any time):

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{tikz}
\usepackage{comment}
\usepackage{lipsum}
%\includecomment{comment} % to actually include the figures

\begin{document}

\lipsum[1]
\begin{figure}[!ht]
\centering
\begin{comment}
\includegraphics[height=1cm]{name1}
\end{comment}
\caption{a test caption}
\label{fig:test1}
\end{figure}
\lipsum[1]
\begin{figure}[!hb]
\centering
\begin{comment}
\begin{tikzpicture}[auto]
\draw (0,0) --(1,2);.
\end{tikzpicture}
\end{comment}
\caption{another test caption}
\label{fig:test2}
\end{figure}

In Figures ~\ref{fig:test1} and~\ref{fig:test2}...

\end{document}


The demo option for graphicx was used to make the example compilable for everyone; do not use the option in your actual document.

-
Thanks for your answer. Unfortunately, I don't think the resulting text is exactly what the journal prescribes. The legend is in a different font, centered midway in the page, an d with a bit of a gap before the title. This would all be fine if there was a figure present, but doesn't work so well if there isn't. –  Faheem Mitha Aug 20 '11 at 18:09