3

I have two sub-figures in a figure (say Figure M) called a and b. How can I combine showing multiple figure labels like this?

Figure Ma and b

P.S. I can easily get the following figure labels by command Figure \ref{fig_M_a} and \ref{fig_M_b} (assume the labels for them are fig_M_a and fig_M_b respectively):

Figure Ma and Mb

2 Answers 2

6

You can use \subref; in the following example I assumed subcaption was used to produce the subfigures:

\documentclass{article}
\usepackage{subcaption}

\begin{document}

As we can see in Figures~\ref{fig:testa} and~\subref{fig:testb}...

\begin{figure}
\centering
\subcaptionbox{first subfigure\label{fig:testa}}{\rule{4cm}{1cm}}\qquad
\subcaptionbox{second subfigure\label{fig:testb}}{\rule{4cm}{1cm}}
\end{figure}

\end{document}

enter image description here

Using subfig and \subfloat this will produce the desired result:

\documentclass{article}
\usepackage{subfig}
\captionsetup[subfigure]{subrefformat=simple,labelformat=parens,listofformat=subsimple}

\begin{document}

As we can see in Figures~\ref{fig:testa} and~\subref{fig:testb}...

\begin{figure}
\centering
\subfloat[first subfigure\label{fig:testa}]{\rule{4cm}{1cm}}\qquad
\subfloat[second subfigure\label{fig:testb}]{\rule{4cm}{1cm}}
\end{figure}

\end{document}

enter image description here

3
  • Thanks. But I will get Figure Ma and (b). Any idea? P.S. I am using \subfloat. Feb 9, 2014 at 1:48
  • @herohuyongtao please see my updated answer. Feb 9, 2014 at 1:53
  • It works now. Thanks. It didn't work previously because the \label{...} is outside the \subfloat[...]. Feb 9, 2014 at 2:04
0

You can also put a \caption{} and corresponding \label{} for the whole figure, and reference that. That sounds like what you really want.

1
  • Yes, I have one for the whole figure. But here I want to refer to some parts of the figures. Thanks anyway. Feb 9, 2014 at 1:56

You must log in to answer this question.

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