aboutsummaryrefslogtreecommitdiff
path: root/tools/template.tex
blob: 13d38a3ac3d38e0e73af92f25940be3c169f4c41 (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$\\
  149. Version $version$}
  150. $endif$
  151. $if(author)$
  152. \author{$for(author)$$author$$sep$ \and $endfor$}
  153. $endif$
  154. \date{$date$}
  155. $for(header-includes)$
  156. $header-includes$
  157. $endfor$
  158. \begin{document}
  159. $if(title)$
  160. \maketitle
  161. $endif$
  162. $if(abstract)$
  163. \begin{abstract}
  164. $abstract$
  165. \end{abstract}
  166. $endif$
  167. $for(include-before)$
  168. $include-before$
  169. $endfor$
  170. $if(toc)$
  171. {
  172. \hypersetup{linkcolor=black}
  173. \setcounter{tocdepth}{$toc-depth$}
  174. \tableofcontents
  175. }
  176. $endif$
  177. $body$
  178. $if(natbib)$
  179. $if(biblio-files)$
  180. $if(biblio-title)$
  181. $if(book-class)$
  182. \renewcommand\bibname{$biblio-title$}
  183. $else$
  184. \renewcommand\refname{$biblio-title$}
  185. $endif$
  186. $endif$
  187. \bibliography{$biblio-files$}
  188. $endif$
  189. $endif$
  190. $if(biblatex)$
  191. \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
  192. $endif$
  193. $for(include-after)$
  194. $include-after$
  195. $endfor$
  196. \end{document}