\fbox 不适用于图像

\fbox 不适用于图像

我使用托盘在图像列表上添加边框,\fbox但没有作用。

我的代码:

\documentclass[conference]{IEEEtran}
\usepackage{graphicx}
    \begin{figure}[!h]
    \centering
    \fbox{
      \mbox{\subfigure[Frame 1]{\includegraphics[width=4cm]{im1.png}}
             \subfigure[Foreground silhouette 1]{\includegraphics[width=4cm]{im2.png}}}\\
            \mbox{ \subfigure[Foreground silhouette 1]{\includegraphics[width=4cm]{im3.png}}
             \subfigure[Foreground silhouette 1]{\includegraphics[width=4cm]{im4.png}}}\\
              \mbox{\subfigure[Frame 1]{\includegraphics[width=4cm]{im5.png}}
                     \subfigure[Foreground silhouette 1]{\includegraphics[width=4cm{im6.png}}}\\                    
                      \mbox{\subfigure[Foreground silhouette 1]{\includegraphics[width=4cm{im7.png}}
                     \subfigure[Foreground silhouette 1]{\includegraphics[width=4cm]{im8.png}}
                     } 
                    }

     \caption{cc.} 
     \label{fbox}
    \end{figure}
\end{document}

我收到此错误Something's wrong--perhaps a missing \item. }。当我删除 \fbox 时,一切正常。谢谢您的帮助。

答案1

要使每个子图都被框架包围,请将其放置\fbox在内部\subfigure

\documentclass{IEEEtran}
\usepackage{subfigure}
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure}
\centering
\subfigure[Frame 1]{\fbox{\includegraphics[width=4cm]{im1.png}}}
\subfigure[Foreground silhouette 1]{\fbox{\includegraphics[width=4cm]{im2.png}}}\\
\subfigure[Foreground silhouette 1]{\fbox{\includegraphics[width=4cm]{im3.png}}}
\subfigure[Foreground silhouette 1]{\fbox{\includegraphics[width=4cm]{im4.png}}}\\
\subfigure[Frame 1]{\fbox{\includegraphics[width=4cm]{im5.png}}}
\subfigure[Foreground silhouette 1]{\fbox{\includegraphics[width=4cm]{im6.png}}}\\                    
\subfigure[Foreground silhouette 1]{\fbox{\includegraphics[width=4cm]{im7.png}}}
\subfigure[Foreground silhouette 1]{\fbox{\includegraphics[width=4cm]{im8.png}}}
\caption{cc.} 
\label{fbox}
\end{figure}

\end{document}

在此处输入图片描述

如果只拥有一个框架,你可以执行以下操作:

\documentclass{IEEEtran}
\usepackage{subfigure}
\usepackage{varwidth}
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure}[!h]
\centering
\fbox{%
\begin{varwidth}{\linewidth}
\subfigure[Frame 1]{\includegraphics[width=4cm]{im1.png}}
\subfigure[Foreground silhouette 1]{\includegraphics[width=4cm]{im2.png}}\\
\subfigure[Foreground silhouette 1]{\includegraphics[width=4cm]{im3.png}}
\subfigure[Foreground silhouette 1]{\includegraphics[width=4cm]{im4.png}}\\
\subfigure[Frame 1]{\includegraphics[width=4cm]{im5.png}}
\subfigure[Foreground silhouette 1]{\includegraphics[width=4cm]{im6.png}}\\                    
\subfigure[Foreground silhouette 1]{\includegraphics[width=4cm]{im7.png}}
\subfigure[Foreground silhouette 1]{\includegraphics[width=4cm]{im8.png}}
\end{varwidth}}
\caption{cc.} 
\label{fbox}
\end{figure}

\end{document}

在此处输入图片描述

选项demo只是graphicx用黑色矩形替换实际图形;不是在实际文档中使用该选项。

如果同一行上的图像太近,您可以使用\quad在它们之间添加一些间距。

顺便说一句,subfigure已经过时了;也许你应该考虑使用subfig或者subcaption。此外,[!h]可能限制性太强;请尝试使用更方便的选项[!ht]或不使用任何选项。

相关内容