我插入了四幅图,一张一张。然后我添加了一段内容。但是我发现这些图之间有一个段落 - 先是两幅图,然后是一段,然后是一幅图。我该如何让这些图的位置保持在正确的位置?
我的代码是这样的:
\documentclass{article}
\usepackage{subfigure}
\begin{document}
\begin{figure}[hbtp]
\centering
\includegraphics[scale=1]{C:/Users/tr/Pictures/Experiment1.png}
\caption{First Time Experiment}
\end{figure}
\begin{figure}[hbtp]
\centering
\includegraphics[scale=1]{C:/Users/tr/Pictures/Experiment2.png}
\caption{Second Time Experiment}
\end{figure}
\begin{figure}[hbtp]
\centering
\includegraphics[scale=1]{C:/Users/tr/Pictures/Experiment3.png}
\caption{Third Time Experiment}
\end{figure}
\begin{figure}[hbtp]
\centering
\includegraphics[scale=1]{C:/Users/tr/Pictures/Experiment4.png}
\caption{Fourth Time Experiment}
\end{figure}
As the figures do, the researcher observes the following principles: ajie%
As the figures do, the researcher observes the following principles: ajie%
As the figures do, the researcher observes the following principles: ajie%
As the figures do, the researcher observes the following principles: ajie\\%\
\end{document}
答案1
快速修复:使用h!
第 4(和第 5、第 6、...)figure
环境的选项。
答案2
我不清楚这四个图表是否应该垂直堆叠,或者两个图表是否应该彼此相邻;您发布的草图似乎建议后者。
如果两个数字可以并排放置,我建议你使用单身的 figure
环境,有四个minipage
环境,大小为包含一个图和一条\caption
指令。请注意,无需加载该subfigure
包(无论如何,该包早已被弃用,不应再使用)。
\documentclass{article}
\usepackage[demo]{graphicx} % don't use "demo" option in real document
\begin{document}
\begin{figure}
\begin{minipage}{0.45\textwidth}
\includegraphics[width=\linewidth]{C:/Users/tr/Pictures/Experiment1.png}
\caption{First Time Experiment}
\end{minipage}
\hspace{\fill} %% no blank line before of after this instruction
\begin{minipage}{0.45\textwidth}
\includegraphics[width=\linewidth]{C:/Users/tr/Pictures/Experiment2.png}
\caption{Second Time Experiment}
\end{minipage}
\vspace{0.75cm}
\begin{minipage}{0.45\textwidth}
\includegraphics[width=\linewidth]{C:/Users/tr/Pictures/Experiment3.png}
\caption{Third Time Experiment}
\end{minipage}
\hspace{\fill} %% no blank line before of after this instruction
\begin{minipage}{0.45\textwidth}
\includegraphics[width=\linewidth]{C:/Users/tr/Pictures/Experiment4.png}
\caption{Fourth Time Experiment}
\end{minipage}
\end{figure}
As the figures do, the researcher observes the following principles: ajie%
As the figures do, the researcher observes the following principles: ajie%
As the figures do, the researcher observes the following principles: ajie%
As the figures do, the researcher observes the following principles: ajie\\%\
\end{document}
另一方面,如果四个图表需要垂直堆叠,并且四个图表及其标题都可以放在一页上,我仍然建议您使用单一figure
环境。请注意,LaTeX 几乎肯定会将如此高的图表figure
单独放在一页上。
\documentclass{article}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}
\centering
\includegraphics[scale = 1]{C:/Users/tr/Pictures/Experiment1.png}
\caption{First Time Experiment}
\vspace{0.75cm}
\includegraphics[scale = 1]{C:/Users/tr/Pictures/Experiment2.png}
\caption{Second Time Experiment}
\vspace{0.75cm}
\includegraphics[scale = 1]{C:/Users/tr/Pictures/Experiment3.png}
\caption{Third Time Experiment}
\vspace{0.75cm}
\includegraphics[scale = 1]{C:/Users/tr/Pictures/Experiment4.png}
\caption{Fourth Time Experiment}
\end{figure}
\end{document}