0

I got a low level TeX code from Define abstract environment in book that defines an environment for Abstract. However, when I put it in my work, I use notitlepage option which results in the abstract being aligned vertically to the top. As shown here, the abstract text does not justify to the available width; there is an empty space to the left and to the right.

Right now I want the whole abstract (both title and text) to align vertically to the center of the text body and fully justify the text to save as much as possible of space.

enter image description here

Here is the code:

\documentclass[notitlepage]{book}
\usepackage[no-math]{fontspec}
\usepackage[inline]{enumitem}
\usepackage{blindtext}
\usepackage[showframe]{geometry}
\usepackage{tocloft}
\usepackage{etoolbox}
\patchcmd{\frontmatter}{\pagenumbering{roman}}{\pagenumbering{Roman}}{}{}

% ===== Define abstract environment =====
\makeatletter
\if@titlepage
\newenvironment{abstract}{%
    \titlepage
    \null\vfil
    \@beginparpenalty\@lowpenalty
    \begin{center}%
        \bfseries \abstractname
        \@endparpenalty\@M
\end{center}}%
{\par\vfil\null\endtitlepage}
\else
\newenvironment{abstract}{%
    \if@twocolumn
    \section*{\abstractname}%
    \else
    \small
    \begin{center}%
        {\bfseries \abstractname\vspace{-.5em}\vspace{\z@}}%
    \end{center}%
    \quotation
    \fi}
{\if@twocolumn\else\endquotation\fi}
\fi
\makeatother


\begin{document}




\frontmatter

\pagestyle{plain}

\tableofcontents


\pagestyle{headings}

\cleardoublepage
\begin{abstract}
    \thispagestyle{plain}
    \blindtext
\end{abstract}
\phantomsection \addcontentsline{toc}{chapter}{\abstractname}


\cleardoublepage
\phantomsection \addcontentsline{toc}{chapter}{\listfigurename}
\listoffigures

\cleardoublepage
\phantomsection  \addcontentsline{toc}{chapter}{\listtablename}
\listoftables


\mainmatter

\Blinddocument
\Blinddocument
\Blinddocument


\end{document}
1
3

Never just copy/paste code. You need to understand it first.

\documentclass[notitlepage]{book}
%\usepackage[no-math]{fontspec}
\usepackage[inline]{enumitem}
\usepackage{blindtext}
\usepackage[showframe]{geometry}
\usepackage{tocloft}
\usepackage{etoolbox}

\patchcmd{\frontmatter}{\pagenumbering{roman}}{\pagenumbering{Roman}}{}{}

% ===== Define abstract environment =====
\newenvironment{abstract}{%
    \clearpage
\vspace*{\fill}
    \small
    \begin{center}%
    {\bfseries Abstract}
    \phantomsection \addcontentsline{toc}{chapter}{Abstract}
    \thispagestyle{plain}
\end{center}%
}
{\vspace*{\fill}
}


\begin{document}




\frontmatter

\pagestyle{plain}

\tableofcontents


\pagestyle{headings}

\cleardoublepage
\begin{abstract}
\blindtext
\end{abstract}


\cleardoublepage
\phantomsection \addcontentsline{toc}{chapter}{\listfigurename}
\listoffigures

\cleardoublepage
\phantomsection  \addcontentsline{toc}{chapter}{\listtablename}
\listoftables


\mainmatter

\Blinddocument
\Blinddocument
\Blinddocument


\end{document}

almotasemAbstract

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.