# Referencing sublabels without subfloats

Suppose that I have a figure with different panels and I want to use the command \cref to reference each one of the panels. A way to do this is to use the packages subfig, subfigure, or subcaption. However, what if the different panels in the figure are all together in a single file picture?

Is there a way to define a sublabel without define a subfloat or subfigure?

For example, consider the standard example:

\documentclass[11pt]{article}
\usepackage{subfig}

\begin{document}
\begin{figure}
\subfloat[\label{subfig-1}]{%
\includegraphics[scale=1]{example-image-1}
}
\subfloat[\label{subfig-2}]{%
\includegraphics[scale=1]{example-image-2}
}
\caption{blah blah}
\label{fig:dummy}
\end{figure}
\end{document}


Now, I dont't have example-image-1 and example-image-2 separately, but they are a single file example-image. What I am trying to do is to create a "phantom" subfloat in order to reference different parts of example-image as if they were two different and separate figures.

PS: I tried \phantomsubcaption from the package subcaption, as suggested here, but I have compatibility issues (I think it is revtex problem...).

IMPORTANT: Cutting the picture in two pieces is NOT an option.

A very quick and dirty solution is:

\documentclass[11pt]{article}
\usepackage{subfigure}
\begin{document}
\begin{figure}
\subfigure{\label{subfig-1}}
\subfigure{\label{subfig-2}}
\includegraphics[scale=1]{example-image}
\caption{blah blah}
\label{fig:dummy}
\end{figure}
\end{document}


However, this introduces extra spaces in the figures, since it actually defines 2 empty subfloats.

I hope that someone will have a better idea.

• I hope my question is clear... – sintetico Jul 11 '15 at 12:14
• Could you provide us with a minimum working example of your problem? That might make it easier for people to help you. – phx Jul 11 '15 at 12:17
• If you're using the revtex4-1 class, you might as well use that in your MWE, as it apparently conflicts with the most obvious solution (\phantomsubcaption). – Torbjørn T. Jul 11 '15 at 17:47
• To be honest, there is not much to be gained by making the \label/\ref mechanism work in this case. Since you are not captioning the sub-figures within the document, the references to them are fixed as they are contained in the image. So you can just use \ref{fig:mainfigure} (a) or whatever. Hard-coding the sub-figure reference isn't bad here since it is set by something independent of LaTeX anyway. – cfr Jul 11 '15 at 21:18

## 1 Answer

\phantomsubcaption seems to work fine here.

\documentclass{revtex4-1}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering{\phantomsubcaption\label{sub1}\phantomsubcaption\label{sub2}}
\includegraphics[width=0.5\linewidth]{example-image-a}
\caption{\subref{sub1} shows this, \subref{sub2} shows that.}
\label{fig}
\end{figure}

Figure~\ref{fig} has subfigures \ref{sub1} and \ref{sub2}.
\end{document}

• I know you said phantomsubcaption didn't work, but as it worked for me I posted the answer anyway. Does the above code not work for you? I can delete the answer if you want to. – Torbjørn T. Jul 11 '15 at 17:59
• Your solution looks nice, maybe there are other packages which are not compatible with subcaption...I'll check – sintetico Jul 11 '15 at 18:29