5

How can I get rid of the two lines resulting from empty abstraction and keyword sections? Thanks.

enter image description here

The code is

\documentclass[preprint,12pt]{elsarticle}

\usepackage[nodots]{numcompress}

\biboptions{sort&compress}

\journal{A Journal}

\begin{document}

\begin{frontmatter}

  \title{My Title}

  \author[myaddr]{Author 1}
  \author[myaddr]{Author 2}
  \address[myaddr]{An Address}

  %% \begin{abstract}                                                                                                                                          
  %%   Here's an abstract.                                                                                                                                     
  %% \end{abstract}                                                                                                                                            

  %% \begin{keyword}                                                                                                                                           
  %%   keyword1 \sep keyword2 \sep keyword3                                                                                                                    
  %% \end{keyword}                                                                                                                                             

\end{frontmatter}
\section{Introduction}
\label{intro}


\end{document}
Tim
  • 5,763
  • Do you want to submit this article to some publishing company? If yes, the editors would persist on the lines –  May 19 '15 at 20:18
  • no. it is not for publish. It is just for myself, and I think elsevier's template looks good. – Tim May 19 '15 at 20:26
  • what template also look good? – Tim May 19 '15 at 20:41
  • Good looking is a rather opinion-based term. It depends on your requirements somehow –  May 19 '15 at 20:50
  • My requirement is simple + not waste space + standard. I don't like Elsevier itself, because it is not free, but I don't know what other latex templates also look good for writing report etc – Tim May 19 '15 at 20:56
  • I am pretty fine with standard classes as article etc. –  May 19 '15 at 21:12
  • Can article make the similar thing for author and their addresses as in elsarticle? – Tim May 19 '15 at 21:18
  • \author is basically the same, the addresses however do not work this way, unfortunately. If you need them, you have to workarounds or ... stick to elsarticle (or another class). –  May 19 '15 at 21:22

1 Answers1

3

I had to comment the numcompress package out.

The relevant lines are contained in \pprintMaketitle, being two \hrule statements. For a quick solution, I commented those \hrule statements out:

\documentclass[preprint,12pt]{elsarticle}

\makeatletter
\long\def\pprintMaketitle{\clearpage
  \iflongmktitle\if@twocolumn\let\columnwidth=\textwidth\fi\fi
  \resetTitleCounters
  \def\baselinestretch{1}%
  \printFirstPageNotes
  \begin{center}%
 \thispagestyle{pprintTitle}%
 \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}%
  \gdef\thefootnote{\arabic{footnote}}%
  }
\makeatother

%\usepackage[nodots]{numcompress}

\biboptions{sort&compress}

\journal{A Journal}

\begin{document}

\begin{frontmatter}

  \title{My Title}

  \author[myaddr]{Author 1}
  \author[myaddr]{Author 2}
  \address[myaddr]{An Address}

  %% \begin{abstract}                                                                                                                                          
  %%   Here's an abstract.                                                                                                                                     
  %% \end{abstract}                                                                                                                                            

  %% \begin{keyword}                                                                                                                                           
  %%   keyword1 \sep keyword2 \sep keyword3                                                                                                                    
  %% \end{keyword}                                                                                                                                             

\end{frontmatter}
\section{Introduction}
\label{intro}


\end{document}

Edit A somehow shorter version, with xpatch package:

\documentclass[preprint,12pt]{elsarticle}

\usepackage{xpatch}

% Patching the \hrule\vskip12pt out .. do it twice!!!
\makeatletter
\xpatchcmd{\pprintMaketitle}{%
  \hrule\vskip12pt%
}{}{\typeout{Success}}{}

% Injection the date as a replacement of the 2nd `\hrule` stuff
\xpatchcmd{\pprintMaketitle}{%
  \hrule\vskip12pt%
}{\@date}{\typeout{Success}}{}
\makeatother

%\usepackage[nodots]{numcompress}

\biboptions{sort&compress}

\journal{A Journal}

\begin{document}

\begin{frontmatter}
\title{Theory on Brontosaurs}

\author[myaddr]{Anne Elk (Misses)}
\author[myaddr]{Arthur Gumby (Brain specialist)}
\address[myaddr]{Ministry of Silly Walks}

  %% \begin{abstract}                                                                                                                                          
  %%   Here's an abstract.                                                                                                                                     
  %% \end{abstract}                                                                                                                                            

  %% \begin{keyword}                                                                                                                                           
  %%   keyword1 \sep keyword2 \sep keyword3                                                                                                                    
  %% \end{keyword}                                                                                                                                             

\end{frontmatter}
\section{Introduction}
\label{intro}


\end{document}

enter image description here

  • thanks. where do you find \pprintMaketitle and its definition? – Tim May 19 '15 at 20:27
  • In elsarticle.cls, line 315, at least in the version I've got on my computer –  May 19 '15 at 20:28
  • Is your first method to override its definition? – Tim May 19 '15 at 20:41
  • The first method redefines the pprintMaketitle macro effectively by using the whole bunch of code, copied out of the class file, then commenting the two offending lines out. The second uses the patch approach, which does not require to copy the code. However, since there are two \hrule.... statements there, it must be applied twice (which is strange, to be honest ;-)) –  May 19 '15 at 20:43
  • thanks. btw, I try to add the date to the article. Do you know how to do that? I add \date{May 20, 2015} before or after \author, but the date doesn't show. – Tim May 19 '15 at 20:55
  • @Tim: If you look into the first version of my answer, there is no \@date command used at all. I think, I can inject it at, as a replacement of the \hrule stuff? –  May 19 '15 at 20:58
  • how do you define \date? – Tim May 19 '15 at 20:59
  • \@date is defined in the latex core or in article.cls (I don't remember it right now), but elsarticle.cls uses article.cls. If you use \date{some stuff}, this is stored to \@date. If \date is not specified, \@date is defined to be \today, i.e. the current date -- see my edit of the second version –  May 19 '15 at 21:03
  • What about for [final]? this solution only seems to work for [preprint]. – LShaver Mar 29 '17 at 03:18
  • @LShaver: I never claimed it would work for final. The O.P. used preprint –  Mar 29 '17 at 08:34