
我希望圖形標題出現在圖形本身上方。 KOMA-Script 文件似乎表明這可以透過設定選項來實現captions=heading
。但在下面的 MWE 中,第一個標題始終出現在圖像下方,第二個標題始終出現在圖像上方。
微量元素:
\documentclass[captions=heading]{scrartcl}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}
\includegraphics[width=0.7\linewidth]{image}
\caption{First caption (caption command below the figure)}
\end{figure}
\begin{figure}
\caption{Second caption (caption command above the figure)}
\includegraphics[width=0.7\linewidth]{image}
\end{figure}
\end{document}
輸出:
答案1
如果您閱讀了KOMA-腳本手冊第 128 頁,記錄了此行為:
請注意,這些選項僅會變更格式,而不變更標題的實際位置。標題是放置在浮動上方還是下方僅取決於您在浮動環境中使用 \caption 命令的位置。但是,當 float 套件與 \restylefloats 指令一起使用時,這種情況可能會改變(請參閱 [Lin01])。
要使用圖形上方的標題對浮動(如您所擁有的)進行排版,您需要將標題放置在浮動內部,但位於輸入圖形的行上方。caption=heading
提供格式設置,IE。標題下方有足夠的空間。
當這不可能時,您可以嘗試不使用浮動,而使用
\captionaboveof{float type}[entry]{title}
請參閱 KOMA 手冊第 132 頁,或者您可以嘗試漂浮-package 及其\restylefloat
命令。
\floatstyle{plaintop}
\restylefloat{figure}
如果您喜歡 KOMA 功能(您可能是),請使用
\floatstyle{komaabove}
\restylefloat{figure}
當使用此命令(和 scrhack)時,用於字體屬性、間距等的常用 KOMA 腳本命令可以工作,並且所有圖形最終都會出現在圖形列表中(如果您的文件中有此類列表)。完整的 MWE(scrhack
按照手冊中的建議加載:
\documentclass[captions=heading]{scrartcl}
\usepackage[demo]{graphicx}
\usepackage{float, scrhack} : KOMA-manual page 128
\floatstyle{komaabove}
\restylefloat{figure}
\begin{document}
\begin{figure}
\centering
\includegraphics[width=0.7\linewidth]{image}
\caption{First caption (caption command below the figure)}
\end{figure}
\begin{figure}
\centering
\caption{Second caption (caption command above the figure)}
\includegraphics[width=0.7\linewidth]{image}
\end{figure}
\end{document}