2

I have created a custom titlepage for a template I'm working on at the moment and encountered some strange behavior of \vbox. This is the code:

\documentclass[twoside
    ,fontsize=11pt
    ,paper=a4
]{scrreprt}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{setspace}
\usepackage[left=25mm,right=25mm,top=9mm,bottom=22.6mm]{geometry}
\usepackage{graphicx}


\makeatletter
%\newcommand{\my@title}{Entwicklung}% this works
\newcommand{\my@title}{Dies ist ein sehr intelligenter Titel, der ein wenig länger ist als die meisten. Das muss er aber auch sein, um schön zu sein.}% this doesn't
\newcommand{\my@author}{Eins Student\\\vfill Zwei Student\\\vfill Drei Student}
\newcommand{\my@shortauthor}{E. Student, Z. Student, D. Student}
\newcommand{\my@thesis}{Teamprojekt}
\newcommand{\my@examinor}{Prof. Dr. Dings Bumsenskirchen}
\newcommand{\my@shortexaminor}{D. Bumsenskirchen}
\newcommand{\my@advisor}{Dipl.-Depp Hans Bumsenskirchen}
\newcommand{\my@shortadvisor}{H. Bumsenskirchen}
\newcommand{\my@number}{XX-00-AA-0}

\newcommand{\multfill}[1]{%
    \bgroup%
    \newcount\@multfillmax%
    \newcount\@multfillcur%
    \@multfillmax=#1%
    \@multfillcur=0%
    \loop\ifnum\@multfillmax>\@multfillcur%
        \advance\@multfillcur by 1%
        \vfill%
    \repeat%
    \egroup%
}

\renewcommand{\maketitle}{
    \thispagestyle{empty}
    \newgeometry{left=25mm,right=25mm,top=9mm,bottom=22.6mm}%
    \vbox to 0.96\textheight{%
        \setstretch{1}\noindent%
        \includegraphics[height=10.85mm]{example-image-a}%
        \hfill\includegraphics[height=11.9mm]{example-image-b}%
        \multfill{9}%
        \begin{center}%
        {%
            \setstretch{1.4}\bfseries\huge\my@title\\%
            \multfill{2}%
            \setstretch{1}\large von\\%
            \multfill{2}%
            \my@author\\%}}}
        }%
        \multfill{5}%
        {\setstretch{1.15}\large\textbf{\my@thesis}}%
        \multfill{5}%
        {\setstretch{1.15}\large Ausgegeben von\\\textbf{\my@examinor},\\%
            mitbetreut von\\\textbf{\my@advisor}\\%
        }
        \multfill{5}%
        {\setstretch{1.15}\large Lehrstuhl für eine Wissenschaft\\%
            Fakultät für Wissenschaft, Universität\\%
        }%
        \multfill{2}%
        \textbf{\@date}\\%
        \end{center}%
        \multfill{5}%
        \parbox{0.5\textwidth}{\setstretch{1.07}\small Zitierhinweis:\\
            \my@shortauthor, \my@shortadvisor, \my@shortexaminor:%
            \\\my@title,\\LS1-Bericht Nr. \my@number; Stadt (\the\year)%
        }
    }%
}
\makeatother

\begin{document}
\maketitle
\cleardoublepage
\restoregeometry
\end{document}

With this the titlepage ends up on the second page of the pdf. If I replace \newcommand{\my@title}{...} with \newcommand{\my@title}{Entwicklung} the titlepage ends up on the first page.

My question is therefore: Why does a \vbox which is set to a total height (in this case 0.96\textheight) end up on different pages depending on its contents?

3
  • @DavidCarlisle Surely, the descender on g does not extend to .04\textheight? Commented Apr 24, 2017 at 19:59
  • @StevenB.Segletes I misread the question Commented Apr 24, 2017 at 20:05
  • @Skillmon sorry I commented before I ran the question I thought you meant ... it's just teh longer title is longer.. Commented Apr 24, 2017 at 20:06

1 Answer 1

4

the final item in your box is

\parbox{0.5\textwidth}{\setstretch{1.07}\small Zitierhinweis:\\
            \my@shortauthor, \my@shortadvisor, \my@shortexaminor:%
            \\\my@title,\\LS1-Bericht Nr. \my@number; Stadt (\the\year)%

which as you have not used [b] is a vertically centred parbox so half of its total height contributes to the depth of the outer box this depth is increased when you have a two-line title.

 \parbox[b]{0.5\textwidth}{\setstretch{1.07}\small Zitierhinweis:\\
            \my@shortauthor, \my@shortadvisor, \my@shortexaminor:%
            \\\my@title,\\LS1-Bericht Nr. \my@number; Stadt (\the\year)%
        }%
1
  • Thank you very much! I hate it when the solution is that simple :) It always bothers me that I should have spotted this on my own.
    – Skillmon
    Commented Apr 24, 2017 at 20:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .