我知道到处都有很多这样的问题,但我没有找到答案:我有一个里面有很多图的图(ae,在 MS powerpoint 中构建(不是在 latex 中))。这意味着我的标题很长,以至于它不适合一页,并且标题贯穿页码等。有没有简单的方法可以解决这个问题?
例子:
\documentclass[12pt,a4paper]{scrartcl}
\usepackage{graphicx}
\begin{document}
text text text
\begin{figure}
\includegraphics[width=1\textwidth]{file.png}
\caption[short]{damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption...}
\label{fig:file}
\end{figure}
\end{document}
谢谢你的帮助
答案1
使用\ContinuedFloat
caption 包可以手动将其拆分为两个。风险在于一个或两个浮标会改变位置,因此我强烈建议使用包[H]
中的键来固定它们的位置float
\documentclass[12pt,a4paper]{scrartcl}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{float}
\begin{document}
text text text
\begin{figure}[H]
\includegraphics[width=1\textwidth]{example-image}
\caption[short]{damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption...\\[0.2em]
continues on next page
}
\label{fig:file}
\end{figure}
\begin{figure}[H]
\ContinuedFloat
\caption[]{
continued from previous page\\[0.2em]
....caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption, damn long caption...}
\end{figure}
\end{document}
答案2
标题本身不能分割,但文本可以分割,至少在使用悬挂缩进时可以。
这是概念的演示。您可能希望将其转换为宏或环境,具体取决于您要如何处理图像、标题和短标题。
请注意,\vsplit
likes 使用\vbox
,而\caption
prefers 使用\vtop
。此外,的高度\captionsave
为 0pt,因此\raisebox
。
我应该感谢乔纳森\ContinuedFloat
。
\documentclass[12pt,a4paper]{scrartcl}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{blindtext}% MWE only
\newsavebox{\captionsave}
\begin{document}
\begin{figure}[p]
\sbox0{\includegraphics[width=1\textwidth]{example-image}}% measure height
\usebox0
\sbox1{\csname fnum@figure\endcsname :~}% caption label
\setlength{\dimen0}{\dimexpr \columnwidth-\wd1}% width of caption minus label
\setbox1=\vbox{\hsize=\dimen0
\blindtext[3]}% text part of caption
\dimen1=\dimexpr \textheight-\ht0-\abovecaptionskip-\belowcaptionskip\relax
\ifdim\dimen1<\ht1
\setbox2=\vsplit1 to \dimen1
\global\setbox\captionsave=\vtop{\unvbox1}%
\setbox0=\vtop{\unvbox2}%
\else
\setbox0=\vtop{\unvbox1}%
\global\setbox\captionsave=\box1 %empty
\fi
\caption[short caption]{\usebox0}
\label{fig:file}
\end{figure}
\ifdim\dp\captionsave>0pt
\begin{figure}[t]
\ContinuedFloat
\caption[]{\textbf{Continued...}\newline\raisebox{\ht\strutbox}{\usebox\captionsave}}
\end{figure}
\fi
\end{document}