[Tex/LaTex] Remove vertical space between author affiliation and abstract in \documentclass[5p]{elsarticle}

elsarticlespacing

How to remove the verticle space between Author affiliation and Abstract in elsarticle class. Thank you

    \documentclass[5p]{elsarticle}

\usepackage{times}

% use to remove rules (top and bottom lines) of Abstract"
\usepackage{xpatch}
\xpatchcmd{\MaketitleBox}{\hrule}{}{}{}% remove first horizontal rule (above abstract)
\xpatchcmd{\MaketitleBox}{\hrule}{}{}{}% remoce second horizonral rule (below keywords)

\begin{filecontents*}{mybibfile.bib}
\end{filecontents*}
\usepackage{lineno,hyperref}

%\journal{Journal of \LaTeX\ Templates}

\bibliographystyle{elsarticle-num}
%%%%%%%%%%%%%%%%%%%%%%%


% use to remove footer " preprint submitted to elsevier"
\makeatletter
\def\ps@pprintTitle{%
 \let\@oddhead\@empty
 \let\@evenhead\@empty
 \def\@oddfoot{}%
 \let\@evenfoot\@oddfoot}
\makeatother


\author{hariharan\corref{cor1}*}
\address{\normalfont{ Fukuoka, Japan\\ 
Email : hari.ac.jp }}

\title{My title My title My title My title My title My title My title  }

\begin{document}

\begin{frontmatter}
\begin{abstract}
Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text  Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text  Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text Some Some text text  
\end{abstract}

\end{frontmatter}

\section{Introduction}
Remove space between author affilioation and abstract in elsarticle class. Remove space between author affilioation and abstract in elsarticle class. Remove space between author affilioation and abstract in elsarticle class. Remove space between author affilioation and abstract in elsarticle class. Remove space between author affilioation and abstract in elsarticle class. Remove space between author affilioation and abstract in elsarticle class. Remove space between author affilioation and abstract in elsarticle class.
\end{document}

Best Answer

The frontmatter environment in elsarticle issues \maketitle at \end{frontmatter}:

\newenvironment{frontmatter}
  {}          % \begin{frontmatter}
  {\maketitle}% \end{frontmatter}

The setup for \maketitle depends on a number of things passed as document class options. However, the information detailing the construction of the title is contained within \MaketitleBox:

\long\def\MaketitleBox{%
  \resetTitleCounters
  \def\baselinestretch{1}%
  \begin{center}%
   \def\baselinestretch{1}%
    \Large\@title\par\vskip18pt
    \normalsize\elsauthors\par\vskip10pt
    \footnotesize\itshape\elsaddress\par\vskip36pt
    \hrule\vskip12pt
    \ifvoid\absbox\else\unvbox\absbox\par\vskip10pt\fi
    \ifvoid\keybox\else\unvbox\keybox\par\vskip10pt\fi
    \hrule\vskip12pt
    \end{center}%
  }

Note how you've already removed the two \hrule macros with your xpatch:

\xpatchcmd{\MaketitleBox}{\hrule}{}{}{}% remove first horizontal rule (above abstract)
\xpatchcmd{\MaketitleBox}{\hrule}{}{}{}% remoce second horizonral rule (below keywords)

However, you've left the remaining \vskip12pt after each - these are the vertical spaces between the title/author-and-abstract and abstract-and-text-body. We can change your patch to

\xpatchcmd{\MaketitleBox}{\hrule\vskip12pt}{\vspace{-2\baselineskip}}{}{}% remove first horizontal rule (above abstract) + space
\xpatchcmd{\MaketitleBox}{\hrule}{}{}{}% remoce second horizonral rule (below keywords)

which replaces the rule and vertical skip with a negative skip.

Original output:

enter image description here

Updated output:

enter image description here

\documentclass[5p]{elsarticle}

\usepackage{times,lipsum}

% use to remove rules (top and bottom lines) of Abstract"
\usepackage{xpatch}
\xpatchcmd{\MaketitleBox}{\hrule\vskip12pt}{\vspace{-2\baselineskip}}{}{}% remove first horizontal rule (above abstract) + space
\xpatchcmd{\MaketitleBox}{\hrule}{}{}{}% remoce second horizonral rule (below keywords)

\usepackage{hyperref}

\author{An author\corref{cor1}*}
\address{An address \\ 
  Email : who@cares.com
}

\title{A title}

\begin{document}

\begin{frontmatter}
  \begin{abstract}
    \lipsum[1]
  \end{abstract}
\end{frontmatter}

\section{Introduction}
\lipsum[2-5]

\end{document}

There are additional skips when using keywords, but that's not covered in this question. However, you can remove/change these as well.