GeneralReferences to Sub-figures

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
pallav
Posts: 170
Joined: Wed Nov 12, 2008 5:53 pm

References to Sub-figures

Post by pallav »

I have used \subfigure for including four figures and each figures are labelled accordingly. In the output, figures are assigned by (a) (b) (c) (d).

In order to describe meaning of the figures, I want to cite the figures using the \ref{} command. I want to cite two figures at a time like this.
Fig. 2(a-c) depict ...
\ref{1st_label, 3rd_label} does not work. What to do?
Last edited by cgnieder on Thu Oct 04, 2012 5:38 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

References to Sub-figures

Post by localghost »

Get used to giving adequate problem descriptions. Nobody likes guesswork and random shots. Its essential to know exactly what you are doing.


Thorsten
pallav
Posts: 170
Joined: Wed Nov 12, 2008 5:53 pm

References to Sub-figures

Post by pallav »

Code: Select all

\documentclass[11pt]{article}
\usepackage{float, graphicx,subfigure,psfrag}
\begin{document}
\begin{figure}[H]
\centering
\subfigure[]{
    \includegraphics[height=2in,width=2in]{original_hyp_par_1}
    \label{fig:subfig1_RD_origin}
}
\subfigure[]{
    \includegraphics[height=2in,width=2in]{original_par_ell_2}
    \label{fig:subfig2_RD_origin}
}
\subfigure[]{
    \includegraphics[height=2.27in,width=2in]{original_pa_ell_3}
    \label{fig:subfig3_RD_origin}
}
\subfigure[]{
    \includegraphics[height=2in,width=2in]{original_hyp_par_4}
    \label{fig:subfig4_RD_origin}
}
\caption{\footnotesize Possible types of ......}
				 \label{fig:delay_case_Hopf}
 \end{figure}
The Figs. \ref{fig:subfig1_RD_origin}-\ref{fig:subfig3_RD_origin} have the same nature ...........
\end{document}
Note that Fig. 1(a) and Fig. 1(c) have same nature. In order to write in latex I want to modify the code in a nice re-presentable way.

The above gives the output as follows:
The Figs. 1(a)-1(c) have the same nature ...........
What I need is as follows:
The Figs. 1(a-c) have the same nature ...........
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

References to Sub-figures

Post by localghost »

The subfigure package is obsolete. Its direct successor is subfig. And this package offers the \subref* command to achieve what you want.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[demo]{graphicx}    % drop the »demo« option in the actual document
\usepackage{subfig}

\begin{document}
  \begin{figure}[!ht]
    \centering
      \subfloat[]{
        \includegraphics[height=2in,width=2in]{original_hyp_par_1}
        \label{fig:subfig1_RD_origin}
      }
      \subfloat[]{
        \includegraphics[height=2in,width=2in]{original_par_ell_2}
        \label{fig:subfig2_RD_origin}
      }\\
      \subfloat[]{
        \includegraphics[height=2in,width=2in]{original_pa_ell_3}
        \label{fig:subfig3_RD_origin}
      }
      \subfloat[]{
        \includegraphics[height=2in,width=2in]{original_hyp_par_4}
        \label{fig:subfig4_RD_origin}
      }
      \caption{\footnotesize Possible types of ......}
      \label{fig:delay_case_Hopf}
  \end{figure}

  The Figs.\ \ref{fig:delay_case_Hopf}(\subref*{fig:subfig1_RD_origin}--\subref*{fig:subfig3_RD_origin}) have the same nature \ldots
\end{document}
For details refer to the package manual.
Post Reply