summaryrefslogtreecommitdiff
path: root/_templates/template.tex
blob: 3f82a77ffc16386280b213a7447b9eb669222781 (plain)
  1. % Options for packages loaded elsewhere
  2. \PassOptionsToPackage{unicode$for(hyperrefoptions)$,$hyperrefoptions$$endfor$}{hyperref}
  3. \PassOptionsToPackage{hyphens}{url}
  4. $if(colorlinks)$
  5. \PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor}
  6. $endif$
  7. $if(CJKmainfont)$
  8. \PassOptionsToPackage{space}{xeCJK}
  9. $endif$
  10. %
  11. $doc-class.tex()$
  12. $if(beamer)$
  13. $if(background-image)$
  14. \usebackgroundtemplate{%
  15.   \includegraphics[width=\paperwidth]{$background-image$}%
  16. }
  17. % In beamer background-image does not work well when other images are used, so this is the workaround
  18. \pgfdeclareimage[width=\paperwidth,height=\paperheight]{background}{$background-image$}
  19. \usebackgroundtemplate{\pgfuseimage{background}}
  20. $endif$
  21. \usepackage{pgfpages}
  22. \setbeamertemplate{caption}[numbered]
  23. \setbeamertemplate{caption label separator}{: }
  24. \setbeamercolor{caption name}{fg=normal text.fg}
  25. \beamertemplatenavigationsymbols$if(navigation)$$navigation$$else$empty$endif$
  26. $for(beameroption)$
  27. \setbeameroption{$beameroption$}
  28. $endfor$
  29. % Prevent slide breaks in the middle of a paragraph
  30. \widowpenalties 1 10000
  31. \raggedbottom
  32. $if(section-titles)$
  33. \setbeamertemplate{part page}{
  34. \centering
  35. \begin{beamercolorbox}[sep=16pt,center]{part title}
  36. \usebeamerfont{part title}\insertpart\par
  37. \end{beamercolorbox}
  38. }
  39. \setbeamertemplate{section page}{
  40. \centering
  41. \begin{beamercolorbox}[sep=12pt,center]{part title}
  42. \usebeamerfont{section title}\insertsection\par
  43. \end{beamercolorbox}
  44. }
  45. \setbeamertemplate{subsection page}{
  46. \centering
  47. \begin{beamercolorbox}[sep=8pt,center]{part title}
  48. \usebeamerfont{subsection title}\insertsubsection\par
  49. \end{beamercolorbox}
  50. }
  51. \AtBeginPart{
  52. \frame{\partpage}
  53. }
  54. \AtBeginSection{
  55. \ifbibliography
  56. \else
  57. \frame{\sectionpage}
  58. \fi
  59. }
  60. \AtBeginSubsection{
  61. \frame{\subsectionpage}
  62. }
  63. $endif$
  64. $endif$
  65. $if(beamerarticle)$
  66. \usepackage{beamerarticle} % needs to be loaded first
  67. $endif$
  68. \usepackage{amsmath,amssymb}
  69. $if(linestretch)$
  70. \usepackage{setspace}
  71. $endif$
  72. \usepackage{iftex}
  73. \ifPDFTeX
  74. \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
  75. \usepackage[utf8]{inputenc}
  76. \usepackage{textcomp} % provide euro and other symbols
  77. \else % if luatex or xetex
  78. $if(mathspec)$
  79. \ifXeTeX
  80. \usepackage{mathspec} % this also loads fontspec
  81. \else
  82. \usepackage{unicode-math} % this also loads fontspec
  83. \fi
  84. $else$
  85. \usepackage{unicode-math}
  86. $endif$
  87. \defaultfontfeatures{Scale=MatchLowercase}$-- must come before Beamer theme
  88. \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
  89. \fi
  90. $if(fontfamily)$
  91. $else$
  92. $-- Set default font before Beamer theme so the theme can override it
  93. \usepackage{lmodern}
  94. $endif$
  95. $-- Set Beamer theme before user font settings so they can override theme
  96. $if(beamer)$
  97. $if(theme)$
  98. \usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$}
  99. $endif$
  100. $if(colortheme)$
  101. \usecolortheme{$colortheme$}
  102. $endif$
  103. $if(fonttheme)$
  104. \usefonttheme{$fonttheme$}
  105. $endif$
  106. $if(mainfont)$
  107. \usefonttheme{serif} % use mainfont rather than sansfont for slide text
  108. $endif$
  109. $if(innertheme)$
  110. \useinnertheme{$innertheme$}
  111. $endif$
  112. $if(outertheme)$
  113. \useoutertheme{$outertheme$}
  114. $endif$
  115. $endif$
  116. $-- User font settings (must come after default font and Beamer theme)
  117. $if(fontfamily)$
  118. \usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
  119. $endif$
  120. \ifPDFTeX\else
  121. % xetex/luatex font selection
  122. $if(mainfont)$
  123. \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
  124. $endif$
  125. $if(sansfont)$
  126. \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
  127. $endif$
  128. $if(monofont)$
  129. \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$]{$monofont$}
  130. $endif$
  131. $for(fontfamilies)$
  132. \newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$}
  133. $endfor$
  134. $if(mathfont)$
  135. $if(mathspec)$
  136. \ifXeTeX
  137. \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
  138. \else
  139. \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
  140. \fi
  141. $else$
  142. \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
  143. $endif$
  144. $endif$
  145. $if(CJKmainfont)$
  146. \ifXeTeX
  147. \usepackage{xeCJK}
  148. \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
  149. $if(CJKsansfont)$
  150. \setCJKsansfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKsansfont$}
  151. $endif$
  152. $if(CJKmonofont)$
  153. \setCJKmonofont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmonofont$}
  154. $endif$
  155. \fi
  156. $endif$
  157. $if(luatexjapresetoptions)$
  158. \ifLuaTeX
  159. \usepackage[$for(luatexjapresetoptions)$$luatexjapresetoptions$$sep$,$endfor$]{luatexja-preset}
  160. \fi
  161. $endif$
  162. $if(CJKmainfont)$
  163. \ifLuaTeX
  164. \usepackage[$for(luatexjafontspecoptions)$$luatexjafontspecoptions$$sep$,$endfor$]{luatexja-fontspec}
  165. \setmainjfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
  166. \fi
  167. $endif$
  168. \fi
  169. $if(zero-width-non-joiner)$
  170. %% Support for zero-width non-joiner characters.
  171. \makeatletter
  172. \def\zerowidthnonjoiner{%
  173. % Prevent ligatures and adjust kerning, but still support hyphenating.
  174. \texorpdfstring{%
  175. \TextOrMath{\nobreak\discretionary{-}{}{\kern.03em}%
  176. \ifvmode\else\nobreak\hskip\z@skip\fi}{}%
  177. }{}%
  178. }
  179. \makeatother
  180. \ifPDFTeX
  181. \DeclareUnicodeCharacter{200C}{\zerowidthnonjoiner}
  182. \else
  183. \catcode`^^^^200c=\active
  184. \protected\def ^^^^200c{\zerowidthnonjoiner}
  185. \fi
  186. %% End of ZWNJ support
  187. $endif$
  188. % Use upquote if available, for straight quotes in verbatim environments
  189. \IfFileExists{upquote.sty}{\usepackage{upquote}}{}
  190. \IfFileExists{microtype.sty}{% use microtype if available
  191. \usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype}
  192. \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
  193. }{}
  194. $if(indent)$
  195. $else$
  196. \makeatletter
  197. \@ifundefined{KOMAClassName}{% if non-KOMA class
  198. \IfFileExists{parskip.sty}{%
  199. \usepackage{parskip}
  200. }{% else
  201. \setlength{\parindent}{0pt}
  202. \setlength{\parskip}{6pt plus 2pt minus 1pt}}
  203. }{% if KOMA class
  204. \KOMAoptions{parskip=half}}
  205. \makeatother
  206. $endif$
  207. $if(verbatim-in-note)$
  208. \usepackage{fancyvrb}
  209. $endif$
  210. \usepackage{xcolor}
  211. $if(geometry)$
  212. $if(beamer)$
  213. \geometry{$for(geometry)$$geometry$$sep$,$endfor$}
  214. $else$
  215. \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
  216. $endif$
  217. $endif$
  218. $if(beamer)$
  219. \newif\ifbibliography
  220. $endif$
  221. $if(listings)$
  222. \usepackage{listings}
  223. \newcommand{\passthrough}[1]{#1}
  224. \lstset{defaultdialect=[5.3]Lua}
  225. \lstset{defaultdialect=[x86masm]Assembler}
  226. $endif$
  227. $if(lhs)$
  228. \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
  229. $endif$
  230. $if(svg)$
  231. \usepackage{svg}
  232. $endif$
  233. $if(strikeout)$
  234. $-- also used for underline
  235. \ifLuaTeX
  236. \usepackage{luacolor}
  237. \usepackage[soul]{lua-ul}
  238. \else
  239. \usepackage{soul}
  240. $if(CJKmainfont)$
  241. \ifXeTeX
  242. % soul's \st doesn't work for CJK:
  243. \usepackage{xeCJKfntef}
  244. \renewcommand{\st}[1]{\sout{#1}}
  245. \fi
  246. $endif$
  247. \fi
  248. $endif$
  249. \setlength{\emergencystretch}{3em} % prevent overfull lines
  250. $if(numbersections)$
  251. \setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$}
  252. $else$
  253. \setcounter{secnumdepth}{-\maxdimen} % remove section numbering
  254. $endif$
  255. $if(beamer)$
  256. $else$
  257. $if(block-headings)$
  258. % Make \paragraph and \subparagraph free-standing
  259. \ifx\paragraph\undefined\else
  260. \let\oldparagraph\paragraph
  261. \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
  262. \fi
  263. \ifx\subparagraph\undefined\else
  264. \let\oldsubparagraph\subparagraph
  265. \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
  266. \fi
  267. $endif$
  268. $endif$
  269. $if(pagestyle)$
  270. \pagestyle{$pagestyle$}
  271. $endif$
  272. $pandoc.tex()$
  273. $if(lang)$
  274. \ifLuaTeX
  275. \usepackage[bidi=basic]{babel}
  276. \else
  277. \usepackage[bidi=default]{babel}
  278. \fi
  279. $if(babel-lang)$
  280. \babelprovide[main,import]{$babel-lang$}
  281. $if(mainfont)$
  282. \ifPDFTeX
  283. \else
  284. \babelfont{rm}[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
  285. \fi
  286. $endif$
  287. $endif$
  288. $for(babel-otherlangs)$
  289. \babelprovide[import]{$babel-otherlangs$}
  290. $endfor$
  291. $for(babelfonts/pairs)$
  292. \babelfont[$babelfonts.key$]{rm}{$babelfonts.value$}
  293. $endfor$
  294. % get rid of language-specific shorthands (see #6817):
  295. \let\LanguageShortHands\languageshorthands
  296. \def\languageshorthands#1{}
  297. $endif$
  298. \ifLuaTeX
  299. \usepackage{selnolig} % disable illegal ligatures
  300. \fi
  301. $if(dir)$
  302. \ifPDFTeX
  303. \TeXXeTstate=1
  304. \newcommand{\RL}[1]{\beginR #1\endR}
  305. \newcommand{\LR}[1]{\beginL #1\endL}
  306. \newenvironment{RTL}{\beginR}{\endR}
  307. \newenvironment{LTR}{\beginL}{\endL}
  308. \fi
  309. $endif$
  310. $if(biblio-config)$
  311. $if(natbib)$
  312. \usepackage[$natbiboptions$]{natbib}
  313. \bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
  314. $endif$
  315. $if(biblatex)$
  316. \usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex}
  317. $for(bibliography)$
  318. \addbibresource{$bibliography$}
  319. $endfor$
  320. $endif$
  321. $endif$
  322. $if(nocite-ids)$
  323. \nocite{$for(nocite-ids)$$it$$sep$, $endfor$}
  324. $endif$
  325. $if(csquotes)$
  326. \usepackage{csquotes}
  327. $endif$
  328. \usepackage{bookmark}
  329. \IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
  330. \urlstyle{same} % disable monospaced font for URLs
  331. $if(links-as-notes)$
  332. % Make links footnotes instead of hotlinks:
  333. \DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}}
  334. $endif$
  335. $if(verbatim-in-note)$
  336. \VerbatimFootnotes % allow verbatim text in footnotes
  337. $endif$
  338. \hypersetup{
  339. $if(title-meta)$
  340. pdftitle={$title-meta$},
  341. $endif$
  342. $if(author-meta)$
  343. pdfauthor={$for(by-author)$$if(it.attributes.equal-contributor)$$it.name.literal$$endif$$sep$,$endfor$},
  344. $endif$
  345. $if(lang)$
  346. pdflang={$lang$},
  347. $endif$
  348. $if(subject)$
  349. pdfsubject={$subject$},
  350. $endif$
  351. $if(keywords)$
  352. pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$},
  353. $endif$
  354. $if(colorlinks)$
  355. colorlinks=true,
  356. linkcolor={$if(linkcolor)$$linkcolor$$else$Maroon$endif$},
  357. filecolor={$if(filecolor)$$filecolor$$else$Maroon$endif$},
  358. citecolor={$if(citecolor)$$citecolor$$else$Blue$endif$},
  359. urlcolor={$if(urlcolor)$$urlcolor$$else$Blue$endif$},
  360. $else$
  361. $if(boxlinks)$
  362. $else$
  363. hidelinks,
  364. $endif$
  365. $endif$
  366. pdfcreator={LaTeX via pandoc}}
  367. $before-title.tex()$
  368. $title.tex()$
  369. \begin{document}
  370. $before-body.tex()$
  371. $for(include-before)$
  372. $include-before$
  373. $endfor$
  374. $toc.tex()$
  375. $if(linestretch)$
  376. \setstretch{$linestretch$}
  377. $endif$
  378. $if(has-frontmatter)$
  379. \mainmatter
  380. $endif$
  381. $body$
  382. $before-bib.tex()$
  383. $if(has-frontmatter)$
  384. \backmatter
  385. $endif$
  386. $biblio.tex()$
  387. $for(include-after)$
  388. $include-after$
  389. $endfor$
  390. $after-body.tex()$
  391. \end{document}