GeneralForce caption to continue on next page?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
jimbobnation
Posts: 1
Joined: Thu Jul 31, 2008 11:46 pm

Force caption to continue on next page?

Post by jimbobnation »

I have an extra large figure + long figure caption - they both don't fit on a single page. Is it possible to force the caption to stop within the bottom margin of the first page and continue (with the same caption format) on the following page? At this point, the caption continues down, overwrites the page number and off of the page.

Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Force caption to continue on next page?

Post by Juanjo »

Look at the following example:

Code: Select all

\documentclass{article}

\usepackage{afterpage}
\usepackage{nonfloat}
\usepackage{lipsum}

\begin{document}

\lipsum[1]

\afterpage{
  \centering
  \rule{0.85\textwidth}{0.85\textheight}
  \figcaption[Short caption text for the list of figures]{\lipsum[2-3]}
  \label{fig:f1}
  \vspace{\intextsep}
}

\lipsum[4-8]

\end{document}
The \lipsum command serves to generate (latin) dummy text. Likewise, the \rule command generates a black rectangle that represents your figure. To make it float to the "next" page, I use the \afterpage command, defined in the afterpage package. The \figcaption command is defined in the nonfloat package. In this example, the caption is formed by two paragraphs, genererated by \lipsum[2-3].

I've tried to use the caption package and \captionof instead of nonfloat and \figcaption, But it doesn't work, since, for some reason I ignore, \captionof produces a page break between the figure and the caption.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Force caption to continue on next page?

Post by sommerfee »

Juanjo wrote: I've tried to use the caption package and \captionof instead of nonfloat and \figcaption, But it doesn't work, since, for some reason I ignore, \captionof produces a page break between the figure and the caption.
The caption package puts the caption inside a \parbox so no page break can occur inside. One can change this, but would need redefinition of internal caption commands.

But since the nonfloat package change some LaTeX internals regarding floating environments (\textfraction, \topfraction, \bottomfraction, \floatpagefraction, \@fptop, \@fpsep, and \@fpbot), I would recommend the usage of the capt-of package and \captionof{figure} instead.

Regarding the original question: The fltpage package can split figure and caption in quite an elegant way, maybe this is an alternative to splitting the caption in parts.
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Force caption to continue on next page?

Post by Juanjo »

sommerfee wrote:
Juanjo wrote: I've tried to use the caption package and \captionof instead of nonfloat and \figcaption, But it doesn't work, since, for some reason I ignore, \captionof produces a page break between the figure and the caption.
The caption package puts the caption inside a \parbox so no page break can occur inside. One can change this, but would need redefinition of internal caption commands.
So, for a long caption, since no pagebreak can occur inside the caption and there is no room in the same page of the picture to typeset the caption, there is a pagebreak between picture and caption, which finally appear in separate pages. All clear now, thanks.
sommerfee wrote: But since the nonfloat package change some LaTeX internals regarding floating environments (\textfraction, \topfraction, \bottomfraction, \floatpagefraction, \@fptop, \@fpsep, and \@fpbot), I would recommend the usage of the capt-of package and \captionof{figure} instead.
I agree.
sommerfee wrote: Regarding the original question: The fltpage package can split figure and caption in quite an elegant way, maybe this is an alternative to splitting the caption in parts.
If I've understood its documentation, this package always writes the picture in one page and the caption in a different one (just before or just after, depending on package options). The caption is not splitted and so this package seems unable to solve the issue in the O.P.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
Post Reply