Latex 章节标题和图形不会打印在同一页上

Latex 章节标题和图形不会打印在同一页上

我正在尝试打印一个只有图片的部分(除了标题外没有文字)。我有一个图片,它显然不会占据一整页(最多占据半页),但出于某种原因,我的部分标题“模型拟合”位于页面顶部,然后在其下方为页面的其余部分留出完整的空白,然后在下一页上是我想要包含的图片。这是我为这一部分使用的完整命令(请注意,我有两个图片,但我不在乎第二个图片是否也占据了整页):

\FloatBarrier
\subsection{Model fitting}
\begin{figure}
\includegraphics[width=0.5\textwidth]{IRrelation_fitted.pdf}
\includegraphics[width=0.5\textwidth]{IRrelation_Logfitted.pdf}
\caption{(left) plot of the IR voltage output as a function of distance with the fitted curve plotted over it.(right) plot of the log of IR voltage as a function of the log distance with the fitted curve plotted over it}
\label{fig: IR relationship}
\end{figure}

\begin{figure}
\includegraphics[width=0.5\textwidth]{IRrelation_diag01.pdf}
\includegraphics[width=0.5\textwidth]{IRrelation_diag02.pdf}
\includegraphics[width=0.5\textwidth]{IRrelation_diag03.pdf}
\includegraphics[width=0.5\textwidth]{IRrelation_diag04.pdf}
\caption{Diagnostic plots for linear regression used on IR sensor data as a function of distance. \textbf{top left:} Plot of residuals \textbf{top right:} quantile plot of residuals \textbf{bottom left:} scale-location plot, \textbf{bottom right:} Cook's distance (influence)}
\label{fig: IR diagnostics}
\end{figure}
\FloatBarrier

答案1

没有任何文本,浮动行为看起来很奇怪,LaTeX 只是想让你的文档看起来漂亮。请参阅如何影响 LaTeX 中图形和表格等浮动环境的位置?作者:弗兰克·米特尔巴赫。

[!h]对于您的具体问题,我对两个浮点数都使用了位置说明符:

\FloatBarrier
\subsection{Model fitting}
\begin{figure}[!ht]
\includegraphics[width=0.5\textwidth]{IRrelation_fitted.pdf}
\includegraphics[width=0.5\textwidth]{IRrelation_Logfitted.pdf}
\caption{(left) plot of the IR voltage output as a function of distance with the fitted curve plotted over it.(right) plot of the log of IR voltage as a function of the log distance with the fitted curve plotted over it}
\label{fig: IR relationship}
\end{figure}
\begin{figure}[!ht]
\includegraphics[width=0.5\textwidth]{IRrelation_diag01.pdf}
\includegraphics[width=0.5\textwidth]{IRrelation_diag02.pdf}
\includegraphics[width=0.5\textwidth]{IRrelation_diag03.pdf}
\includegraphics[width=0.5\textwidth]{IRrelation_diag04.pdf}
\caption{Diagnostic plots for linear regression used on IR sensor data as a function of distance. \textbf{top left:} Plot of residuals \textbf{top right:} quantile plot of residuals \textbf{bottom left:} scale-location plot, \textbf{bottom right:} Cook's distance (influence)}
\label{fig: IR diagnostics}
\end{figure}
\FloatBarrier

给出输出:

LaTeX 输出

编辑:我刚刚看到附录开头的附加页包含大图有同样的问题。它提供了另一种解决方案,使用minipage

相关内容