aboutsummaryrefslogtreecommitdiff
path: root/templates/default.latex
blob: bd9fc59fa95ec779654eb1c97a39e436ed9af080 (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. \documentclass[
  12. $if(fontsize)$
  13. $fontsize$,
  14. $endif$
  15. $if(papersize)$
  16. $papersize$paper,
  17. $endif$
  18. $if(beamer)$
  19. ignorenonframetext,
  20. $if(handout)$
  21. handout,
  22. $endif$
  23. $if(aspectratio)$
  24. aspectratio=$aspectratio$,
  25. $endif$
  26. $endif$
  27. $for(classoption)$
  28. $classoption$$sep$,
  29. $endfor$
  30. ]{$documentclass$}
  31. $if(beamer)$
  32. $if(background-image)$
  33. \usebackgroundtemplate{%
  34. \includegraphics[width=\paperwidth]{$background-image$}%
  35. }
  36. $endif$
  37. \usepackage{pgfpages}
  38. \setbeamertemplate{caption}[numbered]
  39. \setbeamertemplate{caption label separator}{: }
  40. \setbeamercolor{caption name}{fg=normal text.fg}
  41. \beamertemplatenavigationsymbols$if(navigation)$$navigation$$else$empty$endif$
  42. $for(beameroption)$
  43. \setbeameroption{$beameroption$}
  44. $endfor$
  45. % Prevent slide breaks in the middle of a paragraph
  46. \widowpenalties 1 10000
  47. \raggedbottom
  48. $if(section-titles)$
  49. \setbeamertemplate{part page}{
  50. \centering
  51. \begin{beamercolorbox}[sep=16pt,center]{part title}
  52. \usebeamerfont{part title}\insertpart\par
  53. \end{beamercolorbox}
  54. }
  55. \setbeamertemplate{section page}{
  56. \centering
  57. \begin{beamercolorbox}[sep=12pt,center]{part title}
  58. \usebeamerfont{section title}\insertsection\par
  59. \end{beamercolorbox}
  60. }
  61. \setbeamertemplate{subsection page}{
  62. \centering
  63. \begin{beamercolorbox}[sep=8pt,center]{part title}
  64. \usebeamerfont{subsection title}\insertsubsection\par
  65. \end{beamercolorbox}
  66. }
  67. \AtBeginPart{
  68. \frame{\partpage}
  69. }
  70. \AtBeginSection{
  71. \ifbibliography
  72. \else
  73. \frame{\sectionpage}
  74. \fi
  75. }
  76. \AtBeginSubsection{
  77. \frame{\subsectionpage}
  78. }
  79. $endif$
  80. $endif$
  81. $if(beamerarticle)$
  82. \usepackage{beamerarticle} % needs to be loaded first
  83. $endif$
  84. \usepackage{amsmath,amssymb}
  85. $if(linestretch)$
  86. \usepackage{setspace}
  87. $endif$
  88. \usepackage{iftex}
  89. \ifPDFTeX
  90. \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
  91. \usepackage[utf8]{inputenc}
  92. \usepackage{textcomp} % provide euro and other symbols
  93. \else % if luatex or xetex
  94. $if(mathspec)$
  95. \ifXeTeX
  96. \usepackage{mathspec} % this also loads fontspec
  97. \else
  98. \usepackage{unicode-math} % this also loads fontspec
  99. \fi
  100. $else$
  101. \usepackage{unicode-math} % this also loads fontspec
  102. $endif$
  103. \defaultfontfeatures{Scale=MatchLowercase}$-- must come before Beamer theme
  104. \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
  105. \fi
  106. $if(fontfamily)$
  107. $else$
  108. $-- Set default font before Beamer theme so the theme can override it
  109. \usepackage{lmodern}
  110. $endif$
  111. $-- Set Beamer theme before user font settings so they can override theme
  112. $if(beamer)$
  113. $if(theme)$
  114. \usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$}
  115. $endif$
  116. $if(colortheme)$
  117. \usecolortheme{$colortheme$}
  118. $endif$
  119. $if(fonttheme)$
  120. \usefonttheme{$fonttheme$}
  121. $endif$
  122. $if(mainfont)$
  123. \usefonttheme{serif} % use mainfont rather than sansfont for slide text
  124. $endif$
  125. $if(innertheme)$
  126. \useinnertheme{$innertheme$}
  127. $endif$
  128. $if(outertheme)$
  129. \useoutertheme{$outertheme$}
  130. $endif$
  131. $endif$
  132. $-- User font settings (must come after default font and Beamer theme)
  133. $if(fontfamily)$
  134. \usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
  135. $endif$
  136. \ifPDFTeX\else
  137. % xetex/luatex font selection
  138. $if(mainfont)$
  139. \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
  140. $endif$
  141. $if(sansfont)$
  142. \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
  143. $endif$
  144. $if(monofont)$
  145. \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$]{$monofont$}
  146. $endif$
  147. $for(fontfamilies)$
  148. \newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$}
  149. $endfor$
  150. $if(mathfont)$
  151. $if(mathspec)$
  152. \ifXeTeX
  153. \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
  154. \else
  155. \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
  156. \fi
  157. $else$
  158. \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
  159. $endif$
  160. $endif$
  161. $if(CJKmainfont)$
  162. \ifXeTeX
  163. \usepackage{xeCJK}
  164. \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
  165. \fi
  166. $endif$
  167. $if(luatexjapresetoptions)$
  168. \ifLuaTeX
  169. \usepackage[$for(luatexjapresetoptions)$$luatexjapresetoptions$$sep$,$endfor$]{luatexja-preset}
  170. \fi
  171. $endif$
  172. $if(CJKmainfont)$
  173. \ifLuaTeX
  174. \usepackage[$for(luatexjafontspecoptions)$$luatexjafontspecoptions$$sep$,$endfor$]{luatexja-fontspec}
  175. \setmainjfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
  176. \fi
  177. $endif$
  178. \fi
  179. $if(zero-width-non-joiner)$
  180. %% Support for zero-width non-joiner characters.
  181. \makeatletter
  182. \def\zerowidthnonjoiner{%
  183. % Prevent ligatures and adjust kerning, but still support hyphenating.
  184. \texorpdfstring{%
  185. \TextOrMath{\nobreak\discretionary{-}{}{\kern.03em}%
  186. \ifvmode\else\nobreak\hskip\z@skip\fi}{}%
  187. }{}%
  188. }
  189. \makeatother
  190. \ifPDFTeX
  191. \DeclareUnicodeCharacter{200C}{\zerowidthnonjoiner}
  192. \else
  193. \catcode`^^^^200c=\active
  194. \protected\def ^^^^200c{\zerowidthnonjoiner}
  195. \fi
  196. %% End of ZWNJ support
  197. $endif$
  198. % Use upquote if available, for straight quotes in verbatim environments
  199. \IfFileExists{upquote.sty}{\usepackage{upquote}}{}
  200. \IfFileExists{microtype.sty}{% use microtype if available
  201. \usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype}
  202. \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
  203. }{}
  204. $if(indent)$
  205. $else$
  206. \makeatletter
  207. \@ifundefined{KOMAClassName}{% if non-KOMA class
  208. \IfFileExists{parskip.sty}{%
  209. \usepackage{parskip}
  210. }{% else
  211. \setlength{\parindent}{0pt}
  212. \setlength{\parskip}{6pt plus 2pt minus 1pt}}
  213. }{% if KOMA class
  214. \KOMAoptions{parskip=half}}
  215. \makeatother
  216. $endif$
  217. $if(verbatim-in-note)$
  218. \usepackage{fancyvrb}
  219. $endif$
  220. \usepackage{xcolor}
  221. $if(geometry)$
  222. $if(beamer)$
  223. \geometry{$for(geometry)$$geometry$$sep$,$endfor$}
  224. $else$
  225. \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
  226. $endif$
  227. $endif$
  228. $if(beamer)$
  229. \newif\ifbibliography
  230. $endif$
  231. $if(listings)$
  232. \usepackage{listings}
  233. \newcommand{\passthrough}[1]{#1}
  234. \lstset{defaultdialect=[5.3]Lua}
  235. \lstset{defaultdialect=[x86masm]Assembler}
  236. $endif$
  237. $if(lhs)$
  238. \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
  239. $endif$
  240. $if(highlighting-macros)$
  241. $highlighting-macros$
  242. $endif$
  243. $if(tables)$
  244. \usepackage{longtable,booktabs,array}
  245. $if(multirow)$
  246. \usepackage{multirow}
  247. $endif$
  248. \usepackage{calc} % for calculating minipage widths
  249. $if(beamer)$
  250. \usepackage{caption}
  251. % Make caption package work with longtable
  252. \makeatletter
  253. \def\fnum@table{\tablename~\thetable}
  254. \makeatother
  255. $else$
  256. % Correct order of tables after \paragraph or \subparagraph
  257. \usepackage{etoolbox}
  258. \makeatletter
  259. \patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
  260. \makeatother
  261. % Allow footnotes in longtable head/foot
  262. \IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
  263. \makesavenoteenv{longtable}
  264. $endif$
  265. $endif$
  266. $if(graphics)$
  267. \usepackage{graphicx}
  268. \makeatletter
  269. \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
  270. \def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
  271. \makeatother
  272. % Scale images if necessary, so that they will not overflow the page
  273. % margins by default, and it is still possible to overwrite the defaults
  274. % using explicit options in \includegraphics[width, height, ...]{}
  275. \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
  276. % Set default figure placement to htbp
  277. \makeatletter
  278. \def\fps@figure{htbp}
  279. \makeatother
  280. $endif$
  281. $if(svg)$
  282. \usepackage{svg}
  283. $endif$
  284. $if(strikeout)$
  285. $-- also used for underline
  286. \usepackage{soul}
  287. $endif$
  288. \setlength{\emergencystretch}{3em} % prevent overfull lines
  289. \providecommand{\tightlist}{%
  290. \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
  291. $if(numbersections)$
  292. \setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$}
  293. $else$
  294. \setcounter{secnumdepth}{-\maxdimen} % remove section numbering
  295. $endif$
  296. $if(subfigure)$
  297. \usepackage{subcaption}
  298. $endif$
  299. $if(beamer)$
  300. $else$
  301. $if(block-headings)$
  302. % Make \paragraph and \subparagraph free-standing
  303. \ifx\paragraph\undefined\else
  304. \let\oldparagraph\paragraph
  305. \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
  306. \fi
  307. \ifx\subparagraph\undefined\else
  308. \let\oldsubparagraph\subparagraph
  309. \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
  310. \fi
  311. $endif$
  312. $endif$
  313. $if(pagestyle)$
  314. \pagestyle{$pagestyle$}
  315. $endif$
  316. $if(csl-refs)$
  317. \newlength{\cslhangindent}
  318. \setlength{\cslhangindent}{1.5em}
  319. \newlength{\csllabelwidth}
  320. \setlength{\csllabelwidth}{3em}
  321. \newlength{\cslentryspacingunit} % times entry-spacing
  322. \setlength{\cslentryspacingunit}{\parskip}
  323. \newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
  324. {% don't indent paragraphs
  325. \setlength{\parindent}{0pt}
  326. % turn on hanging indent if param 1 is 1
  327. \ifodd #1
  328. \let\oldpar\par
  329. \def\par{\hangindent=\cslhangindent\oldpar}
  330. \fi
  331. % set entry spacing
  332. \setlength{\parskip}{#2\cslentryspacingunit}
  333. }%
  334. {}
  335. \usepackage{calc}
  336. \newcommand{\CSLBlock}[1]{#1\hfill\break}
  337. \newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
  338. \newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
  339. \newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
  340. $endif$
  341. $if(lang)$
  342. \ifLuaTeX
  343. \usepackage[bidi=basic]{babel}
  344. \else
  345. \usepackage[bidi=default]{babel}
  346. \fi
  347. $if(babel-lang)$
  348. \babelprovide[main,import]{$babel-lang$}
  349. $if(mainfont)$
  350. \ifPDFTeX
  351. \else
  352. \babelfont[$babel-lang$]{rm}{$mainfont$}
  353. \fi
  354. $endif$
  355. $endif$
  356. $for(babel-otherlangs)$
  357. \babelprovide[import]{$babel-otherlangs$}
  358. $endfor$
  359. % get rid of language-specific shorthands (see #6817):
  360. \let\LanguageShortHands\languageshorthands
  361. \def\languageshorthands#1{}
  362. $endif$
  363. $for(header-includes)$
  364. $header-includes$
  365. $endfor$
  366. \ifLuaTeX
  367. \usepackage{selnolig} % disable illegal ligatures
  368. \fi
  369. $if(dir)$
  370. \ifPDFTeX
  371. \TeXXeTstate=1
  372. \newcommand{\RL}[1]{\beginR #1\endR}
  373. \newcommand{\LR}[1]{\beginL #1\endL}
  374. \newenvironment{RTL}{\beginR}{\endR}
  375. \newenvironment{LTR}{\beginL}{\endL}
  376. \fi
  377. $endif$
  378. $if(natbib)$
  379. \usepackage[$natbiboptions$]{natbib}
  380. \bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
  381. $endif$
  382. $if(biblatex)$
  383. \usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex}
  384. $for(bibliography)$
  385. \addbibresource{$bibliography$}
  386. $endfor$
  387. $endif$
  388. $if(nocite-ids)$
  389. \nocite{$for(nocite-ids)$$it$$sep$, $endfor$}
  390. $endif$
  391. $if(csquotes)$
  392. \usepackage{csquotes}
  393. $endif$
  394. \IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
  395. \IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
  396. \urlstyle{$if(urlstyle)$$urlstyle$$else$same$endif$}
  397. $if(links-as-notes)$
  398. % Make links footnotes instead of hotlinks:
  399. \DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}}
  400. $endif$
  401. $if(verbatim-in-note)$
  402. \VerbatimFootnotes % allow verbatim text in footnotes
  403. $endif$
  404. \hypersetup{
  405. $if(title-meta)$
  406. pdftitle={$title-meta$},
  407. $endif$
  408. $if(author-meta)$
  409. pdfauthor={$author-meta$},
  410. $endif$
  411. $if(lang)$
  412. pdflang={$lang$},
  413. $endif$
  414. $if(subject)$
  415. pdfsubject={$subject$},
  416. $endif$
  417. $if(keywords)$
  418. pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$},
  419. $endif$
  420. $if(colorlinks)$
  421. colorlinks=true,
  422. linkcolor={$if(linkcolor)$$linkcolor$$else$Maroon$endif$},
  423. filecolor={$if(filecolor)$$filecolor$$else$Maroon$endif$},
  424. citecolor={$if(citecolor)$$citecolor$$else$Blue$endif$},
  425. urlcolor={$if(urlcolor)$$urlcolor$$else$Blue$endif$},
  426. $else$
  427. $if(boxlinks)$
  428. $else$
  429. hidelinks,
  430. $endif$
  431. $endif$
  432. pdfcreator={LaTeX via pandoc}}
  433. $if(title)$
  434. \title{$title$$if(thanks)$\thanks{$thanks$}$endif$}
  435. $endif$
  436. $if(subtitle)$
  437. $if(beamer)$
  438. $else$
  439. \usepackage{etoolbox}
  440. \makeatletter
  441. \providecommand{\subtitle}[1]{% add subtitle to \maketitle
  442. \apptocmd{\@title}{\par {\large #1 \par}}{}{}
  443. }
  444. \makeatother
  445. $endif$
  446. \subtitle{$subtitle$}
  447. $endif$
  448. \author{$for(author)$$author.name$$if(author.orcid)$\orcid{$author.orcid$}$endif$$sep$ \and $endfor$}
  449. \date{$date$}
  450. $if(beamer)$
  451. $if(institute)$
  452. \institute{$for(institute)$$institute$$sep$ \and $endfor$}
  453. $endif$
  454. $if(titlegraphic)$
  455. \titlegraphic{\includegraphics{$titlegraphic$}}
  456. $endif$
  457. $if(logo)$
  458. \logo{\includegraphics{$logo$}}
  459. $endif$
  460. $endif$
  461. \begin{document}
  462. $if(has-frontmatter)$
  463. \frontmatter
  464. $endif$
  465. $for(include-before)$
  466. $include-before$
  467. $if(title)$
  468. $if(beamer)$
  469. \frame{\titlepage}
  470. $else$
  471. \maketitle
  472. $endif$
  473. $if(abstract)$
  474. \begin{abstract}
  475. $abstract$
  476. \end{abstract}
  477. $endif$
  478. $endif$
  479. $endfor$
  480. $if(toc)$
  481. $if(toc-title)$
  482. \renewcommand*\contentsname{$toc-title$}
  483. $endif$
  484. $if(beamer)$
  485. \begin{frame}[allowframebreaks]
  486. $if(toc-title)$
  487. \frametitle{$toc-title$}
  488. $endif$
  489. \tableofcontents[hideallsubsections]
  490. \end{frame}
  491. $else$
  492. {
  493. $if(colorlinks)$
  494. \hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$$endif$}
  495. $endif$
  496. \setcounter{tocdepth}{$toc-depth$}
  497. \tableofcontents
  498. }
  499. $endif$
  500. $endif$
  501. $if(lof)$
  502. \listoffigures
  503. $endif$
  504. $if(lot)$
  505. \listoftables
  506. $endif$
  507. $if(linestretch)$
  508. \setstretch{$linestretch$}
  509. $endif$
  510. $if(has-frontmatter)$
  511. \mainmatter
  512. $endif$
  513. $body$
  514. $if(has-frontmatter)$
  515. \backmatter
  516. $endif$
  517. $if(natbib)$
  518. $if(bibliography)$
  519. $if(biblio-title)$
  520. $if(has-chapters)$
  521. \renewcommand\bibname{$biblio-title$}
  522. $else$
  523. \renewcommand\refname{$biblio-title$}
  524. $endif$
  525. $endif$
  526. $if(beamer)$
  527. \begin{frame}[allowframebreaks]{$biblio-title$}
  528. \bibliographytrue
  529. $endif$
  530. \bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
  531. $if(beamer)$
  532. \end{frame}
  533. $endif$
  534. $endif$
  535. $endif$
  536. $if(biblatex)$
  537. $if(beamer)$
  538. \begin{frame}[allowframebreaks]{$biblio-title$}
  539. \bibliographytrue
  540. \printbibliography[heading=none]
  541. \end{frame}
  542. $else$
  543. \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
  544. $endif$
  545. $endif$
  546. $for(include-after)$
  547. $include-after$
  548. $endfor$
  549. \end{document}