
figure
在意外情況下,我在使用並subfigure
為我的圖形(即頂部一個圖形和底部兩個圖形)創建 2 x 1 環境時遇到以下錯誤。
文件已成功生成,我的圖形清晰地適合單個頁面,我甚至可以在視覺上確認這一點,即頁面仍然有很多空白空間!但我還是想明白為什麼會產生這個錯誤。
輸入行 58 上的浮點數對於頁面來說太大了 14.86864pt。
這是我正在使用的程式碼區塊:
\documentclass[12pt,a4paper,oneside,pdftex]{report}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}[htbp!]
\centering
\begin{subfigure}[b]{1\linewidth}
\includegraphics[width=\linewidth]{files/Feb1.pdf}
\caption{No. 1 }
\end{subfigure}
\begin{subfigure}[b]{0.4\linewidth}
\includegraphics[width=\linewidth]{files/Feb2.pdf}
\caption{No. 2 }
\end{subfigure}
\begin{subfigure}[b]{0.4\linewidth}
\includegraphics[width=\linewidth]{files/Feb3.pdf}
\caption{No. 3 }
\end{subfigure}
\caption{\textit{40 characters here in the original version} 544 characters here}
\label{fig:thesefiguresdonotmatter}
\end{figure}
\end{document}
我已經嘗試過:
- 消除
\centering
- 刪除
[htbp!]
(第一行) - 刪除
[b]
(命令旁邊的那些subfigure
)
答案1
如果浮動延伸到頁腳區域,則浮動仍然太大。
showframe
可以透過package選項使頁面佈局可見geometry
。新增此選項,或如果未使用該包,則新增:
\usepackage[pass, showframe]{geometry}% pass does not change the layout
下面定義的巨集\DebugBox
將尺寸列印到控制台和.log
檔案並新增邊框。邊框線放在盒子內部,以防止有邊框的盒子變大。
\newcommand*{\DebugBox}[1]{%
\begingroup
\sbox0{#1}%
\typeout{\string\DebugBox: wd=\the\wd0, ht=\the\ht0, dp=\the\dp0}%
\setlength{\fboxrule}{.1pt}% thin border line
\setlength{\fboxsep}{-\fboxrule}% border line inside
\fbox{\box0}%
\endgroup
}
巨集\DebugBox
可以像這樣使用\mbox
,例如:
\DebugBox{\includegraphics[width=\linewidth]{files/Feb1.pdf}}