\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$babel-lang$,$else$american,$endif$$if(papersize)$$papersize$paper,$else$letterpaper,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
$if(fontfamily)$
%% CRMDA version 20180816
%% blends default-1.17.0.2 from rmarkdown with CRMDA
%% report-template.tex on 20180816
\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
$else$
\usepackage{lmodern}
%% CRMDA paste: 20180816
\renewcommand{\sfdefault}{lmss}
\renewcommand{\ttdefault}{lmtt}
$endif$
\usepackage[utf8]{inputenc}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{array}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{xcolor}
\usepackage{textcomp}
\usepackage{fancybox}
\usepackage{calc}
\usepackage{subfig}
\usepackage{colortbl}
\usepackage[yyyymmdd,hhmmss]{datetime}
\usepackage{lastpage}
\usepackage{babel}
\providecommand{\tabularnewline}{\\}
\newcommand{\PreserveBackslash}[1]{\let\temp=\\#1\let\\=\temp}
\let\PBS=\PreserveBackslash
\usepackage{setspace}
%% end paste
$if(linestretch)$
\setstretch{$linestretch$}
$endif$
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
  \usepackage[utf8]{inputenc}
$if(euro)$
  \usepackage{eurosym}
$endif$
\else % if luatex or xelatex
  \ifxetex
    \usepackage{mathspec}
  \else
    \usepackage{fontspec}
  \fi
  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
$if(euro)$
  \newcommand{\euro}{€}
$endif$
$if(mainfont)$
    \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
$endif$
$if(sansfont)$
    \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
$endif$
$if(monofont)$
    \setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$endif$]{$monofont$}
$endif$
$if(mathfont)$
    \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
$endif$
$if(CJKmainfont)$
    \usepackage{xeCJK}
    \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
$endif$
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
$if(geometry)$
\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
$else$
\usepackage[includehead,includefoot]{geometry}
\geometry{lmargin=1in,rmargin=1in,tmargin=0.75in,
bmargin=1.0in,headheight=0pt,headsep=0pt,marginparwidth=0pt,
footskip=2.5\baselineskip,
}
$endif$
\usepackage{hyperref}
$if(colorlinks)$
\PassOptionsToPackage{usenames,dvipsnames}{color} % color is loaded by hyperref
$endif$
\hypersetup{unicode=true,
$if(title-meta)$
            pdftitle={$title-meta$},
$endif$
$if(author-meta)$
            pdfauthor={$author-meta$},
$endif$
$if(keywords)$
            pdfkeywords={$for(keywords)$$keywords$$sep$; $endfor$},
$endif$
$if(colorlinks)$
            colorlinks=true,
            linkcolor=$if(linkcolor)$$linkcolor$$else$darkblue$endif$,
            citecolor=$if(citecolor)$$citecolor$$else$darkblue$endif$,
            urlcolor=$if(urlcolor)$$urlcolor$$else$darkblue$endif$,
$else$
            pdfborder={0 0 0},
$endif$
            breaklinks=true}
\urlstyle{same}  % don't use monospace font for urls
$if(lang)$
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
$if(babel-newcommands)$
  $babel-newcommands$
$endif$
\else
  \usepackage{polyglossia}
  \setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$}
$for(polyglossia-otherlangs)$
  \setotherlanguage[$polyglossia-otherlangs.options$]{$polyglossia-otherlangs.name$}
