1\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
2\PassOptionsToPackage{hyphens}{url}
3$if(colorlinks)$
4\PassOptionsToPackage{dvipsnames,svgnames*,x11names*}{xcolor}
5$endif$$if(dir)$$if(latex-dir-rtl)$
6\PassOptionsToPackage{RTLdocument}{bidi}
7$endif$$endif$%
8\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$babel-lang$,$endif$$if(papersize)$$papersize$paper,$endif$$if(beamer)$ignorenonframetext,$if(handout)$handout,$endif$$if(aspectratio)$aspectratio=$aspectratio$,$endif$$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
9$if(beamer)$
10$if(background-image)$
11\usebackgroundtemplate{%
12\includegraphics[width=\paperwidth]{$background-image$}%
13}
14$endif$
15\usepackage{pgfpages}
16\setbeamertemplate{caption}[numbered]
17\setbeamertemplate{caption label separator}{: }
18\setbeamercolor{caption name}{fg=normal text.fg}
19\beamertemplatenavigationsymbols$if(navigation)$$navigation$$else$empty$endif$
20$for(beameroption)$
21\setbeameroption{$beameroption$}
22$endfor$
23$endif$
24$if(beamerarticle)$
25\usepackage{beamerarticle} % needs to be loaded first
26$endif$
27$if(fontfamily)$
28\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
29$else$
30\usepackage{lmodern}
31$endif$
32$if(linestretch)$
33\usepackage{setspace}
34\setstretch{$linestretch$}
35$endif$
36\usepackage{amssymb,amsmath}
37\usepackage{ifxetex,ifluatex}
38\usepackage{fixltx2e} % provides \textsubscript
39\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
40 \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
41 \usepackage[utf8]{inputenc}
42 \usepackage{textcomp} % provides euro and other symbols
43\else % if luatex or xelatex
44$if(mathspec)$
45 \ifxetex
46 \usepackage{mathspec}
47 \else
48 \usepackage{unicode-math}
49 \fi
50$else$
51 \usepackage{unicode-math}
52$endif$
53 \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
54$for(fontfamilies)$
55 \newfontfamily{$fontfamilies.name$}[$fontfamilies.options$]{$fontfamilies.font$}
56$endfor$
57$if(mainfont)$
58 \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
59$endif$
60$if(sansfont)$
61 \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
62$endif$
63$if(monofont)$
64 \setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$endif$]{$monofont$}
65$endif$
66$if(mathfont)$
67$if(mathspec)$
68 \ifxetex
69 \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
70 \else
71 \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
72 \fi
73$else$
74 \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
75$endif$
76$endif$
77$if(CJKmainfont)$
78 \ifxetex
79 \usepackage{xeCJK}
80 \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
81 \fi
82$endif$
83$if(luatexjapresetoptions)$
84 \ifluatex
85 \usepackage[$for(luatexjapresetoptions)$$luatexjapresetoptions$$sep$,$endfor$]{luatexja-preset}
86 \fi
87$endif$
88$if(CJKmainfont)$
89 \ifluatex
90 \usepackage[$for(luatexjafontspecoptions)$$luatexjafontspecoptions$$sep$,$endfor$]{luatexja-fontspec}
91 \setmainjfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
92 \fi
93$endif$
94\fi
95$if(beamer)$
96$if(theme)$
97\usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$}
98$endif$
99$if(colortheme)$
100\usecolortheme{$colortheme$}
101$endif$
102$if(fonttheme)$
103\usefonttheme{$fonttheme$}
104$endif$
105$if(mainfont)$
106\usefonttheme{serif} % use mainfont rather than sansfont for slide text
107$endif$
108$if(innertheme)$
109\useinnertheme{$innertheme$}
110$endif$
111$if(outertheme)$
112\useoutertheme{$outertheme$}
113$endif$
114$endif$
115% use upquote if available, for straight quotes in verbatim environments
116\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
117% use microtype if available
118\IfFileExists{microtype.sty}{%
119\usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype}
120\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
121}{}
122$if(indent)$
123$else$
124\IfFileExists{parskip.sty}{%
125\usepackage{parskip}
126}{% else
127\setlength{\parindent}{0pt}
128\setlength{\parskip}{6pt plus 2pt minus 1pt}
129}
130$endif$
131$if(verbatim-in-note)$
132\usepackage{fancyvrb}
133$endif$
134$if(colorlinks)$
135\usepackage{xcolor}
136$endif$
137\usepackage{hyperref}
138\hypersetup{
139$if(title-meta)$
140 pdftitle={$title-meta$},
141$endif$
142$if(author-meta)$
143 pdfauthor={$author-meta$},
144$endif$
145$if(keywords)$
146 pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$},
147$endif$
148$if(colorlinks)$
149 colorlinks=true,
150 linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$,
151 citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$,
152 urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$,
153$else$
154 pdfborder={0 0 0},
155$endif$
156 breaklinks=true}
157\urlstyle{same} % don't use monospace font for urls
158$if(verbatim-in-note)$
159\VerbatimFootnotes % allows verbatim text in footnotes
160$endif$
161$if(geometry)$
162\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
163$endif$
164$if(beamer)$
165\newif\ifbibliography
166$endif$
167$if(listings)$
168\usepackage{listings}
169\newcommand{\passthrough}[1]{#1}
170$endif$
171$if(columns)$
172\usepackage{multicol}
173\newcommand{\columnsbegin}{\begin{multicols}{$columns$}}
174\newcommand{\columnsend}{\end{multicols}}
175\setlength\columnsep{20pt}
176$endif$
177$if(lhs)$
178\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
179$endif$
180$if(highlighting-macros)$
181$highlighting-macros$
182$endif$
183$if(tables)$
184\usepackage{longtable, booktabs}
185$if(beamer)$
186\usepackage{caption}
187% These lines are needed to make table captions work with longtable:
188\makeatletter
189\def\fnum@table{\tablename~\thetable}
190\makeatother
191$else$
192% Fix footnotes in tables (requires footnote package)
193\IfFileExists{footnote.sty}{\usepackage{footnote}\makesavenoteenv{longtable}}{}
194$endif$
195$endif$
196$if(graphics)$
197\usepackage{graphicx,grffile}
198\makeatletter
199\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
200\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
201\makeatother
202% Scale images if necessary, so that they will not overflow the page
203% margins by default, and it is still possible to overwrite the defaults
204% using explicit options in \includegraphics[width, height, ...]{}
205\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
206$endif$
207$if(beamer)$
208% Prevent slide breaks in the middle of a paragraph:
209\widowpenalties 1 10000
210\raggedbottom
211$if(section-titles)$
212\setbeamertemplate{part page}{
213\centering
214\begin{beamercolorbox}[sep=16pt,center]{part title}
215 \usebeamerfont{part title}\insertpart\par
216\end{beamercolorbox}
217}
218\setbeamertemplate{section page}{
219\centering
220\begin{beamercolorbox}[sep=12pt,center]{part title}
221 \usebeamerfont{section title}\insertsection\par
222\end{beamercolorbox}
223}
224\setbeamertemplate{subsection page}{
225\centering
226\begin{beamercolorbox}[sep=8pt,center]{part title}
227 \usebeamerfont{subsection title}\insertsubsection\par
228\end{beamercolorbox}
229}
230\AtBeginPart{
231 \frame{\partpage}
232}
233\AtBeginSection{
234 \ifbibliography
235 \else
236 \frame{\sectionpage}
237 \fi
238}
239\AtBeginSubsection{
240 \frame{\subsectionpage}
241}
242$endif$
243$endif$
244$if(links-as-notes)$
245% Make links footnotes instead of hotlinks:
246\DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}}
247$endif$
248$if(strikeout)$
249\usepackage[normalem]{ulem}
250% avoid problems with \sout in headers with hyperref:
251\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
252$endif$
253\setlength{\emergencystretch}{3em} % prevent overfull lines
254\providecommand{\tightlist}{%
255 \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
256$if(numbersections)$
257\setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$}
258$else$
259\setcounter{secnumdepth}{0}
260$endif$
261$if(beamer)$
262$else$
263$if(subparagraph)$
264$else$
265% Redefines (sub)paragraphs to behave more like sections
266\ifx\paragraph\undefined\else
267\let\oldparagraph\paragraph
268\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
269\fi
270\ifx\subparagraph\undefined\else
271\let\oldsubparagraph\subparagraph
272\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
273\fi
274$endif$
275$endif$
276$if(pagestyle)$
277\pagestyle{$pagestyle$}
278$endif$
279
280% set default figure placement to htbp
281\makeatletter
282\def\fps@figure{htbp}
283\makeatother
284
285$for(header-includes)$
286$header-includes$
287$endfor$
288$if(lang)$
289\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
290 \usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
291$if(babel-newcommands)$
292 $babel-newcommands$
293$endif$
294\else
295 % load polyglossia as late as possible as it *could* call bidi if RTL lang (e.g. Hebrew or Arabic)
296 \usepackage{polyglossia}
297 \setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$}
298$for(polyglossia-otherlangs)$
299 \setotherlanguage[$polyglossia-otherlangs.options$]{$polyglossia-otherlangs.name$}
300$endfor$
301\fi
302$endif$
303$if(dir)$
304\ifxetex
305 % load bidi as late as possible as it modifies e.g. graphicx
306 \usepackage{bidi}
307\fi
308\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
309 \TeXXeTstate=1
310 \newcommand{\RL}[1]{\beginR #1\endR}
311 \newcommand{\LR}[1]{\beginL #1\endL}
312 \newenvironment{RTL}{\beginR}{\endR}
313 \newenvironment{LTR}{\beginL}{\endL}
314\fi
315$endif$
316$if(natbib)$
317\usepackage[$natbiboptions$]{natbib}
318\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
319$endif$
320$if(biblatex)$
321\usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex}
322$for(bibliography)$
323\addbibresource{$bibliography$}
324$endfor$
325$endif$
326
327$if(title)$
328\title{$title$$if(thanks)$\thanks{$thanks$}$endif$}
329$endif$
330$if(subtitle)$
331\providecommand{\subtitle}[1]{}
332\subtitle{$subtitle$}
333$endif$
334$if(author)$
335\author{$for(author)$$author$$sep$ \and $endfor$}
336$endif$
337$if(institute)$
338\providecommand{\institute}[1]{}
339\institute{$for(institute)$$institute$$sep$ \and $endfor$}
340$endif$
341\date{$date$}
342$if(beamer)$
343$if(titlegraphic)$
344\titlegraphic{\includegraphics{$titlegraphic$}}
345$endif$
346$if(logo)$
347\logo{\includegraphics{$logo$}}
348$endif$
349$endif$
350
351\begin{document}
352$if(title)$
353$if(beamer)$
354\frame{\titlepage}
355$else$
356\maketitle
357$endif$
358$if(abstract)$
359\begin{abstract}
360$abstract$
361\end{abstract}
362$endif$
363$endif$
364
365$for(include-before)$
366$include-before$
367
368$endfor$
369$if(toc)$
370$if(beamer)$
371\begin{frame}
372\tableofcontents[hideallsubsections]
373\end{frame}
374$else$
375{
376$if(colorlinks)$
377\hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$$endif$}
378$endif$
379\setcounter{tocdepth}{$toc-depth$}
380\tableofcontents
381}
382$endif$
383$endif$
384$if(lot)$
385\listoftables
386$endif$
387$if(lof)$
388\listoffigures
389$endif$
390$if(columns)$
391\columnsbegin
392$endif$
393$body$
394$if(columns)$
395\columnsend
396$endif$
397$if(natbib)$
398$if(bibliography)$
399$if(biblio-title)$
400$if(book-class)$
401\renewcommand\bibname{$biblio-title$}
402$else$
403\renewcommand\refname{$biblio-title$}
404$endif$
405$endif$
406$if(beamer)$
407\begin{frame}[allowframebreaks]{$biblio-title$}
408\bibliographytrue
409$endif$
410\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
411$if(beamer)$
412\end{frame}
413$endif$
414
415$endif$
416$endif$
417$if(biblatex)$
418$if(beamer)$
419\begin{frame}[allowframebreaks]{$biblio-title$}
420\bibliographytrue
421\printbibliography[heading=none]
422\end{frame}
423$else$
424\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
425$endif$
426
427$endif$
428$for(include-after)$
429$include-after$
430
431$endfor$
432\end{document}