[Tex/LaTex] Break box (a long caption) over pages

boxescaptionsfloatspage-breakingwidth

I want to have text of a certain width less than the page width, which goes across several pages. Normally you’d put text into a (\par)box to set its width but these boxes cannot be broken across pages so I can’t use it here.

I tried looking at the internal definition of \parbox (more precisely \@iiiparbox) but I cannot make heads nor tails of it – it doesn’t look like it can be adapted to allow page breaks, though.

Background:

The reason I want to do this is that I have a figure caption (which is centered and of a given text width) and is too long for the page and thus cut off. There are numerous questions about how to solve this (e.g. Break figure description over two pages) but none offers an actual solution to the problem.

For now I’ve simply opted out of using a float and use the following instead:

\begin{center}
    \includegraphics
    \captionof{figure}{looooong caption}
\end{center}

… but that always puts the figure caption on the next page in its entirety, rather than breaking it. (Locally) redefining \@iiiparbox makes it possible to break the figure caption across pages smoothly but then the figure caption takes up the complete page width which is undesired.

Best Answer

The default definition of \caption in article and the other standard classes is not boxed if the caption is more than a line. To change the effective line width you should use quote (or an environment with similar definition) which is

\newenvironment{quote}
               {\list{}{\rightmargin\leftmargin}%
                \item\relax}
               {\endlist}

Which just accepts the default increase of \leftmargin and makes \rightmargin the same. You can set the two margins explicitly to any appropriate value in the definition of a custom environment to wrap the caption

\begin{center}
\includegraphics

\nopagebreak
\begin{quote}
\captionof{figure}{looooong caption}
\end{quote}
\end{center}
Related Question