I prefer to design my figures externally such that I only need to include one image in latex, even if it consist in several subfigures. Say, I want to have two figures (a) and (b) side by side. Instead of creating two images (corresponding to (a) and (b)) and including both in the figure environement, I rather create one image with both figures side by side and include only this one in the figure environement.

However, I sometimes did proceed the other way round and came to appreciate the handiness of the subfig package that, together with cleveref, allows direct and automated referencing of subfigures.

Still, I want to stick to my habit of creating one image rather than two, because I can more easily adjust the position of the subfigures. Is there a way to reference a subfigure that is not explicitely defined as such in latex (because it is defined externally)?

I know that I could do this by hand with using \ref and putting an "a" or "b" behind. However, I don't know yet, if I want to have my references in parenthesis or not and this can be easily adjusted by the cleveref package at the end. Therefore, I want to keep it as homogeneous as possible.

I am sorry if there is already such a question, but I have absolutely no idea how to search for this. Using my title in the search field does give any clue.

  • 5
    I think the workflow you're describing is going to cause frustration in the long run. Personally, I would create one figure per image, and then use the subfigure environment from the excellent subcaption package. You can then globally change all of your captions easily, and easily use the cleverref package too.
    – cmhughes
    Commented Jun 4, 2012 at 21:11
  • My subcaption package allows labeling build-in subfigures, see tex.stackexchange.com/questions/40508/…
    – user2574
    Commented Jun 5, 2012 at 6:11

1 Answer 1


I agree that this workflow is not ideal, but one way you can work with what you have is to use empty subfigure environments from the subcaption package. I made a new command called \phantomsubfigure that accepts a label for the subfigure as the only argument.



\usepackage[demo]{graphicx} %the demo option is set only for this example
\usepackage[]{cleveref} %http://www.ctan.org/pkg/cleveref
\usepackage[labelformat=empty,skip=0pt]{subcaption} %http://www.ctan.org/pkg/subcaption

\newcommand*\phantomsubfigure[1]{\begin{subfigure}[]{0pt}\caption{}\label{#1}\end{subfigure}} %<---- this is the command


Take look at the cow in \cref{1a}, the space ship in \cref{1b}, and finally at the dress in \cref{1c}.

\caption{this is a test}


Example Output:

example output

  • Thanks, works fine for my purpose. And maybe I should reconsider my workflow, but not for the next two weeks :). How do you usually work? Do you create an image for each subfigure, with same dimensions? Or at least same height? How do you align them? Just by inserting some \hfill? Thanks in advance.
    – Berserk
    Commented Jun 4, 2012 at 23:27
  • 1
    Yes, I create an image for each subfigure. My subfigures are usually data plots from MATLAB with the same dimensions so they basically line themselves up. I usually have two subfigures per row, so I just set the width of each graphic to .5\linewidth. en.wikibooks.org/wiki/LaTeX/… might be able to help on ideas for aligning subfigures.
    – JohnReed
    Commented Jun 5, 2012 at 0:23
  • +1 but I think the order of the packages should be graphicx, hyperref, cleveref
    – cmhughes
    Commented Jun 5, 2012 at 2:36
  • @cmhughes Thanks for the correction, I've edited the answer to reflect the changes.
    – JohnReed
    Commented Jun 5, 2012 at 2:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .