am looking help for two things. (1) I would like to write the text as 'In Fig. (1) and in Fig. (2a)', for which the TEX is written as follows:

Shown in Fig. (\ref{fig:main}) and shown in Fig. (\ref{fig:2})'

\label{fig:main} \caption{main}

  \subfloat[ 1]{\label{fig:1}\includegraphics[width=3.5cm]{11}}
  \subfloat[ 2]{\label{fig:2}\includegraphics[width=4.1cm]{22}}
  \subfloat[ 3]{\label{fig:3}\includegraphics[width=4.1cm]{33}}
  \subfloat[ 4]{\label{fig:4}\includegraphics[width=4.1cm]{44}}

  \subfloat[ 5]{\label{fig:5}\includegraphics[width=4.1cm]{55}}
  \subfloat[ 6]{\label{fig:6}\includegraphics[width=4.1cm]{66}}
  \subfloat[ 7]{\label{fig:7}\includegraphics[width=4.1cm]{77}}
  \subfloat[ 8]{\label{fig:8}\includegraphics[width=4.1cm]{88}}


But the output does not link to Fig. (2a).

(2) Also, with this code the captions are above the image, how can we move them below the image, something like this:

    11      22      33      44
(a) 1   (b) 2   (c) 3   (d) 4
          Fig. (1) main

where, 11, 22, ...so on are the images.

Packages used:


Any solution? Or Any other way of working on it, where labels for individual images can also be referred? Thank you.

  • 3
    In floats \label must always be after \caption. Feb 9 '14 at 4:42
  • Could you please elaborate, I tried that but does not work. Deleting .log file too does not help.
    – dbs
    Feb 9 '14 at 4:45
  • You're using the syntax for the package subfig, while you load subcaption.
    – egreg
    Feb 9 '14 at 10:12

Inside floats, always place \label after \caption (in the figure you had them the other way round). Since you are using \ref{fig:2} which has the string used to label the second subfigure, you are hyperlinking to the second subfigure, not to the first one; to hyperlink the first subfigure you need \ref{fig:1} (by the way, try to pick more describtive strings for your references).



to have the subcaptions below the subfigures.

I added some \hfills to give some spacing between the subfigures:



Shown in Fig.~(\ref{fig:main}) and shown in Fig.~\ref{fig:2}
  \subfloat[ 1]{\label{fig:1}\includegraphics[width=3.5cm]{11}}\hfill
  \subfloat[ 2\label{fig:2}]{\includegraphics[width=4.1cm]{22}}\hfill
  \subfloat[ 3]{\label{fig:3}\includegraphics[width=4.1cm]{33}}\hfill
  \subfloat[ 4]{\label{fig:4}\includegraphics[width=4.1cm]{44}}

  \subfloat[ 5]{\label{fig:5}\includegraphics[width=4.1cm]{55}}\hfill
  \subfloat[ 6]{\label{fig:6}\includegraphics[width=4.1cm]{66}}\hfill
  \subfloat[ 7]{\label{fig:7}\includegraphics[width=4.1cm]{77}}\hfill
  \subfloat[ 8]{\label{fig:8}\includegraphics[width=4.1cm]{88}}


  • 1
    I would even say inside the caption's argument (\caption{\label{…}main}). Feb 9 '14 at 10:08

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.