% Scriveno Elsevier LaTeX Template for Pandoc --template flag
% Requires elsarticle.cls (install: tlmgr install elsarticle)
% Usage: pandoc ... --template=data/export-templates/scriveno-elsevier.latex
%
% Default class options: [preprint,12pt] for preprint; [final] for final submission.
% Pass via Pandoc: --metadata classoption=preprint

\documentclass[$if(classoption)$$for(classoption)$$classoption$$sep$,$endfor$$endif$]{elsarticle}

% Encoding -- safe with elsarticle when using pdflatex
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

% Math support
\usepackage{amsmath,amssymb}

% Graphics
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}

% Pandoc required: code highlighting
$if(highlighting-macros)$
$highlighting-macros$
$endif$

% Pandoc required: tight lists
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}

% Pandoc required: CSL references (citeproc compatibility)
$if(csl-refs)$
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newlength{\csllabelwidth}
\setlength{\csllabelwidth}{3em}
\newenvironment{CSLReferences}[2]%
  {\setlength{\parindent}{0pt}%
   \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces}%
  {\par}
\newcommand{\CSLBlock}[1]{\hfill\break#1\hfill\break}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{\strut#1\strut}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\dimexpr\linewidth-\csllabelwidth\relax}{\strut#1\strut}}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
$endif$

% Document metadata
\title{$if(title)$$title$$else$Untitled$endif$}
\author{$if(author)$$for(author)$$if(it.name)$$it.name$$else$$it$$endif$$sep$ \and $endfor$$else$~$endif$}
$if(author)$$for(author)$$if(it.affiliation)$
\address{$it.affiliation$}
$endif$$endfor$$endif$
\date{$if(date)$$date$$else$\today$endif$}

\begin{document}

\maketitle

$if(abstract)$
\begin{abstract}
\noindent $abstract$
\end{abstract}
$endif$

$if(keywords)$
\noindent\textbf{Keywords:} $keywords$
$endif$

$body$

% Bibliography: use elsarticle-num (numeric) or elsarticle-harv (author-year) bib style

\end{document}
