LaTeX forum ⇒ Graphics, Figures & TablesHow to allow caption break into two pages

Information and discussion about graphics, figures & tables in LaTeX documents.
tamarf
Posts: 4
Joined: Sun Sep 06, 2009 3:34 pm

How to allow caption break into two pages

Postby tamarf » Sun Sep 06, 2009 3:59 pm

Hi,

I have a big figure with a very long caption. Together they require more than one page.
Then, Latex only shows part of the caption, and the figure + caption together are pushed to the end of the chapter.

Is it possible to break the caption into multiple pages? If not, is it at least possible to have the figure and caption at adjacent pages?

Anyone has an idea?

Thanks,
Tamar.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

How to allow caption break into two pages

Postby localghost » Sun Sep 06, 2009 4:12 pm

Perhaps the fltpage package can offer an acceptable solution.


Best regards and welcome to the board
Thorsten
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

tamarf
Posts: 4
Joined: Sun Sep 06, 2009 3:34 pm

How to allow caption break into two pages

Postby tamarf » Mon Sep 07, 2009 1:27 pm

Thanks for the idea - but it didn't work in my case.

I have 3 subfigures inside the figure environment (see code below).
Before, they were typeset one above the other.
Now with the fltpage they are typeset side by side, so the first one appears fully, the second one is truncated and the third does not appear at all.

I've searched the forum and found a related old post, suggesting the usage of \afterpage - which didn't work either (see http://www.latex-community.org/forum/vi ... page#p8076).

Then I received the error message "if\@captype
topcap
1.258 \begin{align}
?"

Here is a sample of my original code:
\begin{figure}[t!]
\centering
\subfigure[]{
\includegraphics[width=10cm]{subfig1.eps}
\label{fig:subfig1} }
\subfigure[]{
\includegraphics[width=10cm]{subfig2.eps}
\label{fig:subfig2} }
\subfigure[]{
\includegraphics[width=10cm]{subfig3.eps}
\label{fig:subfig3} }
 \caption [blah]
 { \label{fig:fullfig} blah blah blah   \subref{fig:subfig1}
   blah blah     \subref{fig:subfig2} blah blah
}
\end{figure}


Is there a way to use subfigures and still force the caption to continue on the next page?

Thanks a lot,

Tamar.

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How to allow caption break into two pages

Postby gmedina » Mon Sep 07, 2009 4:31 pm

Hi Tamar,

in the example code below I show one possibility. The idea is to use some of the features provided by the subfig and caption packages (by the way, I noticed from your code that you are using the obsolete subfigure package; you should use subfig instead).

Now, to the code: the idea is to use a "continued float": the first part of the float will contain the three subfigures and the second part, the caption.

The three subfigures are placed inside a standard figure environment whose label format is declared empty to suppress the label produced by the corresponding \caption command; then a second figure environment is used to continue the previous one and to typeset the caption. A new type of caption label was defined also, in order to emulate the style produced by the fltpage package.

Remarks: 1) I used the demo option for the graphicx package to make the code compilable for everyone (figures will be replaced by black rectangles). Please delete that option in your actual code.
2) Feel free to adapt my example according to your needs.
3) Please make sure that you have installed a recent version of the caption package.

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{caption}
% the following format will be used to emulate the captions produced by fltpage
\DeclareCaptionLabelFormat{adja-page}{\hrulefill\\#1 #2 \emph{(previous page)}}
\usepackage{subfig}

\begin{document}

\begin{figure}
  \captionsetup{labelformat=empty}
  \centering
  \subfloat[][]{\includegraphics[width=10cm]{subfig1.eps}}\\
  \subfloat[][]{\includegraphics[width=10cm]{subfig1.eps}}\\
  \subfloat[][]{\includegraphics[width=10cm]{subfig1.eps}}
  \caption{}
\end{figure}
\clearpage
\begin{figure}
  \captionsetup{labelformat=adja-page}
  \ContinuedFloat
  \caption{three subfigures text text text text text text text text text text text text text text text text
  text text text text text text text text text text text text text text text text text text text text text text
  text text text text text text text text text text text text text text text text text text text text text text
  text text text text text text text text text text text text text text text text text text text text text text
  text text text text text text text text text text text text text text text text text text text text text text
  text text text text text text text text text text text text text text text text text text text text text text
  text text text text text text text text text text text text text text text text text text text text text text}
  \label{fig:test}
\end{figure}
\clearpage

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...

tamarf
Posts: 4
Joined: Sun Sep 06, 2009 3:34 pm

How to allow caption break into two pages

Postby tamarf » Mon Sep 07, 2009 5:48 pm

It works - Thanks!

Just one more thing: I'd like to refer to the subfigures in this caption, but if I use \subref it produces the error message
"! Argument of \@caption has an extra }"

I can use \ref, but then the label I get is "1a", rather than "a".

Here is the code I used (adapted from yours):

\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
% the following format will be used to emulate the captions produced by fltpage
\DeclareCaptionLabelFormat{adja-page}{\hrulefill\\#1 #2 \emph{(previous page)}}
\usepackage{subfig}

\begin{document}

\begin{figure}
  \captionsetup{labelformat=empty}
  \centering
  \subfloat[][]{\includegraphics[width=10cm]{subfig1.eps}\label{fig:sub1}}\qquad
  \subfloat[][]{\includegraphics[width=10cm]{subfig2.eps}\label{fig:sub2}}\qquad
  \subfloat[][]{\includegraphics[width=10cm]{subfig3.eps}\label{fig:sub3}}
  \caption{}
\end{figure}
\clearpage
\begin{figure}
  \captionsetup{labelformat=adja-page}
  \ContinuedFloat
  \caption{three subfigures \subref{fig:sub1} text text text text text text text text text text text text text text text text
  text text text text text text text text text text text text text text text text text text text text text text
  text text text text text text text text text text text text text text text text text text text text text text
  text text text text text text text text text text text text text text text text text text text text text text
  text text text text text text text text text text text text text text text text text text text text text text
  text text text text text text text text text text text text text text text text text text text text text text
  text text text text text text text text text text text text text text text text text text text text text text}
  \label{fig:test}
\end{figure}
\clearpage

\end{document} 


Tamar.

User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

How to allow caption break into two pages

Postby sommerfee » Mon Sep 07, 2009 9:31 pm

There is a bug in the latest version of the subfig package which causes that \subref is fragile. So either use \protect\subref instead of \subref or add the following code to your document after loading the subfig package:
\makeatletter
\DeclareRobustCommand*\subref{\@ifstar\sf@@subref\sf@subref}
\makeatother

A third option would be updating your caption package. Since version 3.0k it contains a workaround for this bug so the above patch isn't necessary anymore.

tamarf
Posts: 4
Joined: Sun Sep 06, 2009 3:34 pm

Re: How to allow caption break into two pages

Postby tamarf » Tue Sep 08, 2009 3:06 pm

It's working - thanks everyone for the help!
:D


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 5 guests