2

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

Actual Behavior of long abstracts

Two page view of abstract title orphaned when the abstract content is long

The intended behaviour of long abstracts

enter image description here

But without breaking short abstracts

enter image description here

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}

1 Answer 1

2
+100

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
}

The intended behaviour of long abstracts

enter image description here

But without breaking short abstracts

enter image description here

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}
3
  • 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

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.