# Split caption based on a height?

I have a full page figure, like 8.5x11 full, not just full text area.

I add the figure by doing the following:

\begin{figure}[p]
\vspace*{-1.0in}

\makebox[\textwidth]{\includegraphics{../02_Figures/IntroductionChapter/Fig01.pdf}}
\vspace*{-2.0in}
\caption{Long long caption here. }

\end{figure}


The figure ads fine, and is centered in the page as I need.

The caption gets moved up, but it is very long, so I need it to split over the next page. I tried using the caption package and \ContinuedFloat

\begin{figure}[b]\ContinuedFloat
\caption{More of long caption here}
\end{figure}


1) This requires me manually split the caption, which is a little tedius as I have nearly 100 figures. Is there any way to set a 'caption height' so it automatically splits between the first and continued caption based on a parameter I give? Like after 3 lines split? Or after 0.75 in, split to the next continued float?

2) Can I get the second caption in the continued float to have a little line above it like happens when using \footnote{} ?

EDIT

I believe I have a MWE that indicates what is going on.

\documentclass[12pt]{report}
\usepackage{blindtext}
\usepackage{graphicx}

%   Page Captioning
\usepackage[font=footnotesize]{caption}
\DeclareCaptionLabelFormat{continued}{#1 ˜#2 (cont.)} % Define a 'continued' label. Then what the label should look like
\captionsetup[ContinuedFloat]{labelformat=continued} % Now use that label format for captions of continued floats

%
%   Page Margins and Page Layout
%
\usepackage[letterpaper]{geometry}

% Make new variables for what the margins will be.
\newcommand{\pageMargin}{1.0in}
\newcommand{\pageMarginLeft}{1.5in}

%For now, figure vertical offsets just match \pageMargin. And each figure needs to make it's own margin. This could be adjusted to something else though
\newcommand{\fullFigVOffset}{\pageMargin}

% Define page geometry
\geometry{margin=\pageMargin}

%   Page Spacing
\usepackage{setspace}
\doublespacing

\begin{document}

\chapter{Introduction}

\blindtext[5]
\begin{figure}[p]
\vspace*{-\fullFigVOffset} % Note the negative

\makebox[\textwidth]{\includegraphics[height=11in]{example-image}}

\vspace*{-\fullFigVOffset} %
\vspace*{-\fullFigVOffset} %

\caption{\blindtext[3]}

\label{GInt_01} % Label must come after figure Caption to reference correctly

\end{figure}

\begin{figure}[b]\ContinuedFloat
\caption{I want the caption above to split at the 'regular' page margins to here.}
\end{figure}

\blindtext[6]

\end{document}


Cropping the figure down is going to be difficult. As these are shared figures, and that would require keeping two versions, as others will require the full page figure for what they do.

Also, cropping doesn't really seem to solve my problem anyway, it just allows me to get rid of the (-) vspace to move the caption up. The caption is still too long for the page and would need to be split.

• isn't it simple make image smaller? and show complete small document which demonstrate your problem. for image use \includegraphics[width=\text width,height=<size, which is not known to us>]{example-image-a};. welcome to tex.se – Zarko Feb 23 '18 at 13:14
• If it is really a full page, you could use afterpage and pdfpage for the figure and put the caption in a top float for the next page. But if you can fit part of the caption on the page, you must have a lot of white space and should do some cropping. Personally, I would use an image editor to crop. – John Kormylo Feb 23 '18 at 14:01
• BTW, if you want some help, you should provide a Minimal Working Example using example-image or \rule instead of some file we do not have. – John Kormylo Feb 23 '18 at 14:09
• @JohnKormylo There is enough whitespace for a couple lines of the legend, yes. But \ContinuedFloat makes me choose where to split the legend. I'd like to have it automatically split the legend at the margins (or some other defined point). That way if I change layout in the future, I don't have to come back and re-split the caption for each figure based on new margins. – Nertskull Feb 23 '18 at 14:11
• see if the tikz package and its ability to absolute positioning image/text on page can help you. anyway, image covered by text (caption)? this probably has some sense for cover page, but not in the middle of the text. – Zarko Feb 23 '18 at 15:07

The caption itself cannot be broken, so I split the contents instead. This means the Figure 1.1 and Figuere 1.1 (cont.) must be placed on a separate line from the contents. I adjusted the length to include this line and \abovecaptionskip.

\documentclass[12pt]{report}
\usepackage{blindtext}
\usepackage{graphicx}

%   Page Captioning
\usepackage[font=footnotesize,labelsep=newline]{caption}
\DeclareCaptionLabelFormat{continued}{#1 ˜#2 (cont.)} % Define a 'continued' label. Then what the label should look like
\captionsetup[ContinuedFloat]{labelformat=continued} % Now use that label format for captions of continued floats

\renewcommand{\bottomfraction}{0.7}% for VERY large bottom floats

\newsavebox{\splitbox}
\newsavebox{\contbox}

\newcommand{\splitcaption}[3][\empty]% #1 = short caption (optional), #2 = caption, #3 = length before split
{\bgroup
\footnotesize
\setbox0=\vbox{#2}%
\dimen0=#3\relax
\setbox1=\vsplit0 to \dimen0
\global\setbox\splitbox=\box1
\global\setbox\contbox=\box0
\egroup
\ifx\empty#1\relax
\caption[#2]{\usebox\splitbox}%
\else
\caption[#1]{\usebox\splitbox}%
\fi}

\newcommand{\contcaption}{\ifdim\ht\contbox>0pt
\begin{figure}[b]\ContinuedFloat
\footnoterule
\caption[]{\usebox\contbox}% no entry in LOF
\end{figure}
\fi}

%
%   Page Margins and Page Layout
%
\usepackage[letterpaper]{geometry}

% Make new variables for what the margins will be.
\newcommand{\pageMargin}{1.0in}
\newcommand{\pageMarginLeft}{1.5in}

%For now, figure vertical offsets just match \pageMargin. And each figure needs to make it's own margin. This could be adjusted to something else though
\newcommand{\fullFigVOffset}{\pageMargin}

% Define page geometry
\geometry{margin=\pageMargin}

%   Page Spacing
\usepackage{setspace}
\doublespacing

\begin{document}
\listoffigures

\ref{GInt_01}

\chapter{Introduction}

\blindtext[5]
\begin{figure}[p]
\vspace*{-\fullFigVOffset} % Note the negative

\makebox[\textwidth]{\includegraphics[height=11in]{example-image}}

\vspace*{-\fullFigVOffset} %
\vspace*{-\fullFigVOffset} %

\splitcaption[short caption]{\blindtext[3]}{1in}
\label{GInt_01}% Label must come after figure Caption to reference correctly
\end{figure}
\contcaption

\blindtext[6]

\end{document}

• This is pretty great. I've been messing with it for a bit now, and there appears to just be one problem. I can't reference the label any more. \ref{GInt_01} now returns ?? instead of the figure number. I've been trying to mess with your code to figure it out, but this is my first foray into latex and I'm not having success. But other than that, this works GREAT. Any way to make referencing work? – Nertskull Feb 23 '18 at 17:34
• Sorry about that. I had to move the \caption outside the group. \@currentlabel is set locally, not globally. – John Kormylo Feb 24 '18 at 4:15
• Perefect. And better than my solution. I tried adding a 4th argument and adding the label manually in each if..else section. It worked, but then my editor (texstudio) didn't recognize them as a label. Your way allows the \label to be used in the begin{figure} which seems better. Thanks so much for the help!. The figures are starting to go in with ease now. – Nertskull Feb 24 '18 at 12:47