2

i have a problem with the spacing after a figure in my document. Here is the code i use:

\documentclass[twoside,open=right,12pt,a4paper,abstracton,BCOR=15mm,bibliography=totoc,toc=indentunnumbered]{scrreprt}

\usepackage{lettrine}
\usepackage{lmodern}
\usepackage{tocloft}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[normalem]{ulem}

\makeatletter
\setlength{\@fptop}{0pt}
\setlength{\@fpbot}{0pt}
\makeatother

\begin{document}
some text
\par\rule{1pt}{.95\textheight}\par% needed to reproduce reported behavior
\noindent
some text that goes right till the end of the page
\begin{figure}
    \centering
    \captionsetup{labelfont=bf}
    \includegraphics[]{example-image}
    \caption{The figure appears on the top of the second page, which ist perfect.}\label{fig:FCC}
\end{figure}
\par\bigskip 
\noindent
Some other text that appears on the third page although there is enough space below the figure/caption.

\end{document}

I described the problem in the sample code. I only have a limited number of pages for this report. I have checked with a ruler that there is enough space below the caption of the figure to put at least a little space and 6-7 lines of text. But somehow latex thinks different, so how can i convince it?

/edit1: Sorry, the \vspace below the caption ist not acually there (i copied it from another part of my document). And the negative \vspace does not work. The text either stays on the third page or it will be written across the figure which is of course not acceptable. It will just not start below the caption.

/edit2: If i use \begin{figure}[ht] the whole figure is shifted to the end of my document, which is also not acceptable. Another problem is that the "changes needed to reproduce the problem" are ruining the layout of my document and on top are not needed by me. I can totally reproduce the error with my original code. I try to show a picture of this part of my document to illustrate the problem. I also would upload the full working sample of my code, but it is awfully long due to the text. I have uploaded the files of the 3 page example here. Including the output file i get.

  • 1
    you've added 1cm of space after the caption; that's part of the "extra space" after the figure -- get rid of it. you can shrink that space even further by specifying negative \vspace where you now have the 1cm. you'll probably have to experiment to get the optimum spacing. it would also be a good idea to leave a blank line between input text and the figure code; figures are best input in vertical mode, between paragraphs. – barbara beeton Oct 27 '15 at 17:27
  • 1
    Your figure is large enough that it is being given a page of its own. (Normally it wold appear centered vertically on the page, but setting \@fptop=0pt moved it to the top.) To fix it, just specify \begin{figure}[tb]. – John Kormylo Oct 27 '15 at 20:50
  • Depending on the size of your image, you may need to specify \def\topfraction{.95} and \def\textfraction{.05}, or something like that. see tex.stackexchange.com/questions/39017/… – John Kormylo Oct 27 '15 at 21:13
1

I thought I would show an extreme case.

\documentclass[twoside,open=right,12pt,a4paper,abstraction,BCOR=15mm,bibliography=totoc,toc=indentunnumbered]{scrreprt}

\usepackage{lettrine}
\usepackage{lmodern}
\usepackage{tocloft}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[normalem]{ulem}

\def\topfraction{.95}
\def\textfraction{.05}

\begin{document}
some text
\par\rule{1pt}{.95\textheight}\par
\noindent
some text that goes right till the end of the page
\begin{figure}[tb]
    \centering
    \captionsetup{labelfont=bf}
    \includegraphics[width=\textwidth,height=.85\textheight]{example-image}
    \caption{The figure appears on the top of the second page, which ist perfect.}\label{fig:FCC}
\end{figure}
\par\bigskip 
\noindent
Some other text that appears on the third page although there is enough space below the figure/caption.

\end{document}

full page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.