I am working on a book and I use the subcaption package to refer to some figures. However, I found that in some cases it is easier for me to just add the caption text (a), (b), etc. directly in the figure. To make things more complicated, many of these figures are created using tikz, for which I also use the tikz external (thus the figures are compiled individually. In my experience using reference within figures that are compiled using external are not showing the labels for some reason.

Because of all this, the problem is that now it's hard to refer to subfigures. I managed to use the \ref and \hyperref commands as follows:


Still, this solution isn't perfect because when I hover over I have two separate hyperlinks. Is there a simpler, better way to accomplish what I want without using subacaption or similar packages?

Perhaps if there is a macro that I can use to obtain the figure number from a figure label, then I could use attach a label to the text (a) in the figure caption and then refer to it like:

  • Externalize inputs the PDF using \includegraphics, which loses the anchor points. Commented Apr 15, 2022 at 4:05
  • 3
    If \ref{fig:some_figure}\hyperref[fig:some_figure]{a} works in your situation, you could get one link with \hyperref[fig:some_figure]{\ref*{fig:some_figure}a}. But, without a MWE, that's just a guess.
    – gusbrs
    Commented Apr 21, 2022 at 13:48
  • Somewhat related: tex.stackexchange.com/questions/176280/… Commented Apr 26, 2022 at 13:16

3 Answers 3


I use \subfig, \subcaption packages when I have multiple subfigures in my write-up. I'm not sure if this is what you're looking for, but please see below my approach. I used the latex .svg.png file as a reference picture (found online).

\documentclass[12pt, a4paper]{article}
\caption{Sample Output.}

\huge Figures~\ref{a} to~\ref{d} are shown above. %Used \huge just for illustration purpose. 


I get:

enter image description here


The subcaption package documentation contains a section "Captions inside sub-figures" regarding this topic. Particularly the sub-sections "Referencing sub-figures without sub-captions" and "Using the tikz package" might be of interest for you.

  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Apr 23, 2022 at 14:29

Perhaps \phantomlabel (of package subcaption) and then combined with Figure~\hyperref[fig:some_figure_a]{\ref{fig:some_figure}a} may do what you want.

You must log in to answer this question.

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