[Tex/LaTex] How to add normal text to frontmatter of elsarticle

elsarticle

I'm using the elsarticle documentclass for my paper. Beneath title and author, number of figures, tables etc. is requested on the titlepage. How can I write extra text in the frontmatter area? For example:

"Number of pages: ; Number of figures: ; Number of tables:
Number of words in the abstract: ; introduction: ; discussion:
Total number of words in the text:
Conflict of interest:"

\documentclass[preprint, authoryear]{elsarticle}

\bibliographystyle{annesstyle}

\begin{document}

\begin{frontmatter}

\title{title}
\author[firstaddress]{Aaddress}
\author[secondaddress]{address}
\author[thirdaddress]{Haddress}
\author[thirdaddress]{address}
\author[thirdaddress]{address}
\author[thirdaddress,firstaddress]{address}

\address{Address for correspondance:}

\address[firstaddress]{address}
\address[secondaddress]{address}

\begin{abstract}abstract\end{abstract}

\begin{keyword}keywords\end{keyword}

\end{frontmatter}

\section{References}
\bibliography{mybib}
\end{document}

Best Answer

If you use the preprint style, here's a patch:

\documentclass[preprint, authoryear]{elsarticle}

\usepackage{etoolbox}
% patch `\maketitle` to accommodate the new information, printed after the keywords
\patchcmd{\pprintMaketitle}
  {\fi\hrule}% the second rule
  {\fi\ifvoid\extrainfobox\else\unvbox\extrainfobox\par\vskip10pt\fi\hrule}
  {}{}

% an environment for the new information
\newenvironment{extrainfo}
  {\global\setbox\extrainfobox=\vbox\bgroup\parindent=0pt }
  {\egroup}
\newsavebox\extrainfobox

\bibliographystyle{annesstyle}

\begin{document}

\begin{frontmatter}

\title{title}
\author[firstaddress]{Aaddress}
\author[secondaddress]{address}
\author[thirdaddress]{Haddress}
\author[thirdaddress]{address}
\author[thirdaddress]{address}
\author[thirdaddress,firstaddress]{address}

\address{Address for correspondance:}

\address[firstaddress]{address}
\address[secondaddress]{address}

\begin{abstract}abstract\end{abstract}

\begin{keyword}keywords\end{keyword}

\begin{extrainfo}
Number of pages: ;\\
Number of figures: ;\\
Number of tables: ;\\
Number of words in the abstract: ;\\
Introduction: ;\\
discussion: ;\\
Total number of words in the text: ;\\
Conflict of interest:
\end{extrainfo}

\end{frontmatter}

\section{References}
\bibliography{mybib}
\end{document}

enter image description here

Here's the way to have the extra information before the abstract:

\documentclass[preprint, authoryear]{elsarticle}

\usepackage{etoolbox}
\patchcmd{\pprintMaketitle}
  {\hrule\vskip12pt}% the second rule
  {\hrule\vskip12pt\ifvoid\extrainfobox\else\unvbox\extrainfobox\par\vskip12pt\fi}
  {}{}

\newenvironment{extrainfo}
  {\global\setbox\extrainfobox=\vbox\bgroup\parindent=0pt }
  {\egroup}
\newsavebox\extrainfobox

\bibliographystyle{annesstyle}

\begin{document}

\begin{frontmatter}

\title{title}
\author[firstaddress]{Aaddress}
\author[secondaddress]{address}
\author[thirdaddress]{Haddress}
\author[thirdaddress]{address}
\author[thirdaddress]{address}
\author[thirdaddress,firstaddress]{address}

\address{Address for correspondance:}

\address[firstaddress]{address}
\address[secondaddress]{address}

\begin{abstract}abstract\end{abstract}

\begin{keyword}keywords\end{keyword}

\begin{extrainfo}
Number of pages: ;\\
Number of figures: ;\\
Number of tables: ;\\
Number of words in the abstract: ;\\
Introduction: ;\\
discussion: ;\\
Total number of words in the text: ;\\
Conflict of interest:
\end{extrainfo}

\end{frontmatter}

\section{References}
\bibliography{mybib}
\end{document}

enter image description here

The text in the second arguments of \patchcmd is the code that we want to replace in the definition of \pprintMaketitle with the code contained in the third argument. It's easier than copying the entire definition and modifying it.