1\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$} 2$if(fontfamily)$ 3\usepackage{$fontfamily$} 4$else$ 5\usepackage{lmodern} 6$endif$ 7$if(linestretch)$ 8\usepackage{setspace} 9\setstretch{$linestretch$} 10$endif$ 11\usepackage{amssymb,amsmath} 12\usepackage{ifxetex,ifluatex} 13\usepackage{fixltx2e} % provides \textsubscript 14\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex 15 \usepackage[T1]{fontenc} 16 \usepackage[utf8]{inputenc} 17$if(euro)$ 18 \usepackage{eurosym} 19$endif$ 20\else % if luatex or xelatex 21 \ifxetex 22 \usepackage{mathspec} 23 \usepackage{xltxtra,xunicode} 24 \else 25 \usepackage{fontspec} 26 \fi 27 \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} 28 \newcommand{\euro}{���} 29$if(mainfont)$ 30 \setmainfont{$mainfont$} 31$endif$ 32$if(sansfont)$ 33 \setsansfont{$sansfont$} 34$endif$ 35$if(monofont)$ 36 \setmonofont[Mapping=tex-ansi]{$monofont$} 37$endif$ 38$if(mathfont)$ 39 \setmathfont(Digits,Latin,Greek){$mathfont$} 40$endif$ 41\fi 42% use upquote if available, for straight quotes in verbatim environments 43\IfFileExists{upquote.sty}{\usepackage{upquote}}{} 44% use microtype if available 45\IfFileExists{microtype.sty}{% 46\usepackage{microtype} 47\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts 48}{} 49$if(geometry)$ 50\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry} 51$endif$ 52$if(lang)$ 53\ifxetex 54 \usepackage{polyglossia} 55 \setmainlanguage{$mainlang$} 56\else 57 \usepackage[shorthands=off,$lang$]{babel} 58\fi 59$endif$ 60$if(natbib)$ 61\usepackage{natbib} 62\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$} 63$endif$ 64$if(biblatex)$ 65\usepackage{biblatex} 66$if(biblio-files)$ 67\bibliography{$biblio-files$} 68$endif$ 69$endif$ 70$if(listings)$ 71\usepackage{listings} 72$endif$ 73$if(lhs)$ 74\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{} 75$endif$ 76$if(highlighting-macros)$ 77$highlighting-macros$ 78$endif$ 79$if(verbatim-in-note)$ 80\usepackage{fancyvrb} 81\VerbatimFootnotes 82$endif$ 83$if(tables)$ 84\usepackage{longtable,booktabs} 85$endif$ 86$if(graphics)$ 87\usepackage{graphicx} 88\makeatletter 89\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} 90\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi} 91\makeatother 92% Scale images if necessary, so that they will not overflow the page 93% margins by default, and it is still possible to overwrite the defaults 94% using explicit options in \includegraphics[width, height, ...]{} 95\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} 96$endif$ 97\ifxetex 98 \usepackage[setpagesize=false, % page size defined by xetex 99 unicode=false, % unicode breaks when used with xetex 100 xetex]{hyperref} 101\else 102 \usepackage[unicode=true]{hyperref} 103\fi 104\hypersetup{breaklinks=true, 105 bookmarks=true, 106 pdfauthor={$author-meta$}, 107 pdftitle={$title-meta$}, 108 colorlinks=true, 109 citecolor=$if(citecolor)$$citecolor$$else$blue$endif$, 110 urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$, 111 linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$, 112 pdfborder={0 0 0}} 113\urlstyle{same} % don't use monospace font for urls 114$if(links-as-notes)$ 115% Make links footnotes instead of hotlinks: 116\renewcommand{\href}[2]{#2\footnote{\url{#1}}} 117$endif$ 118$if(strikeout)$ 119\usepackage[normalem]{ulem} 120% avoid problems with \sout in headers with hyperref: 121\pdfstringdefDisableCommands{\renewcommand{\sout}{}} 122$endif$ 123\setlength{\parindent}{0pt} 124\setlength{\parskip}{6pt plus 2pt minus 1pt} 125\setlength{\emergencystretch}{3em} % prevent overfull lines 126$if(numbersections)$ 127\setcounter{secnumdepth}{5} 128$else$ 129\setcounter{secnumdepth}{0} 130$endif$ 131$if(verbatim-in-note)$ 132\VerbatimFootnotes % allows verbatim text in footnotes 133$endif$ 134 135$if(title)$ 136\title{$title$$if(subtitle)$\\\vspace{0.5em}{\large $subtitle$}$endif$} 137$endif$ 138$if(author)$ 139\author{$for(author)$$author$$sep$ \and $endfor$} 140$endif$ 141$for(header-includes)$ 142$header-includes$ 143$endfor$ 144 145\providecommand{\tightlist}{% 146 \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} 147 148\begin{document} 149$if(title)$ 150\maketitle 151$endif$ 152$if(abstract)$ 153\begin{abstract} 154$abstract$ 155\end{abstract} 156$endif$ 157 158$for(include-before)$ 159$include-before$ 160 161$endfor$ 162$if(toc)$ 163{ 164\hypersetup{linkcolor=black} 165\setcounter{tocdepth}{$toc-depth$} 166\tableofcontents 167} 168$endif$ 169$if(lot)$ 170\listoftables 171$endif$ 172$if(lof)$ 173\listoffigures 174$endif$ 175$body$ 176 177$if(natbib)$ 178$if(biblio-files)$ 179$if(biblio-title)$ 180$if(book-class)$ 181\renewcommand\bibname{$biblio-title$} 182$else$ 183\renewcommand\refname{$biblio-title$} 184$endif$ 185$endif$ 186\bibliography{$biblio-files$} 187 188$endif$ 189$endif$ 190$if(biblatex)$ 191\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$ 192 193$endif$ 194$for(include-after)$ 195$include-after$ 196 197$endfor$ 198\end{document} 199