# Problem with large gaps in scrreprt with setspace

I am using the documentclass scrreprt with the twoside option. Therefore, LaTeX tries to stretch the content on a whole page rather then leaving a gap on the bottom of the page. This produces sometimes large gaps. This is the most extreme case that I was able to produce (notice the gap on top and below of the proof):

I find these gaps totally acceptable. However, when I include the setspace package, I often have to cope with much larger gaps, as I was able to produce in the following example:

Is it possible to avoid those gaps and still use scrreprt and setspace? Here is the code that produces the huge gaps.

\documentclass[twoside=true]{scrreprt}

\usepackage{setspace}
\usepackage{amsthm}
\newtheorem{prop}{Proposition}[section]
\usepackage{amsmath}
\usepackage{blindtext}

\begin{document}

\begin{prop}
\label{itExists2}
This is a non-sense proof to show that I have
serious problems with the geometry and setspace package!
\end{prop}
\begin{proof}
\begin{align*}
1 \\    2\\ 3\\ 4\\ 5\\6\\
\end{align*}
Hi
$1+ 1 =2$
\end{proof}

\blindtext\blindtext

Some nice equations:
\begin{align*}
1 +1 = 2 \\1+1 =3 \\    1+1 =3 \\1+1 =3 \\  1+1 =3 \\1+1 =3
\end{align*}
\end{document}


This is how it looks if everything fits on the page:

• Omitting the twoside=true key for the scrreprt class seems to get rid of the space. – 1010011010 Oct 17 '14 at 20:28
• \raggedbottom would put all the space at the bottom of the page. also, since you're using amsthm, you can use \qedhere just before the \] ending the end-of-proof display to move the tombstone up onto that last line. – barbara beeton Oct 17 '14 at 20:34
• @1010011010 you are right, but ofc I would like to keep this option. – Adam Oct 17 '14 at 21:02
• @barbarabeeton Thank you for the hint. But think it is better if the text is equally distributed on the page (otherwise it looks like it does not continue). However I do not want such giant gaps. – Adam Oct 17 '14 at 21:03
• What exactly do you need setspace for? – cfr Oct 9 '15 at 21:26

Following the comments for your question it seems there is only one possibility:

Change the length of the text between both equation blocks. I used package blindtext to get some (more) dummy text into your MWE. I use package showframe to visualise the resulting typing area and margins.

After the comment of @cfr I checked the KOMA-Script manual and found there a complete example of the author of KOMA-Script, Markus Kohm (chapter 2, page 40 in German version) for an optimal using of setspace with KOMA-Script and some hints to the usage of package scrhack (chapter 16, page 333, german version).

That all results in the following edited MWE (relevant lines are marked with <=========, see the comments in the MWE):

\documentclass[%
twoside=true, %
DIV=calc,     % KOMA-Script calculated best values <==================
paper=a4,     % papersize
]{scrreprt}     % scrbook scrreprt

\usepackage[%  <========================================================
% setspace=false, % no correction for setspace, uncomment, if wanted
]{scrhack} % see KOMA-Script guide, chapter 16.4
% see chapter 2, page 40 (German version) for example by M. Kohm
\KOMAoptions{DIV=last}% <================= recalculate, knowing setspace

\usepackage{amsthm}
\newtheorem{prop}{Proposition}[section]
\usepackage{amsmath}

\usepackage{blindtext} % creates dummy text, dummy document
\usepackage{showframe} % <=====================================
%\raggedbottom         % <=====================================

\begin{document}

\begin{prop}
\label{itExists2}
This is a non-sense proof to show that I have
serious problems with the geometry and setspace package!
\end{prop}
\begin{proof}
\begin{align*}
1\\
2\\
3\\
4\\
5\\
6\\
\end{align*}
Hi
$1+ 1 =2$%\qedhere
\end{proof}

\blindtext\blindtext%\blindtext %=====================================

Some nice equations:
\begin{align*}
1 +1 = 2 \\
1+1 =3 \\
1+1 =3 \\
1+1 =3 \\
1+1 =3 \\
1+1 =3
\end{align*}
\Blindtext %=====================================
\end{document}


with the resuting first page:

• Loading setspace requires recalculating the page layout. See KOMA's manual for details of how to use setspace with the KOMA classes. – cfr Oct 9 '15 at 21:58

You need to pay attention to the way the KOMA classes work. These classes use typearea to layout the page and they rely on the information they have to make good decisions about that layout.

setspace changes things in ways which KOMA needs to know about. As explained in the manual, you need to recalculate the layout after loading the package and altering the spacing, if applicable. You should also change the spacing in particular ways for particular parts of your document, again recalculating after any change. See the documentation for details.

Here's an example which lets KOMA layout the page appropriately. If you would prefer a different layout, see the documentation for details of the possibilities.

\documentclass[twoside=true,DIV=calc,a4paper]{scrreprt}% tell KOMA to calculate the page layout based on its default algorithm
% any changes to line spacing go here e.g. \doublespacing or whatever
\KOMAoptions{DIV=last}% recalculate the layout in light of the changes just made
\usepackage{amsthm}
\newtheorem{prop}{Proposition}[section]
\usepackage{amsmath}
\usepackage{blindtext}

\begin{document}
hi\newpage% this is just so that we can see a double-page spread
\begin{prop}
\label{itExists2}
This is a nonsense proof to show that I have
no problems at all with typearea and the setspace package!
\end{prop}
\begin{proof}
\begin{align*}
1 \\    2\\ 3\\ 4\\ 5\\6\\
\end{align*}
Hi
$1+ 1 =2$
\end{proof}

\blindtext\blindtext

Some nice equations:
\begin{align*}
1 +1 = 2 \\1+1 =3 \\    1+1 =3 \\1+1 =3 \\  1+1 =3 \\1+1 =3
\end{align*}
\end{document}


The result:

The trick here is to let KOMA do what it is designed to do by providing it with enough information to make sensible decisions about the layout. A key feature of the KOMA bundle is that typearea is designed to do exactly this well.