我想在一页中插入两张图片。每张图片应展开为两列。到目前为止,我唯一能做的就是插入一张展开为两列的图片,但我不能放两张图片。
\documentclass[twocolumn]{article}
\usepackage{lipsum}
\usepackage{stfloats}
\begin{document}
\lipsum[1-5]
\begin{figure*}[t]
\centering\rule{0.8\textwidth}{0.3\textwidth}
\caption{A nice figure}
\end{figure*}
\lipsum[1-10]
\lipsum[1-5]
\begin{figure}[h]
\centering\rule{0.8\textwidth}{0.3\textwidth}
\caption{A nice figure}
\end{figure}
\lipsum[1-10]
\end{document}
答案1
这里subfig
使用包是因为我假设您希望在一页中显示两个图形,如标题所述。对于双列样式,您需要figure*
环境来解释为什么您的第二个图形无法正常工作。
代码
\documentclass[twocolumn]{article}
\usepackage{lipsum}
%\usepackage{stfloats}
\usepackage{subfig}
\begin{document}
\lipsum[1-5]
\begin{figure*}[t] % --- method 1, one figure environment. These can be arranged
\centering % horizonally (side by side) if ,say, 0.4\textwidth is used and \hfill is replaced by \quad instead.
\subfloat[figure 1]{\rule{0.8\textwidth}{0.3\textwidth}}\hfill
\subfloat[figure 2]{\rule{0.8\textwidth}{0.3\textwidth}}
\caption{A nice figure}
\end{figure*}
\begin{figure*}[t] % -- method 2, two figure environments
\centering
\subfloat{\rule{0.8\textwidth}{0.3\textwidth}}
\caption{A nice figure}
\end{figure*}
\begin{figure*}[t]
\centering
\subfloat{\rule{0.8\textwidth}{0.3\textwidth}}
\caption{A nice figure}
\end{figure*}
\lipsum[1-10]
\end{document}
编辑:原帖作者想在图片之间添加一些文字,因此multicol
建议在这种情况下使用。不是article
[twocolumn] 类。
\documentclass[]{article}
\usepackage{geometry}
\usepackage{multicol}
\usepackage{subfig}
\begin{document}
\begin{figure*}[t]
\centering
\subfloat{\rule{0.8\textwidth}{0.3\textwidth}}
\caption{A nice figure}
\end{figure*}
\begin{multicols}{2}
This is a sententence written between two figures.
This is a sententence written between two figures.
This is a sententence written between two figures.
This is a sententence written between two figures.
\end{multicols}
\begin{figure*}[h]
\centering
\subfloat{\rule{0.8\textwidth}{0.3\textwidth}}
\caption{A nice figure}
\end{figure*}
\end{document}