aboutsummaryrefslogtreecommitdiff
path: root/tools/template.tex
blob: d083b7234a4db53b89acd00f9082999fb2ac81cd (plain)
  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}{\usepackage{microtype}}{}
  46. \usepackage[margin=1in]{geometry}
  47. $if(natbib)$
  48. \usepackage{natbib}
  49. \bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
  50. $endif$
  51. $if(biblatex)$
  52. \usepackage{biblatex}
  53. $if(biblio-files)$
  54. \bibliography{$biblio-files$}
  55. $endif$
  56. $endif$
  57. $if(listings)$
  58. \usepackage{listings}
  59. $endif$
  60. $if(lhs)$
  61. \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
  62. $endif$
  63. \usepackage{fancyvrb}
  64. \usepackage{color,framed}
  65. \newcommand{\VerbBar}{|}
  66. \newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
  67. \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\},fontsize=\small}
  68. % Add ',fontsize=\small' for more characters per line
  69. \definecolor{shadecolor}{gray}{1}
  70. \newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
  71. \newcommand{\NormalTok}[1]{{#1}}
  72. \let\KeywordTok\NormalTok
  73. \let\DataTypeTok\NormalTok
  74. \let\DecValTok\NormalTok
  75. \let\BaseNTok\NormalTok
  76. \let\FloatTok\NormalTok
  77. \let\CharTok\NormalTok
  78. \let\StringTok\NormalTok
  79. \let\CommentTok\NormalTok
  80. \let\OtherTok\NormalTok
  81. \let\AlertTok\NormalTok
  82. \let\FunctionTok\NormalTok
  83. \let\RegionMarkerTok\NormalTok
  84. \let\ErrorTok\NormalTok
  85. %\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
  86. %\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}}
  87. %\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
  88. %\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
  89. %\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
  90. %\newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
  91. %\newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
  92. %\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}}
  93. %\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
  94. %\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
  95. %\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}}
  96. %\newcommand{\RegionMarkerTok}[1]{{#1}}
  97. %\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
  98. $if(verbatim-in-note)$
  99. \usepackage{fancyvrb}
  100. $endif$
  101. $if(tables)$
  102. \usepackage{longtable,booktabs}
  103. $endif$
  104. $if(graphics)$
  105. \usepackage{graphicx}
  106. \makeatletter
  107. \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
  108. \def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
  109. \makeatother
  110. % Scale images if necessary, so that they will not overflow the page
  111. % margins by default, and it is still possible to overwrite the defaults
  112. % using explicit options in \includegraphics[width, height, ...]{}
  113. \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
  114. $endif$
  115. \ifxetex
  116. \usepackage[setpagesize=false, % page size defined by xetex
  117. unicode=false, % unicode breaks when used with xetex
  118. xetex]{hyperref}
  119. \else
  120. \usepackage[unicode=true]{hyperref}
  121. \fi
  122. \hypersetup{breaklinks=true,
  123. bookmarks=true,
  124. pdfauthor={$author-meta$},
  125. pdftitle={$title-meta$},
  126. colorlinks=true,
  127. citecolor=$if(citecolor)$$citecolor$$else$blue$endif$,
  128. urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
  129. linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
  130. pdfborder={0 0 0}}
  131. \urlstyle{same} % don't use monospace font for urls
  132. $if(links-as-notes)$
  133. % Make links footnotes instead of hotlinks:
  134. \renewcommand{\href}[2]{#2\footnote{\url{#1}}}
  135. $endif$
  136. $if(strikeout)$
  137. \usepackage[normalem]{ulem}
  138. % avoid problems with \sout in headers with hyperref:
  139. \pdfstringdefDisableCommands{\renewcommand{\sout}{}}
  140. $endif$
  141. \setlength{\parindent}{0pt}
  142. \setlength{\parskip}{6pt plus 2pt minus 1pt}
  143. \setlength{\emergencystretch}{3em} % prevent overfull lines
  144. $if(numbersections)$
  145. \setcounter{secnumdepth}{5}
  146. $else$
  147. \setcounter{secnumdepth}{0}
  148. $endif$
  149. $if(verbatim-in-note)$
  150. \VerbatimFootnotes % allows verbatim text in footnotes
  151. $endif$
  152. $if(lang)$
  153. \ifxetex
  154. \usepackage{polyglossia}
  155. \setmainlanguage{$mainlang$}
  156. \else
  157. \usepackage[$lang$]{babel}
  158. \fi
  159. $endif$
  160. \usepackage{titlesec}
  161. \titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter\ }{0pt}{\Huge\bfseries}
  162. \usepackage{fancyhdr}
  163. \pagestyle{fancy}
  164. \pagenumbering{arabic}
  165. \lhead{\itshape $title$}
  166. \chead{}
  167. \rhead{\itshape{\nouppercase{\rightmark}}}
  168. \lfoot{v$version$ ($date$)}
  169. \cfoot{}
  170. \rfoot{\thepage}
  171. $if(title)$
  172. \title{$title$$if(subtitle)$\\\vspace{0.5em}{\large $subtitle$}$endif$}
  173. $endif$
  174. $if(author)$
  175. \author{$for(author)$$author$$sep$ \and $endfor$}
  176. $endif$
  177. \date{$date$}
  178. $for(header-includes)$
  179. $header-includes$
  180. $endfor$
  181. \begin{document}
  182. $if(title)$
  183. \maketitle
  184. $endif$
  185. $if(abstract)$
  186. \begin{abstract}
  187. $abstract$
  188. \end{abstract}
  189. $endif$
  190. $for(include-before)$
  191. $include-before$
  192. $endfor$
  193. $if(toc)$
  194. {
  195. \hypersetup{linkcolor=black}
  196. \setcounter{tocdepth}{$toc-depth$}
  197. \tableofcontents
  198. }
  199. $endif$
  200. $body$
  201. $if(natbib)$
  202. $if(biblio-files)$
  203. $if(biblio-title)$
  204. $if(book-class)$
  205. \renewcommand\bibname{$biblio-title$}
  206. $else$
  207. \renewcommand\refname{$biblio-title$}
  208. $endif$
  209. $endif$
  210. \bibliography{$biblio-files$}
  211. $endif$
  212. $endif$
  213. $if(biblatex)$
  214. \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
  215. $endif$
  216. $for(include-after)$
  217. $include-after$
  218. $endfor$
  219. \end{document}