1

I have a 110 images which I have arranged using subfigures in the form of 10*11.

In each row, I want to put the caption for every first image like (A) (B) and so on. I have used \usepackage{caption,subcaption} but it didn't work out. It gives the following error:

! Package subcaption Error: This package can't be used in cooperation(subcaption) with the subfigure package.

The code is as follows:

`

\documentclass[runningheads]{llncs}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{amsmath,amssymb} % define this before the line numbering.
\usepackage{ruler}
\usepackage{color}
\usepackage{xcolor}
\usepackage{caption}
\captionsetup[subfigure]{labelformat=parens,labelsep=space,font=small}
\usepackage{subfigure}
\usepackage{floatrow}
\usepackage{adjustbox}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{url}
\usepackage{sidecap}
\usepackage[width=122mm,left=12mm,paperwidth=146mm,height=193mm,top=12mm,paperheight=217mm]{geometry}
\newcommand{\cfbox}[2]{%
    \colorlet{currentcolor}{.}%
    {\color{#1}%
    \fboxsep=0.1mm%padding thickness
    \fboxrule=1pt%border thickness
    \fbox{\color{currentcolor}#2}}%
}
\begin{figure*}[!t]
\centering
\subfigure{
\includegraphics[height=1cm,width=1cm]{figures/New_Figures/Figure_2-eps/main1.jpg}
\hspace{0.2cm}\cfbox{green}{\includegraphics[height=1cm,width=1cm]{figures/New_Figures/Figure_2-eps/1.jpg}}
\hspace{-0.2cm}\cfbox{green}{\includegraphics[height=1cm,width=1cm]{figures/New_Figures/Figure_2-eps/2.jpg}}
\hspace{-0.2cm}\cfbox{green}{\includegraphics[height=1cm,width=1cm]{figures/New_Figures/Figure_2-eps/3.jpg}}
\hspace{-0.2cm}\cfbox{green}{\includegraphics[height=1cm,width=1cm]{figures/New_Figures/Figure_2-eps/4.jpg}}
\hspace{-0.2cm}\cfbox{green}{\includegraphics[height=1cm,width=1cm]{figures/New_Figures/Figure_2-eps/5.jpg}}
\hspace{-0.2cm}\cfbox{green}{\includegraphics[height=1cm,width=1cm]{figures/New_Figures/Figure_2-eps/6.jpg}}
\hspace{-0.2cm}\cfbox{green}{\includegraphics[height=1cm,width=1cm]{figures/New_Figures/Figure_2-eps/7.jpg}}
\hspace{-0.2cm}\cfbox{green}{\includegraphics[height=1cm,width=1cm]{figures/New_Figures/Figure_2-eps/8.jpg}}
\hspace{-0.2cm}\cfbox{green}{\includegraphics[height=1cm,width=1cm]{figures/New_Figures/Figure_2-eps/9.jpg}}
\hspace{-0.2cm}\cfbox{green}{\includegraphics[height=1cm,width=1cm]{figures/New_Figures/Figure_2-eps/10.jpg}}}

`

Is there any other method to do such thing ?

More specifically I am trying to achieve what's there in Fig 5 of this paper.

many faces

  • 3
    Seems you are loading obsolete package subfigure somewhere. You cannot use the up-to-date package subcaption in conjunction with the deprecated package subfigure. I would recommend to remove subfigure and change the usages of subfigure into corresponding usage of subcaption. – Schweinebacke Apr 6 '17 at 6:21
  • Welcome to TeX.SX!. Please note, we almost always need a minimal working example to reproduce and understand a problem and to test our own suggestions. Most questions without MWE are closed as unclear. – Schweinebacke Apr 6 '17 at 6:25
  • Sorry for not providing the MWE. Here's the snippet of the latex code. Actually in the first figure of the subfigure, I want to insert a letter like (a) to represent the whole row. I checked again the compatibility of the packages but don't know how it works. I will be glad if you could suggest some other alternative. – Ashutosh Mishra Apr 6 '17 at 6:38
1

Instead of tweaking packages it is not too difficult to write your own environment. First, I suggest to define a separate command for loading an image that takes care of sizing, formatting, and positioning the image.

\usepackage{graphicx}
\newcommand\img[1]%
  {\raisebox
    {\dimexpr-0.5\height+0.5ex}%
    {\includegraphics[width=10mm]{#1}}%
  }

To obtain labeled image rows in a figure, use

\begin{figure}
  \begin{imgrows}[...]% optional width, default is \textwidth
    \imgrow \label{...}% label for later reference
      \img{...} \img{...}\img{...}
    \imgrow \label{...}% label for later reference
      \img{...} \img{...}\img{...}
  \end{imgrows}
  \caption{...}% Caption of figure
\end{figure}

This requires the following definitions in the preamble:

% Defines an environment for labeled image rows
% \begin{imgrows}
%   \imgrow\label{...} images ...
%   \imgrow\label{...} images ...
% \end{imgrows}
% To be used inside a figure
\newcounter{row}
\renewcommand\therow{\thefigure\alph{row}}
\newenvironment{imgrows}[1][\textwidth]%
  {\begin{minipage}{#1}%
   \setcounter{row}{0}%
   \stepcounter{figure}%
  }%
  {\addtocounter{figure}{-1}%
   \end{minipage}%
  }
\newcommand\imgrow
  {\par\noindent
   \refstepcounter{row}%
   \makebox[1.5em][r]{(\alph{row})}\
  }

enter image description here

\documentclass{article}
\usepackage{graphicx}
\newcommand\img[1]%
  {\raisebox
    {\dimexpr-0.5\height+0.5ex}%
    {\includegraphics[width=10mm]{#1}}%
  }

% Defines an environment for labeled image rows
% \begin{imgrows}
%   \imgrow\label{...} images ...
%   \imgrow\label{...} images ...
% \end{imgrows}
% To be used inside a figure
\newcounter{row}
\renewcommand\therow{\thefigure\alph{row}}
\newenvironment{imgrows}[1][\textwidth]%
  {\begin{minipage}{#1}%
   \setcounter{row}{0}%
   \stepcounter{figure}%
  }%
  {\addtocounter{figure}{-1}%
   \end{minipage}%
  }
\newcommand\imgrow
  {\par\noindent
   \refstepcounter{row}%
   \makebox[1.5em][r]{(\alph{row})}\
  }
\begin{document}

\begin{figure}
\begin{imgrows}%
\imgrow\label{imgs:first}
  \img{example-image}
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%

\imgrow\label{imgs:second}
  \img{example-image}
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%

\imgrow\label{imgs:third}
  \img{example-image}
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
\end{imgrows}
\caption{Too many images}
\end{figure}

See rows \ref{imgs:first}, \ref{imgs:second}, and \ref{imgs:third},
but also \ref{imgs:fourth} and \ref{imgs:fifth}.
\begin{figure}
\begin{imgrows}%
\imgrow\label{imgs:fourth}
  \img{example-image}
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%

\imgrow\label{imgs:fifth}
  \img{example-image}
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
  \img{example-image-a}%
  \img{example-image-b}%
\end{imgrows}
\caption{Even more images}
\end{figure}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.