default.latex 5.4 KB

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