default.latex 5.2 KB

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