我有一个两列文档,其中显示了很多图表。我还必须显示一些跨两列的图表。
为了显示“正常”图形,我使用这段代码,例如:
\documentclass[conference]{IEEEtran}
\usepackage{subfig}
\usepackage{fixltx2e}
\usepackage{stfloats}
\begin{document}
\begin{figure}[!htb]
\centering
\subfloat[]{\includegraphics[width=0.49\linewidth]{figs/Case1/potential1_sd}} \hfill
\subfloat[]{\includegraphics[width=0.49\linewidth]{figs/Case1/potential2_sd}} \hfill
\subfloat[]{\includegraphics[width=\linewidth]{figs/Case1/sd_colorbar}}
\caption{}
\label{fig:case1_sd}
\end{figure}
\end{document}
将图形分成两列:
\begin{figure*}
\centering
\subfloat[]{\includegraphics[width=0.32\textwidth]{figs/Case1/potential1_feat}} \hfill
\subfloat[]{\includegraphics[width=0.32\textwidth]{figs/Case1/potential2_feat}} \hfill
\subfloat[]{\includegraphics[width=0.32\textwidth]{figs/Case1/sd_colorbar}}
\caption{}
\label{fig:case1_feat}
\end{figure*}
编辑:
问题似乎发生在这段代码上:
\begin{figure*}
\subfloat[Vector Field]{\includegraphics[width=.2\textwidth]{figs/Case1/quiver_vector_field}} \hfill
\subfloat[Curl-free Component]{\includegraphics[width=.2\textwidth]{figs/Case1/quiver_rotational_free}} \hfill
\subfloat[Divergence-free Component]{\includegraphics[width=.2\textwidth]{figs/Case1/quiver_divergence_free}} \hfill
\subfloat[Harmonic]{\includegraphics[width=.2\textwidth]{figs/Case1/quiver_harmonic}} \\
% If I comment this line, everything works. Can't I use two rows too?
\subfloat[]{\includegraphics[width=.5\textwidth]{figs/Case1/quiver_colorbar}}
\caption{Mean vector fields. The color bar represents the vectors magnitudes.}
\label{fig:case1_meanvecs}
\end{figure*}
如果我对其进行了注释,则其余的图形(包括使用上述代码显示的两列图形)都可以在文档中看到。
但是,当我启用第二段代码时,.tex 中的所有图形都消失了。我失去了引用,一切都消失了。我不知道我做错了什么。
先感谢您。
答案1
为了在(某些)子图之间获得换行符,只需在换行处提供一个空行 - 无需\\
。
顺便说一句,我不得不注释掉该指令\usepackage{stfloats}
才能编译你的代码。你真的需要这个包吗?
\documentclass[conference]{IEEEtran}
\usepackage[demo]{graphicx} % added to make your file compilable
\usepackage{subfig}
\usepackage{fixltx2e}
%\usepackage{stfloats}
\begin{document}
\begin{figure*}
\subfloat[Vector Field]{\includegraphics[width=.2\textwidth]{figs/Case1/quiver_vector_field}} \hfill
\subfloat[Curl-free Component]{\includegraphics[width=.2\textwidth]{figs/Case1/quiver_rotational_free}} \hfill
\subfloat[Divergence-free Component]{\includegraphics[width=.2\textwidth]{figs/Case1/quiver_divergence_free}} \hfill
\subfloat[Harmonic]{\includegraphics[width=.2\textwidth]{figs/Case1/quiver_harmonic}}
\subfloat[]{\includegraphics[width=.5\textwidth]{figs/Case1/quiver_colorbar}}
\caption{Mean vector fields. The color bar represents the vectors magnitudes.}
\label{fig:case1_meanvecs}
\end{figure*}
\end{document}