[Tex/LaTex] Why is a blank page inserted

blank-pagekoma-script

The following produces a blank page – page 2.

\documentclass[a4paper]{scrreprt}
\author{}
\date{}
\def\myversion{1.0 }
\title{
\flushright
    \rule{14.5cm}{5pt}\vskip1cm
    \Huge{SOME TEXT IS\\ WRITTEN HERE}\\
    \vspace{2cm}
    text\\
    \vspace{2cm}
    some text here\\
    \vspace{2cm}
    \LARGE{Version \myversion \\}
    \vspace{2cm}
    A line of text
    \vspace{1cm}
    \rule{14.5cm}{5pt}
}
\begin{document}
\maketitle
\tableofcontents
\chapter{Here's a heading}
\end{document}

I've noticed that if I remove the last two lines of the \title that the blank page disappears. This leads me to believe there's some magic number that defines how much content can fit on the first page before it will end up causing a successive blank page to be inserted.

  1. How can I determine what this magic number is, and can I change it?
  2. If I'm wrong, how else can I have the full content of \title displayed on the first page and not have a blank page inserted on compile?

Best Answer

You have to have some trial and error to find out how much more space is needed so as to keep things intact. For example, here \vspace*{-\baselineskip} will do the job.

\documentclass[a4paper]{scrreprt}
\author{}
\date{}
\def\myversion{1.0 }
\title{%
\vspace*{-\baselineskip}
\flushright
    \rule{\linewidth}{5pt}\vskip1cm
    {\Huge SOME TEXT IS\\ WRITTEN HERE}\\
    \vspace{2cm}
    text\\
    \vspace{2cm}
    some text here\\
    \vspace{2cm}
    {\LARGE Version \myversion \\}
    \vspace{2cm}
    A line of text
    \vspace{1cm}
    \rule{\linewidth}{5pt}
}
\begin{document}
\maketitle
\tableofcontents
\chapter{Here's a heading}
\end{document}

However, when you tweak the title so much, it is advisable not to abuse \title command. Use titlepage instead.

\documentclass[a4paper]{scrreprt}
\def\myversion{1.0}
\begin{document}
\begin{titlepage}
  \flushright\bfseries\huge
  \vspace*{\stretch{0.4}}
    \rule{\linewidth}{5pt}
    \par
    \vspace{1cm}
    {\Huge SOME TEXT IS \par WRITTEN HERE \par}
    \vspace{2cm}
    text\par
    \vspace{2cm}
    some text here\par
    \vspace{2cm}
     Version \myversion \par
    \vspace{2cm}
    A line of text
    \vspace{2cm}
    \rule{\linewidth}{5pt}
    \vspace{\stretch{1}}
\end{titlepage}
\tableofcontents
\chapter{Here's a heading}
\end{document}

Here you have to adjust every thing by yourself.

enter image description here