我正在使用 IEEEtrans 类,因此我有多列。正如您在我的输出中看到的,问题在于 latex 将所有五个子图放在同一列中,而不是将最后一个子图 fig:e 放在下一页。因此,fig:e 无法完全显示。其次,正如您所见,我的页面的左列完全是空的,我不明白为什么 latex 没有将前四个图(即 fig:a、b、c、d)放在左侧,然后将 fig:e 放在右侧,而这正是我想要做的。请帮忙。
\documentclass[journal]{IEEEtran}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[demo]{graphicx}
\usepackage[font = footnotesize]{caption}
%\usepackage[font=small,labelfont=bf]{caption}
\usepackage{caption}
\usepackage{gensymb}
\usepackage{subcaption}
\usepackage{float}
\usepackage{tabularx}
\begin{document}
\begin{figure}[H]
\centering
\captionsetup{justification=centering}
\begin{subfigure}[H]{0.5\textwidth}
\centering
\includegraphics[width=9.6cm,height=5.2cm]{a.JPG}
\caption{{\footnotesize fig:a}}
\end{subfigure}
\begin{subfigure}[H]{0.5\textwidth}
\centering
%\captionsetup{justification=centering,margin=1cm}
\includegraphics[width=9.6cm,height=5.2cm]{b.JPG}
\caption{{\footnotesize fig:b}}
\end{subfigure}
\begin{subfigure}[H]{0.5\textwidth}
\centering
%\captionsetup{justification=centering,margin=1cm}
\includegraphics[width=9.6cm,height=5.2cm]{c.JPG}
\caption{{\footnotesize fig:c}}
\end{subfigure}
\begin{subfigure}[H]{0.5\textwidth}
\centering
%\captionsetup{justification=centering,margin=1cm}
\includegraphics[width=9.6cm,height=5.2cm]{d.JPG}
\caption{{\footnotesize fig:d}}
\end{subfigure}
%\vspace{20mm}
\begin{subfigure}[H]{0.5\textwidth}
\centering
%\captionsetup{justification=centering,margin=1cm}
\includegraphics[width=9.6cm,height=5.2cm]{e.JPG}
\caption{{\footnotesize fig:e}}
\end{subfigure}
\caption{FIG}
\end{figure}
\end{document}
答案1
环境fakefigure
并不是漂浮的,而是让人\caption
觉得subfigure
它们处在一个figure
环境中。
我已将图片的宽度缩小到允许的最大宽度。顺便说一句,当图片填满整个宽度时,居中是没有意义的,而标题始终居中(除非 singlelinecheck=off)。
\documentclass[journal]{IEEEtran}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{gensymb}
\usepackage{subcaption}
\usepackage{float}
\usepackage{tabularx}
\makeatletter
\newenvironment{fakefigure}{\par\vskip\textfloatsep% minimum separation
\def\@captype{figure}%
\parindent=0pt
\parskip=0pt
\textwidth=\columnwidth
\clubpenalty0
\widowpenalty0}%
{\par\vskip\textfloatsep\vfil}% helps with alignment
\makeatother
\begin{document}
\begin{fakefigure}
\raggedbottom% esthetics
\begin{subfigure}{\columnwidth}
\centering
\includegraphics[width=\textwidth]{example-image}
\caption{{\footnotesize fig:a}}
\end{subfigure}
\begin{subfigure}{\columnwidth}
\centering
%\captionsetup{justification=centering,margin=1cm}
\includegraphics[width=\columnwidth]{example-image}
\caption{{\footnotesize fig:b}}
\end{subfigure}
\begin{subfigure}{\columnwidth}
\centering
%\captionsetup{justification=centering,margin=1cm}
\includegraphics[width=\columnwidth]{example-image}
\caption{{\footnotesize fig:c}}
\end{subfigure}
\begin{subfigure}{\columnwidth}
\centering
%\captionsetup{justification=centering,margin=1cm}
\includegraphics[width=\columnwidth]{example-image}
\caption{{\footnotesize fig:d}}
\end{subfigure}
%\vspace{20mm}
\begin{subfigure}{\columnwidth}
\centering
%\captionsetup{justification=centering,margin=1cm}
\includegraphics[width=\columnwidth]{example-image}
\caption{{\footnotesize fig:e}}
\end{subfigure}
\caption{FIG}
\end{fakefigure}
\end{document}