# Abstract on the title page in LaTeX

I would like the abstract on the title page in the following style: 1. The word 'Abstract' centred above the text 2. A horizontal line immediately underneath the word 'Abstract', with a width equal to that of the text 3. A horizontal line of that same length immediately underneath the text 4. The word 'Keywords:' at the left-side that allows me to put some keywords specific to the thesis.

I have been trying to get this right, but apparently I am missing something. Thanks for the help! Current code can be found here:

\renewenvironment{abstract}
{\begin{quote}
\noindent \rule{\linewidth}{.5pt}\par{\bfseries \abstractname.}}
{\medskip\noindent \rule{\linewidth}{.5pt}
\end{quote}
}


Picture of the end result I aspire:

• You realize that the quote environment adds extra margin to the left and right? – John Kormylo Jun 2 '18 at 13:41
• @JohnKormylo I did not know that. However, after removing 'quote' it lead to a less desire result, so I like the style it gives. – Sean Jun 2 '18 at 13:44
• As far as I can tell, the ONLY thing quote does is change the margins. Unless you are using some other document class. – John Kormylo Jun 2 '18 at 15:00
• You should decide where to ask. Either here or on LaTeX.org. Once again, you post a snippet, you do not give any indication which document class you are using, alas, you are never posting a suitable MWE. And what does the question have to do with {sharelatex}? – Johannes_B Jun 3 '18 at 5:24
• A former question of yours asked for a title page that seems to contradict with this newer question. If the old question is obsolete, please either delete it or mark as duplicate of tex.stackexchange.com/questions/209993/… – Johannes_B Jun 3 '18 at 5:54

A solution based on tabularx, threeparttable and xparse for the keywords: it defines the abstract as a threeparttable – the abstract itself being a single row of a tabularx environment, and the list of keywords, input as an optional argument of the environment, inserted as a table note.

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{lipsum}
\usepackage{tabularx, threeparttable, booktabs}
\usepackage{xparse}
\title{Some Title}
\author{Some One}
\RenewDocumentEnvironment{abstract}{o}%
{\endtabularx\vspace{-2ex}\hrule\IfNoValueF{#1}{ \begin{tablenotes}[flushleft, online]\smallskip\item[Keywords: ] #1
\end{tablenotes}}
\endthreeparttable\vspace*{6ex}}%

\begin{document}

\maketitle
\begin{abstract}%[small $\beta$s, Fama-MacBeth two-pass procedure; foreign currency portfolios; factor pricing; stochastic discount factors; weak identification; principal components]
\lipsum[1]
\end{abstract}
\lipsum[2-8]

\end{document}


It might help to look at the definitions is the base folder (article.cls for example).

Since \rule expands in hmode, it always takes up \baselineskip, while \hrule expands in vmode and adds NO extra vertical space. The center environment add extra space at the end, which can be removed using \unskip.

\documentclass{article}
\usepackage{lipsum}% MWE only
\usepackage{showframe}% MWE only

\renewenvironment{abstract}
{\begin{center}\bfseries \abstractname
\end{center}\unskip
\smallskip\hrule\smallskip\par}%
{\medskip\hrule\smallskip}

\begin{document}
%\begin{titlepage}
\begin{abstract}
\lipsum[1]
\end{abstract}
\noindent\lipsum[2]
%\end{titlepage}
\end{document}


I said it before and I will say it again: There is no need to redefine the abstract environment.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Masters/Doctoral Thesis
% LaTeX Template
% Version 2.6 (26/4/18)
%
% http://www.LaTeXTemplates.com
%
% Version 2.x major modifications by:
% Vel (vel@latextemplates.com)
%
% This template is based on a template by:
% Steve Gunn (http://users.ecs.soton.ac.uk/srg/softwaretools/document/templates/)
% Sunil Patel (http://www.sunilpatel.co.uk/thesis-template/)
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[
english, % ngerman for German
chapterinoneline, % Uncomment to place the chapter title next to the number on one line
]{MastersDoctoralThesis} % The class file specifying the document structure
\usepackage{blindtext}
\usepackage{showframe}
\renewcommand{\chaptermarkformat}{\thechapter\space}
\begin{document}
\begin{titlepage}
{\centering
{\scshape\LARGE Columbidae University \par}
\vspace{1cm}
{\scshape\Large Final year project\par}
\vspace{1.5cm}
{\huge\bfseries Pigeons love doves\par}
\vspace{2cm}
{\Large\itshape John Birdwatch\par}
\vfill
supervised by\par
Dr.~Mark \textsc{Brown}

\vspace{1cm}\textbf{Abstract}\par}
\noindent\raisebox{.5ex}{\rule{\linewidth}{.4pt}}\par
\blindtext\par
\noindent\raisebox{.5ex}{\rule{\linewidth}{.4pt}}\par
\noindent Keywords: Alpaca, Wombat, Capybara

\vfill
{\centering\large \today\par}
\end{titlepage}
\chapter{Wombat}
\blindtext[10]
\appendix