I am currently writing my PHD thesis and I often have large images (filling 30-50% of a page) with very long captions (also 30-50% of page length) within the text. The problem is, that latex is not capable by default to continue the caption text on the next page. Instead, the caption text just runs across the end of the current page.
The following minimal example shows the issue.
\RequirePackage{fix-cm}
\documentclass[a4paper,twoside,openright,headsepline,parskip]{scrreprt}
\usepackage[scaled=0.92]{helvet}
\usepackage{setspace}
\onehalfspacing
\usepackage[a4paper]{geometry}
\geometry{width=16cm, left=3cm, top=2.5cm, bottom=2.5cm}
\usepackage[headsepline]{scrpage2}
\pagestyle{scrheadings}
\lehead{\fontfamily{cmr}\textsc{Results}}
\rohead{\fontfamily{cmr}\textsc{Results}}
\usepackage[english]{babel}
\usepackage[nooneline]{caption}
\usepackage{graphicx}
\usepackage[format=plain, font={small, singlespacing}, labelfont=bf] {caption}
\usepackage{kantlipsum}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\kant[1-2]
\begin{figure}%
\includegraphics[scale=1.1]{example-image-c}
\caption{\kant[1-5]}
\end{figure}
\kant[2-5]
\end{document}
Crawling the web for that issue, I found one solution that almost fixes the problem. https://groups.google.com/forum/#!topic/latexusersgroup/9Dz1cXtJZHA. I do not understand that thing completely but I guess it redefines the way that captions are made by latex ignoring the float environment. Using this solution gives us the following minimal example:
\RequirePackage{fix-cm}
\documentclass[a4paper,twoside,openright,headsepline,parskip]{scrreprt}
\usepackage[scaled=0.92]{helvet}
\usepackage{setspace}
\onehalfspacing
\usepackage[a4paper]{geometry}
\geometry{width=16cm, left=3cm, top=2.5cm, bottom=2.5cm}
\usepackage[headsepline]{scrpage2}
\pagestyle{scrheadings}
\lehead{\fontfamily{cmr}\textsc{Results}}
\rohead{\fontfamily{cmr}\textsc{Results}}
\usepackage[english]{babel}
\usepackage[nooneline]{caption}
\usepackage{graphicx}
\usepackage[format=plain, font={small, singlespacing}, labelfont=bf]{caption}
\usepackage{kantlipsum}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LONG CAPTIONS Configuration
% to be inserted before \begin{document}
% source: https://groups.google.com/forum/#!topic/latexusersgroup/9Dz1cXtJZHA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
%Figure environment without an float format
\newenvironment{Figure}{%
\par\addvspace{12pt plus2pt}%
\def\@captype{figure}%
}{%
\par\addvspace{12pt plus2pt}%
}%
%taken from article.cls
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{#1: #2}%
\ifdim \wd\@tempboxa >\hsize
#1: #2\par
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
%% If you are having all the figures with huge caption then use thebelow commands:
%% Otherwise, just comment the below two lines and
%% use "\begin{Figure}...\end{Figure}" instead of "\begin{figure}... \end{figure}"
\let\figure\Figure% replacing by default
\let\endfigure\endFigure%
%%
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\kant[1]
\begin{figure}%
\includegraphics[scale=1.1]{example-image-c}
\caption{\kant[1-3]}
\end{figure}
\kant[2-5]
\end{document}
Here I have the problem, that somehow the caption cannot be formatted in the correct way although it is defined in the preamble:
- line spacing in the caption: single
- caption number and lable: bold
- small font grade
At least for the bold caption number and lable I found some working hacks. Unfortunately I cannot have a single line spacing for the caption text. Nevertheless, that is crucial for the thesis style.
I have already found some solutions for the long-captions issue, but they were not capable of fixing my problem. It is often related to the fact, that I need to use KOMAscript document class scrreprt for my document (that's a design requirment I got). Nevertheless, I tried out the following solutions:
How do I make figure captions span multiple pages? -> does not work for me. If the caption get's too long it is moved to the next page completely
Figure caption does not continue on new page -> does only work for me, if I use document class "article" but I need to use "scrreprt"
Break figure description over two pages -> does not work for me, if I extend the caption length it does not continue on the next page, but I am not sure whether this solution really covers my case
So, to sum up, all I need is a solution that - allows having captions going across pages - allows having those captions with single line spacing and bold lable/number - allows having the caption text in a smaller font-size then the rest of the text. - accepts long captions (indeed the captions must be capable to be long, e.g. half the page, unfortunately there is no solution like "please make shorter captions " ";-))
My next steps I'll try (any hint is welcome!)
manually define single line spacing and font size in captions to make the workaround solution above (https://groups.google.com/forum/#!topic/latexusersgroup/9Dz1cXtJZHA) perfect, but I have already tried several solutions from the web. Unfortunately using the redefinition of makecaptions in the solution from above destroys the approach of using the caption formatting with the package "caption"
maybe it is possible to define a kind of custom lable environment like \mylable which is basically normal text but formatted like I'd like them to have.
I would really appreciate if someone here could help me with that problem.
kind regards,
Stephan
figure
ortable
is usually most effective in conveying its meaning if it's short and snappy. A caption works best if it takes up just one or two lines. If your captions do take up ca. 50% of a full page, you may want to re-think your approach to captioning. Most of what you call a "caption" should probably be part of the legend of thefigure
ortable
. And, if your figures are so complicated as to require an enormously long legend/caption, your figures may well be too complicated to even have a chance to convey their intended meanings.