我有 110 张图像,我已使用 10*11 形式的子图排列它们。
在每一行中,我想为每个第一张图片添加标题,如 (A) (B) 等等。我使用了 \usepackage{caption,subcaption},但没有成功。它给出了以下错误:
! Package subcaption Error: This package can't be used in cooperation(subcaption) with the subfigure package.
代码如下:
`
\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}}}
`
还有其他方法可以做这样的事情吗?
更具体地说,我试图实现图 5 中所示的这纸。
答案1
编写自己的环境并不太难,而不必调整软件包。首先,我建议定义一个单独的命令来加载图像,该命令负责调整图像的大小、格式和定位。
\usepackage{graphicx}
\newcommand\img[1]%
{\raisebox
{\dimexpr-0.5\height+0.5ex}%
{\includegraphics[width=10mm]{#1}}%
}
要获取图中标记的图像行,请使用
\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}
这需要在序言中做出以下定义:
% 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})}\
}
\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}