4

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}
1
  • Welcome to TeX.SX! Who's requiring the information?
    – egreg
    Commented Jan 15, 2014 at 14:35

1 Answer 1

3

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.

4
  • Thanks for the patch, it works well. But what do I have to do, to get the abstract after the extrainformation? And what do the lines {\fi\hrule}% the second rule {\fi\ifvoid\extrainfobox\else\unvbox\extrainfobox\par\vskip10pt\fi\hrule} d0?
    – Anne
    Commented Jan 15, 2014 at 15:01
  • @Anne I have added the alternative version
    – egreg
    Commented Jan 15, 2014 at 15:19
  • 1
    doesn't work for me! apears before the abstract instead of after it.
    – Hamid
    Commented Dec 30, 2018 at 6:49
  • @Hamid Difficult to say. Please, open a new question with details about your issue.
    – egreg
    Commented Dec 30, 2018 at 10:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .