0

I have an image image.png that has some parts: a), b) and c). I put it in my text like

\begin{figure}
\centering
\includegraphics[width=\textwidth]{image.png}
\caption{Some text here \label{fig:myfig}}
\end{figure}

I use cleveref to reference objects within the document. I want to be able to have only one figure, but to be able to generate references (with the hyperlinks) to each part of the figure, i.e. something like \Cref{fig:myfig}[a] so that cleveref transforms it to "Figure 1a)", or \Cref{fig:myfig}[a,c] transforms to "Figures 1a) and 1c)". Is this possible? How does one do it without creating separate images and creating subfigures? Thanks a lot.

  • 6
    Have a look at the subcaption package - it can do phantom subfigures which then be referenced by cleverref – user36296 Jun 10 '18 at 19:57
  • 1
    Please make your code compilable as that's much more useful than a mere fragment. You can use e.g. example-image etc. for external graphics, as everyone (with a standard install) has those. – cfr Jun 10 '18 at 20:02
2

As mentioned in the comments, the subcaption package provides a solution for this with phantomsubcaption (see here). An example is

\begin{figure}
\centering
\includegraphics{cat_and_elephant}
\phantomsubcaption\label{cat}
\phantomsubcaption\label{elephant}
\caption{Two animals: \subref{cat} a huge cat,
and \subref{elephant} an elephant}
\end{figure}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.