$endfor$
\fi
$endif$
$if(natbib)$
%%\usepackage{natbib}
\usepackage[natbibapa]{apacite}
\bibliographystyle{$if(biblio-style)$$biblio-style$$else$apacitex$endif$}
$endif$
$if(biblatex)$
\usepackage$if(biblio-style)$[style=$biblio-style$]$endif${biblatex}
$if(biblatexoptions)$\ExecuteBibliographyOptions{$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$}$endif$
$for(bibliography)$
\addbibresource{$bibliography$}
$endfor$
$endif$
$if(listings)$
\usepackage{listings}
\newcommand{\passthrough}[1]{#1}
$endif$
$if(lhs)$
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
$endif$
$if(highlighting-macros)$
$highlighting-macros$
$endif$
$if(verbatim-in-note)$
\usepackage{fancyvrb}
\VerbatimFootnotes % allows verbatim text in footnotes
$endif$
\usepackage{longtable,booktabs, dcolumn}
\usepackage{graphicx,grffile}
\usepackage{fancyhdr}
\lhead{}
\chead{}
\rhead{}
\renewcommand{\headrulewidth}{0pt}
\lfoot{}
\cfoot{{Page} \thepage { of} \pageref{LastPage}}
\rfoot{}

\fancypagestyle{firststyle}
{
\lfoot{}
% \cfoot{{Page} \thepage { of} \pageref{LastPage}}
\cfoot{}
\rfoot{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[L]{$if(addr.l1)$$addr.l1$\\$endif$$if(addr.l2)$$addr.l2$\\$endif$$if(addr.l3)$$addr.l3$$endif$}
\fancyfoot[R]{$if(addr.r1)$$addr.r1$\\$endif$$if(addr.r2)$$addr.r2$\\$endif$$if(addr.r3)$$addr.r3$$endif$}
\renewcommand{\footrulewidth}{.1pt}
}

\pagestyle{fancy}
\thispagestyle{firststyle}

\makeatletter
%graphics and such inside floats are centered by default
\renewenvironment{figure}[1][]{%
 \ifthenelse{\equal{#1}{}}{%
   \@float{figure}
 }{%
   \@float{figure}[#1]%
 }%
 \centering
}{%
 \end@float
}
\renewenvironment{table}[1][]{%
 \ifthenelse{\equal{#1}{}}{%
   \@float{table}
 }{%
   \@float{table}[#1]%
 }%
 \centering
}{%
 \end@float
}
\makeatother

%% Eliminate reliance on Sweavel or Sweave
%% \usepackage{Sweavel}
%% \usepackage[noae]{Sweave}
\usepackage{listings}
\usepackage{upquote, fancyvrb, relsize, ae}

%%\lstset{tabsize=2, breaklines=true,style=Rstyle}
\definecolor{darkgreen}{RGB}{0,100,0}
\definecolor{indianred}{RGB}{205,92,92}
\definecolor{steelblue}{RGB}{70,130,180}
\definecolor{antwhite}{RGB}{139,119,101}
\definecolor{lightgray}{RGB}{240,240,240}
\definecolor{darkblue}{HTML}{1e2277}
\definecolor{kublue81186}{RGB}{0,81,186}
\newdateformat{monddyyy}{\shortmonthname[\THEMONTH].~\THEDAY,~\THEYEAR}

\def\Sweavesize{\scriptsize} 
\def\Rcolor{\color{black}} 
\def\Rbackground{\color[gray]{0.95}}

\lstdefinestyle{Rstylecrmda}{
  language=R,
  escapechar=`,
  fancyvrb=false,%
  tabsize=2,%
  breaklines=true,
  breakatwhitespace=true,%
  captionpos=b,%
  frame=single,%
  framerule=0.2pt,%
  framesep=1pt,%
  showstringspaces=false,%
  basicstyle=\normalsize\ttfamily,%
  columns=fixed%,
  \lst@ifdisplaystyle\scriptsize\fi,%
  identifierstyle=,%
  keywords=\bfseries,%
  keywordstyle=\color[rgb]{0, 0.5, 0.5},
  escapeinside={(*}{*)},
  literate={~}{{$$\sim$$}}1 {==}{{=\,=}}2,
  alsoother={$$},
  alsoletter={.<-},%
  otherkeywords={!,!=,~,$$,*,\&,\%/\%,\%*\%,\%\%,<-,<<-,/},
  backgroundcolor=\Rbackground
}%

\lstset{style=Rstylecrmda}

\fvset{listparameters={\setlength{\topsep}{0em}}}

\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
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
$if(links-as-notes)$
% Make links footnotes instead of hotlinks:
\renewcommand{\href}[2]{#2\footnote{\url{#1}}}
$endif$
$if(strikeout)$
\usepackage[normalem]{ulem}
% avoid problems with \sout in headers with hyperref:
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
$endif$
$if(indent)$
$else$
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
$endif$
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
$if(numbersections)$
\setcounter{secnumdepth}{5}
$else$
\setcounter{secnumdepth}{0}
$endif$
$if(subparagraph)$
$else$
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
$endif$
$if(dir)$
\ifxetex
  % load bidi as late as possible as it modifies e.g. graphicx
  $if(latex-dir-rtl)$
  \usepackage[RTLdocument]{bidi}
  $else$
  \usepackage{bidi}
  $endif$
\fi
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \TeXXeTstate=1
  \newcommand{\RL}[1]{\beginR #1\endR}
  \newcommand{\LR}[1]{\beginL #1\endL}
  \newenvironment{RTL}{\beginR}{\endR}
  \newenvironment{LTR}{\beginL}{\endL}
\fi
$endif$

%%% Use protect on footnotes to avoid problems with footnotes in titles
\let\rmarkdownfootnote\footnote%
\def\footnote{\protect\rmarkdownfootnote}

$if(compact-title)$
%%% Change title format to be more compact
\usepackage{titling}

% Create subtitle command for use in maketitle
\newcommand{\subtitle}[1]{
  \posttitle{
    \begin{center}\large#1\end{center}
    }
}

\setlength{\droptitle}{-2em}
$endif$

% $if(title)$
%   \title{$title$}
%   $if(compact-title)$
%   \pretitle{\vspace{\droptitle}\centering\huge}
%   \posttitle{\par}
%   $endif$
% $else$
%   \title{}
%   $if(compact-title)$
%   \pretitle{\vspace{\droptitle}}
%   \posttitle{}
%   $endif$
% $endif$
% $if(subtitle)$
% \subtitle{$subtitle$}
% $endif$
% $if(author)$
%   \author{$for(author)$$author$$sep$ \\ $endfor$}
%   $if(compact-title)$
%   \preauthor{\centering\large\emph}
%   \postauthor{\par}
%   $endif$
% $else$
%   \author{}
%   $if(compact-title)$
%   \preauthor{}\postauthor{}
%   $endif$
% $endif$
% $if(date)$
%   $if(compact-title)$
%   \predate{\centering\large\emph}
%   \postdate{\par}
%   $endif$
%   \date{$date$}
% $else$
%   \date{}
%   $if(compact-title)$
%   \predate{}\postdate{}
%   $endif$
% $endif$

$for(header-includes)$
$header-includes$
$endfor$

\begin{document}
%%CRMDA paste 20180816
\noindent\begin{minipage}[t]{6.5in}%
  \begin{center}
    \setlength{\tabcolsep}{2pt}
    \setlength{\arrayrulewidth}{0.6pt}
    \begin{tabular}[t]{@{}>{\raggedright}p{4in}>{\centering}p{2.5in}@{}}
      \arrayrulecolor{kublue81186}\hline 
      \medskip{}
      $if(title)$
      \textsc{\Large{}$title$$if(subtitle)$: $subtitle$$endif$}{\Large \par}
      $endif$
      \bigskip{}
      \textcolor{kublue81186}{\rule[0.5ex]{3.25in}{0.6pt}}
      & \medskip{} $if(logo)$\includegraphics[width=2in]{$logo$}$endif$\tabularnewline
        \tabularnewline
        \multicolumn{2}{>{\raggedright}p{6in}}{
        $for(author)$$author.name$$if(author.description)$,
              $author.description$$endif$$if(author.affiliation)$,
              $author.affiliation$$endif$$if(author.email)$ <$author.email$>$endif$\\
        $endfor$
        \par
        \medskip
        \begin{singlespace}
          \raggedright{}{\monddyyy\today}
        \end{singlespace}
        }\tabularnewline
        \hline 
    \end{tabular}
    \par
  \end{center}
  \medskip{}
  % 
\end{minipage}
$if(abstract)$
\begin{abstract}
$abstract$
\end{abstract}
$endif$

$for(include-before)$
$include-before$

$endfor$
$if(toc)$
{
$if(colorlinks)$
\hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$black$endif$}
$endif$
\setcounter{tocdepth}{$toc-depth$}
\tableofcontents
}
$endif$
$if(lot)$
\listoftables
$endif$
$if(lof)$
\listoffigures
$endif$
$body$

$if(natbib)$
$if(bibliography)$
$if(biblio-title)$
$if(book-class)$
\renewcommand\bibname{$biblio-title$}
$else$
\renewcommand\refname{$biblio-title$}
$endif$
$endif$
\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
$if(toc)$
\addcontentsline{toc}{section}{\refname}
$endif$
$endif$
$endif$
$if(biblatex)$
\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
$endif$
$for(include-after)$
$include-after$

$endfor$

\end{document}
