I have found several questions on TeX.SE and elsewhere about making figure captions span multiple pages (e.g., How do I make figure captions span multiple pages?).
I gather that the caption
package puts the caption in unbreakable boxes.
Some answers recommend the use of the capt-of
package. capt-of
seems to work fine, but breaks caption
instances. So it seems that using capt-of
to enable long figure captions would require me to switch every single caption in my paper to capt-of
, which is a burden and seems to eliminate the benefits of floating figures.
Here's a MWE (also on Overleaf) with a figure with short caption
and a figure with a long captionof
. I would like to be able to have both \usepackage{capt-of}
and
\usepackage[font={small,sf}, singlelinecheck=false]{caption}
enabled, and still have my long caption span multiple pages.
\documentclass{article}
% I can't have both caption and capt-of enabled.
% Caption alone doesn't let long captions span multiple pages.
\usepackage[font={small,sf}, singlelinecheck=false]{caption}
% Capt-of alone would require me to reformat many figures.
\usepackage{capt-of}
% But enabling both breaks capt-of's ability to span captions across pages.
\usepackage{lipsum}
\begin{document}
\lipsum[1]
% I have many figures that are formatted like this.
\begin{figure}[h!]
\centering
\rule{0.3\textwidth}{0.3\textheight}
\caption[Short caption]{\lipsum[1]}
\end{figure}
\lipsum[1-10]
% This seems to be the best way to get long captions to span multiple pages, while being styled like the above figure.
\begin{centering}
\sffamily
\rule{0.5\textwidth}{0.75\textheight}
\captionof{figure}[short caption]{\lipsum[1-4]}
\label{figure}
\end{centering}
\end{document}
Alternatively, some way to easily allow caption
s to span pages without having to re-format would be great.
Best Answer
You don't need the
capt-of
package which is just one line and the same definition is incaption
however caption boxes the caption text so if you want it to break you need to unbox it: