[Tex/LaTex] Remove figures, but keep references to image

captionscross-referencing

I want to remove a figure and its caption from a LaTeX file, but I want to keep the references to it in the text.

So far I kept the empty figure environment with a caption and a label. The problem is, I can not make the caption vanish without destroying the references.

I tried \caption*{} as well as

\setbox0=\vbox{\caption{somecaption}}

as was suggested here.

However, as soon as the caption "Fig. 1" disappears, also my reference to the label disappears.

\documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]{revtex4-1}
\usepackage{graphicx}
\begin{document}

I want to reference Fig.~\ref{fig1}.  \\

\begin{figure}
    %\includegraphics{image.pdf}
    \caption{}
    \label{fig1}
\end{figure}

\end{document}

It would be nice if someone could help me, as I didn't find anything about this myself.

Best Answer

\documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]{revtex4-1}
\usepackage{graphicx}
\begin{document}

I want to reference Fig.~\ref{fig1}. % never use  \\ at end of paragraph


\refstepcounter{figure}\label{fig1}


\end{document}
Related Question