# Long abstract for technical report orphaning Abstract title due to vfil

When using a custom template to prepare a report I noticed that long abstracts split across pages, fine, but it leaves the abstract title hanging by itself on it's own page.

How can I structure the abstract environment to have vertically centered abstracts if they fit on one page and top aligned in long abstracts? The \vfil is useful for centering short abstracts, but then means it orphans the title in long abstracts

## The MWE of abstract environment and usage

Normally the environment def is split into the template class.

\documentclass[11pt]{book}
\usepackage{lipsum}

\newenvironment{abstract}
{
\thispagestyle{empty}
\null\vfil %Toggling this line will align to the top in multipage abstract
\begin{center}
\setlength{\parskip}{0pt}
{\textsc\normalsize University \par}
\bigskip
{\underline{Abstract} \par}
\bigskip
{\textsc\normalsize Faculty \par}
{\textsc\normalsize Department \par}
\bigskip
{\normalsize \underline{A progress report submitted for continuation towards a PhD}\par}
\bigskip
{\normalsize\bf \title \par}
\medskip
{\normalsize by [Author] \par}
\bigskip
\end{center}
}
{
\vfil\vfil\vfil\null
\cleardoublepage
}

\title{\bf An MWE}
\author{for SO}
\date{\today}

\begin{document}
\frontmatter
\maketitle
\begin{abstract}
\lipsum[1-4]
\end{abstract}
\end{document}


I have found a simple approach without making many changes to your source code. By replacing the center environment \begin{center} ... \end{center} with the switch command \centering inside \begingroup ... \endgroup or between braces with \par gives the desired output.

\begingroup
\centering
...
\endgroup


or analogously

{\centering
...
\par
}



## But without breaking short abstracts

MWE (with \begingroup ... \endgroup):

\documentclass[11pt]{book}
\usepackage{lipsum}

\newenvironment{abstract}
{
\thispagestyle{empty}
\null\vfil\vfil
\begingroup
\centering
\setlength{\parskip}{0pt}
{\textsc\normalsize University \par}
\bigskip
{\underline{Abstract} \par}
\bigskip
{\textsc\normalsize Faculty \par}
{\textsc\normalsize Department \par}
\bigskip
{\normalsize \underline{A progress report submitted for continuation towards a PhD}\par}
\bigskip
{\normalsize\bf \title \par}
\medskip
{\normalsize by [Author] \par}
\bigskip
\endgroup
}
{
\vfil\vfil\null
\cleardoublepage
}

\title{\bf An MWE}
\author{for SO}
\date{\today}

\begin{document}
\frontmatter
\maketitle
\begin{abstract}
\lipsum[1-2]
%\lipsum[1-6]
\end{abstract}
\end{document}

• This is great, thank you. Was the original problem because of how LaTeX treats the ends of environments?
– EdL
Sep 21, 2020 at 8:17
• @EdL Honestly, I am not sure the reason why. Commenting the 1st \null (the same as \hbox{}) the issue with the long abstracts is solved, but the short ones are not vertically "centered". Just replacing the center environment with \centering it works, but the whole text is than centered. In the latter case, loading the ragged2e package lets you with \justify to typeset fully-justified back. The drawback is the same output as with the center environment. center is defined in terms of trivlist and leaves vertical space before and after it. This is not the case for \centering.
– Ñako
Sep 21, 2020 at 22:19
• I see, thanks for letting me know about how that center environment is defined. Perhaps it is to do with the spacing below it that makes the LaTeX engine split the page there. I think this answer clearly shows how the centre environment was the wrong implementation for my use case and centering is much better.
– EdL
Sep 23, 2020 at 9:00