3

Is it possible to group figures into a single float and reference them separately, without creating separate caption for each of the figures?

enter image description here

I am aware of subfloat and subfigure environments, but they create separate captions for each figure. The feature I am specifically looking for is to have subfigure numbering (such as (a), (b), ...) but also have the captions grouped together into a single block of text, separated by references ((a), (b), ...) to the images.

2 Answers 2

6

Here is a solution with subcaption. I think similar result can be obtained by using subfloat also.

Just give \caption{} without any arguments so that it will print only the label ((a),(b)...) not the caption text. And then caption can be given for main figure, where subfigures can be 'sub'-reffered. Sample output:

enter image description here

Corresponding MWE made by modifying code from another question.

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\captionsetup{subrefformat=parens}

\begin{document}
\begin{figure}
    \centering
    \begin{subfigure}[b]{0.3\linewidth}
        \includegraphics[width=\linewidth]{example-image-a}
        \caption{}
        \label{fig:a}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\linewidth}
        \includegraphics[width=\linewidth]{example-image-b}
        \caption{}
        \label{fig:b}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\linewidth}
        \includegraphics[width=\linewidth]{example-image-c}
        \caption{}
        \label{fig:c}
    \end{subfigure}
    \caption{
        \subref{fig:a} first figure.
        \subref{fig:b} second figure.
        \subref{fig:c} third figure.
    }
    \label{fig:main}
\end{figure}
Figure~\ref{fig:main} has three Subfigures--- \ref{fig:a}, \ref{fig:b} and  \ref{fig:c}.
\end{document}

EDIT

The caption can be placed on the left side by manually putting it there and using \phantomsubcaption to suppress the automatic caption. Sample output:

enter image description here

The corresponding code:

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\captionsetup{subrefformat=parens}

\begin{document}
\begin{figure}
    \centering
        {(a)~\includegraphics[width=0.25\linewidth]{example-image-a}
        \phantomsubcaption\label{fig:a}}
        {(b)~\includegraphics[width=0.25\linewidth]{example-image-b}
        \phantomsubcaption\label{fig:b}}
        {(c)~\includegraphics[width=0.25\linewidth]{example-image-c}
        \phantomsubcaption\label{fig:c}}
    \caption{
        \subref{fig:a} first figure.
        \subref{fig:b} second figure.
        \subref{fig:c} third figure.
    }
    \label{fig:main}
\end{figure}
Figure~\ref{fig:main} has three Subfigures--- \ref{fig:a}, \ref{fig:b} and  \ref{fig:c}.
\end{document}
2
  • By any chance, do you know a method to get the label to the left of the images? I generally prefer to have output that looks as if I had written (a)\includegraphics{...} (b)\includegraphics.
    – kdb
    Dec 14, 2018 at 12:40
  • 1
    @kdb See the edit made to answer.
    – nidhin
    Dec 15, 2018 at 7:10
1

As alternative to nidhin's answer, one can also use the subfig package:

enter image description here

\documentclass{article}
\usepackage{subfig}
\usepackage{graphicx}
\begin{document}

\begin{figure}
  \centering
  % [] Needed for the caption label (a), (b) to be typeset.
  \subfloat[\label{fig:mytopic-blabla}]{
    \includegraphics[height=5cm]{images/graph-mytopic-blabla.png}
  }
  \subfloat[]{
    % Label can be either in caption or body.
    \label{fig:mytopic-yadayada}
    \includegraphics[height=5cm]{images/graph-mytopic-yadayada.png}
  }
  \caption{
    % Must \protect the subref command inside floats/captions.
    \protect\subref{fig:mytopic-blabla}
    Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. 
    \protect\subref{fig:mytopic-yadayada}
    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
  }
\end{figure}

\end{document}

You must log in to answer this question.

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