4

I want to display a figure demonstrating 3 cases. The case1 and case2 are shown using single images each. But case 3 needs 3 images. I have used nested subfigure as follows: However the captions go as (a), (b), (d), (e), (f). I want to give captions (a) (b) and (c) for each case, and(i), (ii), (iii) for each image in case 3. How is that possible? Thanks.

\begin{figure}[H]
\centering
\subfigure[ ]{
\includegraphics[width=110px,height=85px]
{images/case1.eps}
\label{fig:case1}
}
\subfigure[ ]{
\includegraphics[width=110px,height=85px]
{images/case2.eps}
\label{fig:case2}
}
\subfigure[]{
\subfigure[]{
\includegraphics[width=70px,height=60px]
{images/case3a.eps}}
\subfigure[]{
\includegraphics[width=70px,height=60px]
{images/case3b.eps}}
\subfigure[]{
\includegraphics[width=70px,height=60px]
{images/case3c.eps}}
}\

I also tried adding \thesubfigure and \addtocounter as per the link: Captioning nested subfigures with subcaption It produced captions (a), (b), (c) for the 3 subfigures. But it gives (d) to all the 3 sub-subfigures in case3.

\begin{figure}[H]
\centering
\subfigure[ ]{
\includegraphics[width=110px,height=85px]
{images/case1.eps}
\label{fig:case1}
}
\subfigure[ ]{
\includegraphics[width=110px,height=85px]
{images/case2.eps}
\label{fig:case2}
}
\subfigure[]{
\subfigure[]{
\renewcommand\thesubfigure{\alph{subfigure}1}
\includegraphics[width=70px,height=60px]
{images/case3a.eps}}
\subfigure[]{
\addtocounter{subfigure}{-1}
\renewcommand\thesubfigure{\alph{subfigure}2}
\includegraphics[width=70px,height=60px]
{images/case3b.eps}}
\subfigure[]{
\addtocounter{subfigure}{-1}
\renewcommand\thesubfigure{\alph{subfigure}3}
\includegraphics[width=70px,height=60px]
{images/case3c.eps}}
\addtocounter{subfigure}{-1}
}

1 Answer 1

3

You seem to use the subfigure package, were numbering works a little bit different than in the linked question.

\documentclass{article}

\usepackage[demo]{graphicx}
\usepackage{subfigure}
\usepackage[colorlinks]{hyperref}

\begin{document}

\begin{figure}[ht]
\centering
\subfigure[ ]{
  \includegraphics[width=110px,height=85px]
  {images/case1}
  \label{fig:case1}
}
\subfigure[ ]{
  \includegraphics[width=110px,height=85px]
  {images/case2}
  \label{fig:case2}
}
\subfigure[]{
  \setcounter{subfigure}{0}
  \renewcommand\thesubfigure{(\roman{subfigure})}
  \subfigure[]{
    \includegraphics[width=70px,height=60px]
    {images/case3a}}
  \subfigure[]{
    \includegraphics[width=70px,height=60px]
    {images/case3b}}
  \subfigure[]{
    \includegraphics[width=70px,height=60px]
    {images/case3c}}
  \label{fig:case3}
}
\caption{Main Figure}\label{fig}
\end{figure}

\ref{fig}, \ref{fig:case1}, \ref{fig:case2}, \ref{fig:case3}
\end{document}

sample output

To have the figures all in one row comment the trailing line ends. Then you can pull the first two subfigure captions deeper to align them with the third. This can be achieved by increasing \subfigcapskip.

\documentclass[a4paper,10pt]{article}

\usepackage[demo]{graphicx}
\usepackage{calc}
\usepackage{subfigure}
\usepackage[colorlinks]{hyperref}
\newlength{\addcapskip}%

\begin{document}

\begin{figure}[ht]
\centering
  \setlength{\addcapskip}{\subfigcapskip+9.5pt+\subfigbottomskip}%
  \addtolength{\subfigcapskip}{\addcapskip}%
  \subfigure[ ]{%
  \includegraphics[width=110px,height=85px]
  {images/case1}%
  \label{fig:case1}%
}%
\subfigure[ ]{%
  \includegraphics[width=110px,height=85px]
  {images/case2}%
  \label{fig:case2}%
}%
\addtolength{\subfigcapskip}{-\addcapskip}%
\subfigure[ ]{%
  \setcounter{subfigure}{0}%
  \renewcommand\thesubfigure{(\roman{subfigure})}%
  \subfigure[]{%
    \includegraphics[width=70px,height=60px]
    {images/case3a}}%
  \subfigure[]{%
    \includegraphics[width=70px,height=60px]
    {images/case3b}}%
  \subfigure[]{%
    \includegraphics[width=70px,height=60px]
    {images/case3c}}%
  \label{fig:case3}%
}%
\caption{Main Figure}\label{fig}
\end{figure}

\ref{fig}, \ref{fig:case1}, \ref{fig:case2}, \ref{fig:case3}
\end{document}

output with figures in a row

One final remark: the subfigure package is superseded by the subfig package, and both are no longer maintained. Currently, your best choice is the subcaption package. So if this is a new project, consider switching your tools.

3
  • One more question... suppose I want all of them to appear in one row. I can do so by removing the command \centering. But, in that case, I need to raise the images c(i), c(ii) and c(iii) up by a centimeter or so. How can I raise the figures?
    – Swagatika
    Apr 22, 2013 at 11:07
  • 1
    You don't need to remove \centering, just remove spaces. Put % after each closing } of a subfigure, after the opening { of a subfigure, and so on. Then you will get one row of pictures, but note that the widths already sum to 430px.
    – mafp
    Apr 22, 2013 at 11:18
  • yes, this works and this way I can get rid of the space between images too. But how can I raise the images up so that all 5 images will look aligned?
    – Swagatika
    Apr 22, 2013 at 11:23

You must log in to answer this question.

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