aboutsummaryrefslogtreecommitdiff
path: root/tools/template.tex
blob: 64893c24cbf627474be55d26b6bdaae5fa1f9b6d (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. \providecommand{\tightlist}{%
  48. \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
  49. $if(natbib)$
  50. \usepackage{natbib}
  51. \bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
  52. $endif$
  53. $if(biblatex)$
  54. \usepackage{biblatex}
  55. $if(biblio-files)$
  56. \bibliography{$biblio-files$}
  57. $endif$
  58. $endif$
  59. $if(listings)$
  60. \usepackage{listings}
  61. $endif$
  62. $if(lhs)$
  63. \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
  64. $endif$
  65. \usepackage{fancyvrb}
  66. $if(highlighting-macros)$
  67. $highlighting-macros$
  68. $endif$
  69. \usepackage{color,framed}
  70. $if(verbatim-in-note)$
  71. \usepackage{fancyvrb}
  72. $endif$
  73. $if(tables)$
  74. \usepackage{longtable,booktabs}
  75. $endif$
  76. $if(graphics)$
  77. \usepackage{graphicx}
  78. \makeatletter
  79. \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
  80. \def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
  81. \makeatother
  82. % Scale images if necessary, so that they will not overflow the page
  83. % margins by default, and it is still possible to overwrite the defaults
  84. % using explicit options in \includegraphics[width, height, ...]{}
  85. \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
  86. $endif$
  87. \ifxetex
  88. \usepackage[setpagesize=false, % page size defined by xetex
  89. unicode=false, % unicode breaks when used with xetex
  90. xetex]{hyperref}
  91. \else
  92. \usepackage[unicode=true]{hyperref}
  93. \fi
  94. \hypersetup{breaklinks=true,
  95. bookmarks=true,
  96. pdfauthor={$author-meta$},
  97. pdftitle={$title-meta$},
  98. colorlinks=true,
  99. citecolor=$if(citecolor)$$citecolor$$else$blue$endif$,
  100. urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
  101. linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
  102. pdfborder={0 0 0}}
  103. \urlstyle{same} % don't use monospace font for urls
  104. $if(links-as-notes)$
  105. % Make links footnotes instead of hotlinks:
  106. \renewcommand{\href}[2]{#2\footnote{\url{#1}}}
  107. $endif$
  108. $if(strikeout)$
  109. \usepackage[normalem]{ulem}
  110. % avoid problems with \sout in headers with hyperref:
  111. \pdfstringdefDisableCommands{\renewcommand{\sout}{}}
  112. $endif$
  113. \setlength{\parindent}{0pt}
  114. \setlength{\parskip}{6pt plus 2pt minus 1pt}
  115. \setlength{\emergencystretch}{3em} % prevent overfull lines
  116. $if(numbersections)$
  117. \setcounter{secnumdepth}{5}
  118. $else$
  119. \setcounter{secnumdepth}{0}
  120. $endif$
  121. $if(verbatim-in-note)$
  122. \VerbatimFootnotes % allows verbatim text in footnotes
  123. $endif$
  124. $if(lang)$
  125. \ifxetex
  126. \usepackage{polyglossia}
  127. \setmainlanguage{$mainlang$}
  128. \else
  129. \usepackage[$lang$]{babel}
  130. \fi
  131. $endif$
  132. \usepackage[small]{titlesec}
  133. \titleformat{\chapter}
  134. {\Large\bfseries} % format
  135. {\Large\thechapter} % label
  136. {0pt} % sep
  137. {\Large} % before-code
  138. \usepackage{fancyhdr}
  139. \pagestyle{fancy}
  140. \pagenumbering{arabic}
  141. \lhead{\itshape $title$}
  142. \chead{}
  143. \rhead{\itshape{\nouppercase{\rightmark}}}
  144. \lfoot{v$version$ ($date$)}
  145. \cfoot{}
  146. \rfoot{\thepage}
  147. $if(title)$
  148. \title{$title$$if(subtitle)$\\\vspace{0.5em}{\large $subtitle$}$endif$}
  149. $endif$
  150. $if(author)$
  151. \author{$for(author)$$author$$sep$ \and $endfor$}
  152. $endif$
  153. \date{$date$}
  154. $for(header-includes)$
  155. $header-includes$
  156. $endfor$
  157. \begin{document}
  158. $if(title)$
  159. \maketitle
  160. $endif$
  161. $if(abstract)$
  162. \begin{abstract}
  163. $abstract$
  164. \end{abstract}
  165. $endif$
  166. $for(include-before)$
  167. $include-before$
  168. $endfor$
  169. $if(toc)$
  170. {
  171. \hypersetup{linkcolor=black}
  172. \setcounter{tocdepth}{$toc-depth$}
  173. \tableofcontents
  174. }
  175. $endif$
  176. $body$
  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. $endif$
  188. $endif$
  189. $if(biblatex)$
  190. \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
  191. $endif$
  192. $for(include-after)$
  193. $include-after$
  194. $endfor$
  195. \end{document}