LaTeX forum ⇒ Graphics, Figures & TablesFigure labeling Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
Amitavo Roy
Posts: 14
Joined: Sat Apr 06, 2013 11:50 am

Figure labeling

Postby Amitavo Roy » Mon Apr 08, 2013 3:45 pm

I would like to add two figures (one below the another-named them a and b respectively),
I used

  1. \begin{figure}[!h]
  2. \centering
  3. \includegraphics[width=0.8\linewidth]{52a}
  4. \includegraphics[width=0.8\linewidth]{52b}
  5. \caption{(a) Study of convergence..., (b) zoomed picture of the encircled
  6. portion of (a).....}
  7. \label{fig:5.2a}
  8. \label{fig:5.2b}
  9. \end{figure}


After runing this code line I can ref. only fig. 5.2 in my text...but I want to ref. in some places with fig. 5.2a and in some places with fig. 5.2b.

My question is thus: how can I label my figures with two different labels?
Thanks for your help
Amitavo
Last edited by Stefan Kottwitz on Mon Apr 08, 2013 4:38 pm, edited 1 time in total.
Reason: code marked

Tags:

User avatar
sommerfee
Posts: 498
Joined: Mon Apr 09, 2007 4:20 pm

Postby sommerfee » Mon Apr 08, 2013 9:30 pm

One option would be using the/my subcaption package. It offers a command called \phantomcaption which does all a regular \caption does (incrementing the figure or sub-figure counter, generating an anchor for \label and \ref, ...) but does not actually typeset a caption text.

For example:
  1. \documentclass{article}
  2. \usepackage[demo]{graphicx}
  3. \usepackage{subcaption}
  4. \begin{document}
  5. \verb|\ref{fig:5.2a}| gives \ref{fig:5.2a} and
  6. \verb|\ref{fig:5.2b}| gives \ref{fig:5.2b}.
  7. \begin{figure}
  8. \centering
  9. \begin{subfigure}{0.8\linewidth}
  10. \includegraphics[width=\hsize]{52a}
  11. \phantomcaption
  12. \label{fig:5.2a}
  13. \end{subfigure}
  14. \begin{subfigure}{0.8\linewidth}
  15. \includegraphics[width=\hsize]{52b}
  16. \phantomcaption
  17. \label{fig:5.2b}
  18. \end{subfigure}
  19. \caption{(a) Study of convergence..., (b) zoomed picture of the encircled
  20. portion of (a).....}
  21. \end{figure}
  22. \end{document}

Amitavo Roy
Posts: 14
Joined: Sat Apr 06, 2013 11:50 am

Postby Amitavo Roy » Tue Apr 09, 2013 8:32 am

Thanks a lot sommerfee .....


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 17 guests