eisvogel.latex 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042
  1. %%
  2. % Copyright (c) 2017 - 2021, Pascal Wagler;
  3. % Copyright (c) 2014 - 2021, John MacFarlane
  4. %
  5. % All rights reserved.
  6. %
  7. % Redistribution and use in source and binary forms, with or without
  8. % modification, are permitted provided that the following conditions
  9. % are met:
  10. %
  11. % - Redistributions of source code must retain the above copyright
  12. % notice, this list of conditions and the following disclaimer.
  13. %
  14. % - Redistributions in binary form must reproduce the above copyright
  15. % notice, this list of conditions and the following disclaimer in the
  16. % documentation and/or other materials provided with the distribution.
  17. %
  18. % - Neither the name of John MacFarlane nor the names of other
  19. % contributors may be used to endorse or promote products derived
  20. % from this software without specific prior written permission.
  21. %
  22. % THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. % "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. % LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  25. % FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  26. % COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  27. % INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  28. % BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  29. % LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  30. % CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  31. % LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  32. % ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  33. % POSSIBILITY OF SUCH DAMAGE.
  34. %%
  35. %%
  36. % This is the Eisvogel pandoc LaTeX template.
  37. %
  38. % For usage information and examples visit the official GitHub page:
  39. % https://github.com/Wandmalfarbe/pandoc-latex-template
  40. %%
  41. % Options for packages loaded elsewhere
  42. \PassOptionsToPackage{unicode$for(hyperrefoptions)$,$hyperrefoptions$$endfor$}{hyperref}
  43. \PassOptionsToPackage{hyphens}{url}
  44. \PassOptionsToPackage{dvipsnames,svgnames,x11names,table}{xcolor}
  45. $if(dir)$
  46. $if(latex-dir-rtl)$
  47. \PassOptionsToPackage{RTLdocument}{bidi}
  48. $endif$
  49. $endif$
  50. $if(CJKmainfont)$
  51. \PassOptionsToPackage{space}{xeCJK}
  52. $endif$
  53. %
  54. \documentclass[
  55. $if(fontsize)$
  56. $fontsize$,
  57. $endif$
  58. $if(lang)$
  59. $babel-lang$,
  60. $endif$
  61. $if(papersize)$
  62. $papersize$paper,
  63. $else$
  64. paper=a4,
  65. $endif$
  66. $if(beamer)$
  67. ignorenonframetext,
  68. $if(handout)$
  69. handout,
  70. $endif$
  71. $if(aspectratio)$
  72. aspectratio=$aspectratio$,
  73. $endif$
  74. $endif$
  75. $for(classoption)$
  76. $classoption$$sep$,
  77. $endfor$
  78. ,captions=tableheading
  79. ]{$if(beamer)$$documentclass$$else$$if(book)$scrbook$else$scrartcl$endif$$endif$}
  80. $if(beamer)$
  81. $if(background-image)$
  82. \usebackgroundtemplate{%
  83. \includegraphics[width=\paperwidth]{$background-image$}%
  84. }
  85. $endif$
  86. \usepackage{pgfpages}
  87. \setbeamertemplate{caption}[numbered]
  88. \setbeamertemplate{caption label separator}{: }
  89. \setbeamercolor{caption name}{fg=normal text.fg}
  90. \beamertemplatenavigationsymbols$if(navigation)$$navigation$$else$empty$endif$
  91. $for(beameroption)$
  92. \setbeameroption{$beameroption$}
  93. $endfor$
  94. % Prevent slide breaks in the middle of a paragraph
  95. \widowpenalties 1 10000
  96. \raggedbottom
  97. $if(section-titles)$
  98. \setbeamertemplate{part page}{
  99. \centering
  100. \begin{beamercolorbox}[sep=16pt,center]{part title}
  101. \usebeamerfont{part title}\insertpart\par
  102. \end{beamercolorbox}
  103. }
  104. \setbeamertemplate{section page}{
  105. \centering
  106. \begin{beamercolorbox}[sep=12pt,center]{part title}
  107. \usebeamerfont{section title}\insertsection\par
  108. \end{beamercolorbox}
  109. }
  110. \setbeamertemplate{subsection page}{
  111. \centering
  112. \begin{beamercolorbox}[sep=8pt,center]{part title}
  113. \usebeamerfont{subsection title}\insertsubsection\par
  114. \end{beamercolorbox}
  115. }
  116. \AtBeginPart{
  117. \frame{\partpage}
  118. }
  119. \AtBeginSection{
  120. \ifbibliography
  121. \else
  122. \frame{\sectionpage}
  123. \fi
  124. }
  125. \AtBeginSubsection{
  126. \frame{\subsectionpage}
  127. }
  128. $endif$
  129. $endif$
  130. $if(beamerarticle)$
  131. \usepackage{beamerarticle} % needs to be loaded first
  132. $endif$
  133. \usepackage{amsmath,amssymb}
  134. $if(fontfamily)$
  135. \usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
  136. $else$
  137. \usepackage{lmodern}
  138. $endif$
  139. $if(linestretch)$
  140. \usepackage{setspace}
  141. $else$
  142. \usepackage{setspace}
  143. \setstretch{1.2}
  144. $endif$
  145. \usepackage{iftex}
  146. \ifPDFTeX
  147. \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
  148. \usepackage[utf8]{inputenc}
  149. \usepackage{textcomp} % provide euro and other symbols
  150. \else % if luatex or xetex
  151. $if(mathspec)$
  152. \ifXeTeX
  153. \usepackage{mathspec}
  154. \else
  155. \usepackage{unicode-math}
  156. \fi
  157. $else$
  158. \usepackage{unicode-math}
  159. $endif$
  160. \defaultfontfeatures{Scale=MatchLowercase}
  161. \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
  162. $if(mainfont)$
  163. \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
  164. $endif$
  165. $if(sansfont)$
  166. \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
  167. $endif$
  168. $if(monofont)$
  169. \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$]{$monofont$}
  170. $endif$
  171. $for(fontfamilies)$
  172. \newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$}
  173. $endfor$
  174. $if(mathfont)$
  175. $if(mathspec)$
  176. \ifXeTeX
  177. \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
  178. \else
  179. \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
  180. \fi
  181. $else$
  182. \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
  183. $endif$
  184. $endif$
  185. $if(CJKmainfont)$
  186. \ifXeTeX
  187. \usepackage{xeCJK}
  188. \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
  189. \fi
  190. $endif$
  191. $if(luatexjapresetoptions)$
  192. \ifLuaTeX
  193. \usepackage[$for(luatexjapresetoptions)$$luatexjapresetoptions$$sep$,$endfor$]{luatexja-preset}
  194. \fi
  195. $endif$
  196. $if(CJKmainfont)$
  197. \ifLuaTeX
  198. \usepackage[$for(luatexjafontspecoptions)$$luatexjafontspecoptions$$sep$,$endfor$]{luatexja-fontspec}
  199. \setmainjfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
  200. \fi
  201. $endif$
  202. \fi
  203. $if(zero-width-non-joiner)$
  204. %% Support for zero-width non-joiner characters.
  205. \makeatletter
  206. \def\zerowidthnonjoiner{%
  207. % Prevent ligatures and adjust kerning, but still support hyphenating.
  208. \texorpdfstring{%
  209. \textormath{\nobreak\discretionary{-}{}{\kern.03em}%
  210. \ifvmode\else\nobreak\hskip\z@skip\fi}{}%
  211. }{}%
  212. }
  213. \makeatother
  214. \ifPDFTeX
  215. \DeclareUnicodeCharacter{200C}{\zerowidthnonjoiner}
  216. \else
  217. \catcode`^^^^200c=\active
  218. \protected\def ^^^^200c{\zerowidthnonjoiner}
  219. \fi
  220. %% End of ZWNJ support
  221. $endif$
  222. $if(beamer)$
  223. $if(theme)$
  224. \usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$}
  225. $endif$
  226. $if(colortheme)$
  227. \usecolortheme{$colortheme$}
  228. $endif$
  229. $if(fonttheme)$
  230. \usefonttheme{$fonttheme$}
  231. $endif$
  232. $if(mainfont)$
  233. \usefonttheme{serif} % use mainfont rather than sansfont for slide text
  234. $endif$
  235. $if(innertheme)$
  236. \useinnertheme{$innertheme$}
  237. $endif$
  238. $if(outertheme)$
  239. \useoutertheme{$outertheme$}
  240. $endif$
  241. $endif$
  242. % Use upquote if available, for straight quotes in verbatim environments
  243. \IfFileExists{upquote.sty}{\usepackage{upquote}}{}
  244. \IfFileExists{microtype.sty}{% use microtype if available
  245. \usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype}
  246. \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
  247. }{}
  248. $if(indent)$
  249. $else$
  250. \makeatletter
  251. \@ifundefined{KOMAClassName}{% if non-KOMA class
  252. \IfFileExists{parskip.sty}{%
  253. \usepackage{parskip}
  254. }{% else
  255. \setlength{\parindent}{0pt}
  256. \setlength{\parskip}{6pt plus 2pt minus 1pt}}
  257. }{% if KOMA class
  258. \KOMAoptions{parskip=half}}
  259. \makeatother
  260. $endif$
  261. $if(verbatim-in-note)$
  262. \usepackage{fancyvrb}
  263. $endif$
  264. \usepackage{xcolor}
  265. \definecolor{default-linkcolor}{HTML}{A50000}
  266. \definecolor{default-filecolor}{HTML}{A50000}
  267. \definecolor{default-citecolor}{HTML}{4077C0}
  268. \definecolor{default-urlcolor}{HTML}{4077C0}
  269. \IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
  270. $if(footnotes-pretty)$
  271. % load footmisc in order to customize footnotes (footmisc has to be loaded before hyperref, cf. https://tex.stackexchange.com/a/169124/144087)
  272. \usepackage[hang,flushmargin,bottom,multiple]{footmisc}
  273. \setlength{\footnotemargin}{0.8em} % set space between footnote nr and text
  274. \setlength{\footnotesep}{\baselineskip} % set space between multiple footnotes
  275. \setlength{\skip\footins}{0.3cm} % set space between page content and footnote
  276. \setlength{\footskip}{0.9cm} % set space between footnote and page bottom
  277. $endif$
  278. \IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
  279. \hypersetup{
  280. $if(title-meta)$
  281. pdftitle={$title-meta$},
  282. $endif$
  283. $if(author-meta)$
  284. pdfauthor={$author-meta$},
  285. $endif$
  286. $if(lang)$
  287. pdflang={$lang$},
  288. $endif$
  289. $if(subject)$
  290. pdfsubject={$subject$},
  291. $endif$
  292. $if(keywords)$
  293. pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$},
  294. $endif$
  295. $if(colorlinks)$
  296. colorlinks=true,
  297. linkcolor={$if(linkcolor)$$linkcolor$$else$default-linkcolor$endif$},
  298. filecolor={$if(filecolor)$$filecolor$$else$default-filecolor$endif$},
  299. citecolor={$if(citecolor)$$citecolor$$else$default-citecolor$endif$},
  300. urlcolor={$if(urlcolor)$$urlcolor$$else$default-urlcolor$endif$},
  301. $else$
  302. hidelinks,
  303. $endif$
  304. breaklinks=true,
  305. pdfcreator={LaTeX via pandoc with the Eisvogel template}}
  306. \urlstyle{same} % disable monospaced font for URLs
  307. $if(verbatim-in-note)$
  308. \VerbatimFootnotes % allow verbatim text in footnotes
  309. $endif$
  310. $if(geometry)$
  311. $if(beamer)$
  312. \geometry{$for(geometry)$$geometry$$sep$,$endfor$}
  313. $else$
  314. \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
  315. $endif$
  316. $else$
  317. $if(beamer)$
  318. $else$
  319. \usepackage[margin=2.5cm,includehead=true,includefoot=true,centering,$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
  320. $endif$
  321. $endif$
  322. $if(logo)$
  323. \usepackage[export]{adjustbox}
  324. \usepackage{graphicx}
  325. $endif$
  326. $if(beamer)$
  327. \newif\ifbibliography
  328. $endif$
  329. $if(listings)$
  330. \usepackage{listings}
  331. \newcommand{\passthrough}[1]{#1}
  332. \lstset{defaultdialect=[5.3]Lua}
  333. \lstset{defaultdialect=[x86masm]Assembler}
  334. $endif$
  335. $if(listings-no-page-break)$
  336. \usepackage{etoolbox}
  337. \BeforeBeginEnvironment{lstlisting}{\par\noindent\begin{minipage}{\linewidth}}
  338. \AfterEndEnvironment{lstlisting}{\end{minipage}\par\addvspace{\topskip}}
  339. $endif$
  340. $if(lhs)$
  341. \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
  342. $endif$
  343. $if(highlighting-macros)$
  344. $highlighting-macros$
  345. % Workaround/bugfix from jannick0.
  346. % See https://github.com/jgm/pandoc/issues/4302#issuecomment-360669013)
  347. % or https://github.com/Wandmalfarbe/pandoc-latex-template/issues/2
  348. %
  349. % Redefine the verbatim environment 'Highlighting' to break long lines (with
  350. % the help of fvextra). Redefinition is necessary because it is unlikely that
  351. % pandoc includes fvextra in the default template.
  352. \usepackage{fvextra}
  353. \DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,fontsize=$if(code-block-font-size)$$code-block-font-size$$else$\small$endif$,commandchars=\\\{\}}
  354. $endif$
  355. $if(tables)$
  356. \usepackage{longtable,booktabs,array}
  357. $if(multirow)$
  358. \usepackage{multirow}
  359. $endif$
  360. \usepackage{calc} % for calculating minipage widths
  361. $if(beamer)$
  362. \usepackage{caption}
  363. % Make caption package work with longtable
  364. \makeatletter
  365. \def\fnum@table{\tablename~\thetable}
  366. \makeatother
  367. $else$
  368. % Correct order of tables after \paragraph or \subparagraph
  369. \usepackage{etoolbox}
  370. \makeatletter
  371. \patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
  372. \makeatother
  373. % Allow footnotes in longtable head/foot
  374. \IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
  375. \makesavenoteenv{longtable}
  376. $endif$
  377. $endif$
  378. % add backlinks to footnote references, cf. https://tex.stackexchange.com/questions/302266/make-footnote-clickable-both-ways
  379. $if(footnotes-disable-backlinks)$
  380. $else$
  381. \usepackage{footnotebackref}
  382. $endif$
  383. $if(graphics)$
  384. \usepackage{graphicx}
  385. \makeatletter
  386. \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
  387. \def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
  388. \makeatother
  389. % Scale images if necessary, so that they will not overflow the page
  390. % margins by default, and it is still possible to overwrite the defaults
  391. % using explicit options in \includegraphics[width, height, ...]{}
  392. \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
  393. % Set default figure placement to htbp
  394. \makeatletter
  395. \def\fps@figure{htbp}
  396. \makeatother
  397. $endif$
  398. $if(links-as-notes)$
  399. % Make links footnotes instead of hotlinks:
  400. \DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}}
  401. $endif$
  402. $if(strikeout)$
  403. $-- also used for underline
  404. \usepackage[normalem]{ulem}
  405. % Avoid problems with \sout in headers with hyperref
  406. \pdfstringdefDisableCommands{\renewcommand{\sout}{}}
  407. $endif$
  408. \setlength{\emergencystretch}{3em} % prevent overfull lines
  409. \providecommand{\tightlist}{%
  410. \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
  411. $if(numbersections)$
  412. \setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$}
  413. $else$
  414. \setcounter{secnumdepth}{-\maxdimen} % remove section numbering
  415. $endif$
  416. $if(beamer)$
  417. $else$
  418. $if(block-headings)$
  419. % Make \paragraph and \subparagraph free-standing
  420. \ifx\paragraph\undefined\else
  421. \let\oldparagraph\paragraph
  422. \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
  423. \fi
  424. \ifx\subparagraph\undefined\else
  425. \let\oldsubparagraph\subparagraph
  426. \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
  427. \fi
  428. $endif$
  429. $endif$
  430. $if(pagestyle)$
  431. \pagestyle{$pagestyle$}
  432. $endif$
  433. $if(csl-refs)$
  434. \newlength{\cslhangindent}
  435. \setlength{\cslhangindent}{1.5em}
  436. \newlength{\csllabelwidth}
  437. \setlength{\csllabelwidth}{3em}
  438. \newlength{\cslentryspacingunit} % times entry-spacing
  439. \setlength{\cslentryspacingunit}{\parskip}
  440. \newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
  441. {% don't indent paragraphs
  442. \setlength{\parindent}{0pt}
  443. % turn on hanging indent if param 1 is 1
  444. \ifodd #1
  445. \let\oldpar\par
  446. \def\par{\hangindent=\cslhangindent\oldpar}
  447. \fi
  448. % set entry spacing
  449. \setlength{\parskip}{#2\cslentryspacingunit}
  450. }%
  451. {}
  452. \usepackage{calc}
  453. \newcommand{\CSLBlock}[1]{#1\hfill\break}
  454. \newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
  455. \newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
  456. \newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
  457. $endif$
  458. $for(header-includes)$
  459. $header-includes$
  460. $endfor$
  461. $if(lang)$
  462. \usepackage[$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
  463. % get rid of language-specific shorthands (see #6817):
  464. \let\LanguageShortHands\languageshorthands
  465. \def\languageshorthands#1{}
  466. $endif$
  467. \ifLuaTeX
  468. \usepackage{selnolig} % disable illegal ligatures
  469. \fi
  470. $if(dir)$
  471. \ifXeTeX
  472. % Load bidi as late as possible as it modifies e.g. graphicx
  473. \usepackage{bidi}
  474. \fi
  475. \ifPDFTeX
  476. \TeXXeTstate=1
  477. \newcommand{\RL}[1]{\beginR #1\endR}
  478. \newcommand{\LR}[1]{\beginL #1\endL}
  479. \newenvironment{RTL}{\beginR}{\endR}
  480. \newenvironment{LTR}{\beginL}{\endL}
  481. \fi
  482. $endif$
  483. $if(natbib)$
  484. \usepackage[$natbiboptions$]{natbib}
  485. \bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
  486. $endif$
  487. $if(biblatex)$
  488. \usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex}
  489. $for(bibliography)$
  490. \addbibresource{$bibliography$}
  491. $endfor$
  492. $endif$
  493. $if(nocite-ids)$
  494. \nocite{$for(nocite-ids)$$it$$sep$, $endfor$}
  495. $endif$
  496. $if(csquotes)$
  497. \usepackage{csquotes}
  498. $endif$
  499. $if(title)$
  500. \title{$title$$if(thanks)$\thanks{$thanks$}$endif$}
  501. $endif$
  502. $if(subtitle)$
  503. $if(beamer)$
  504. $else$
  505. \usepackage{etoolbox}
  506. \makeatletter
  507. \providecommand{\subtitle}[1]{% add subtitle to \maketitle
  508. \apptocmd{\@title}{\par {\large #1 \par}}{}{}
  509. }
  510. \makeatother
  511. $endif$
  512. \subtitle{$subtitle$}
  513. $endif$
  514. \author{$for(author)$$author$$sep$ \and $endfor$}
  515. \date{$date$}
  516. $if(beamer)$
  517. $if(institute)$
  518. \institute{$for(institute)$$institute$$sep$ \and $endfor$}
  519. $endif$
  520. $if(titlegraphic)$
  521. \titlegraphic{\includegraphics{$titlegraphic$}}
  522. $endif$
  523. $if(logo)$
  524. \logo{\includegraphics{$logo$}}
  525. $endif$
  526. $endif$
  527. %%
  528. %% added
  529. %%
  530. $if(page-background)$
  531. \usepackage[pages=all]{background}
  532. $endif$
  533. %
  534. % for the background color of the title page
  535. %
  536. $if(titlepage)$
  537. \usepackage{pagecolor}
  538. \usepackage{afterpage}
  539. $if(titlepage-background)$
  540. \usepackage{tikz}
  541. $endif$
  542. $if(geometry)$
  543. $else$
  544. \usepackage[margin=2.5cm,includehead=true,includefoot=true,centering]{geometry}
  545. $endif$
  546. $endif$
  547. %
  548. % break urls
  549. %
  550. \PassOptionsToPackage{hyphens}{url}
  551. %
  552. % When using babel or polyglossia with biblatex, loading csquotes is recommended
  553. % to ensure that quoted texts are typeset according to the rules of your main language.
  554. %
  555. \usepackage{csquotes}
  556. %
  557. % captions
  558. %
  559. \definecolor{caption-color}{HTML}{777777}
  560. $if(beamer)$
  561. $else$
  562. \usepackage[font={stretch=1.2}, textfont={color=caption-color}, position=top, skip=4mm, labelfont=bf, singlelinecheck=false, justification=$if(caption-justification)$$caption-justification$$else$raggedright$endif$]{caption}
  563. \setcapindent{0em}
  564. $endif$
  565. %
  566. % blockquote
  567. %
  568. \definecolor{blockquote-border}{RGB}{221,221,221}
  569. \definecolor{blockquote-text}{RGB}{119,119,119}
  570. \usepackage{mdframed}
  571. \newmdenv[rightline=false,bottomline=false,topline=false,linewidth=3pt,linecolor=blockquote-border,skipabove=\parskip]{customblockquote}
  572. \renewenvironment{quote}{\begin{customblockquote}\list{}{\rightmargin=0em\leftmargin=0em}%
  573. \item\relax\color{blockquote-text}\ignorespaces}{\unskip\unskip\endlist\end{customblockquote}}
  574. %
  575. % Source Sans Pro as the de­fault font fam­ily
  576. % Source Code Pro for monospace text
  577. %
  578. % 'default' option sets the default
  579. % font family to Source Sans Pro, not \sfdefault.
  580. %
  581. \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  582. $if(fontfamily)$
  583. $else$
  584. \usepackage[default]{sourcesanspro}
  585. \usepackage{sourcecodepro}
  586. $endif$
  587. \else % if not pdftex
  588. $if(mainfont)$
  589. $else$
  590. \usepackage[default]{sourcesanspro}
  591. \usepackage{sourcecodepro}
  592. % XeLaTeX specific adjustments for straight quotes: https://tex.stackexchange.com/a/354887
  593. % This issue is already fixed (see https://github.com/silkeh/latex-sourcecodepro/pull/5) but the
  594. % fix is still unreleased.
  595. % TODO: Remove this workaround when the new version of sourcecodepro is released on CTAN.
  596. \ifxetex
  597. \makeatletter
  598. \defaultfontfeatures[\ttfamily]
  599. { Numbers = \sourcecodepro@figurestyle,
  600. Scale = \SourceCodePro@scale,
  601. Extension = .otf }
  602. \setmonofont
  603. [ UprightFont = *-\sourcecodepro@regstyle,
  604. ItalicFont = *-\sourcecodepro@regstyle It,
  605. BoldFont = *-\sourcecodepro@boldstyle,
  606. BoldItalicFont = *-\sourcecodepro@boldstyle It ]
  607. {SourceCodePro}
  608. \makeatother
  609. \fi
  610. $endif$
  611. \fi
  612. %
  613. % heading color
  614. %
  615. \definecolor{heading-color}{RGB}{40,40,40}
  616. $if(beamer)$
  617. $else$
  618. \addtokomafont{section}{\color{heading-color}}
  619. $endif$
  620. % When using the classes report, scrreprt, book,
  621. % scrbook or memoir, uncomment the following line.
  622. %\addtokomafont{chapter}{\color{heading-color}}
  623. %
  624. % variables for title, author and date
  625. %
  626. $if(beamer)$
  627. $else$
  628. \usepackage{titling}
  629. \title{$title$}
  630. \author{$for(author)$$author$$sep$, $endfor$}
  631. \date{$date$}
  632. $endif$
  633. %
  634. % tables
  635. %
  636. $if(tables)$
  637. \definecolor{table-row-color}{HTML}{F5F5F5}
  638. \definecolor{table-rule-color}{HTML}{999999}
  639. %\arrayrulecolor{black!40}
  640. \arrayrulecolor{table-rule-color} % color of \toprule, \midrule, \bottomrule
  641. \setlength\heavyrulewidth{0.3ex} % thickness of \toprule, \bottomrule
  642. \renewcommand{\arraystretch}{1.3} % spacing (padding)
  643. $if(table-use-row-colors)$
  644. % TODO: This doesn't work anymore. I don't know why.
  645. % Reset rownum counter so that each table
  646. % starts with the same row colors.
  647. % https://tex.stackexchange.com/questions/170637/restarting-rowcolors
  648. %
  649. % Unfortunately the colored cells extend beyond the edge of the
  650. % table because pandoc uses @-expressions (@{}) like so:
  651. %
  652. % \begin{longtable}[]{@{}ll@{}}
  653. % \end{longtable}
  654. %
  655. % https://en.wikibooks.org/wiki/LaTeX/Tables#.40-expressions
  656. \let\oldlongtable\longtable
  657. \let\endoldlongtable\endlongtable
  658. \renewenvironment{longtable}{
  659. \rowcolors{3}{}{table-row-color!100} % row color
  660. \oldlongtable} {
  661. \endoldlongtable
  662. \global\rownum=0\relax}
  663. $endif$
  664. $endif$
  665. %
  666. % remove paragraph indention
  667. %
  668. \setlength{\parindent}{0pt}
  669. \setlength{\parskip}{6pt plus 2pt minus 1pt}
  670. \setlength{\emergencystretch}{3em} % prevent overfull lines
  671. %
  672. %
  673. % Listings
  674. %
  675. %
  676. $if(listings)$
  677. %
  678. % general listing colors
  679. %
  680. \definecolor{listing-background}{HTML}{F7F7F7}
  681. \definecolor{listing-rule}{HTML}{B3B2B3}
  682. \definecolor{listing-numbers}{HTML}{B3B2B3}
  683. \definecolor{listing-text-color}{HTML}{000000}
  684. \definecolor{listing-keyword}{HTML}{435489}
  685. \definecolor{listing-keyword-2}{HTML}{1284CA} % additional keywords
  686. \definecolor{listing-keyword-3}{HTML}{9137CB} % additional keywords
  687. \definecolor{listing-identifier}{HTML}{435489}
  688. \definecolor{listing-string}{HTML}{00999A}
  689. \definecolor{listing-comment}{HTML}{8E8E8E}
  690. \lstdefinestyle{eisvogel_listing_style}{
  691. language = java,
  692. $if(listings-disable-line-numbers)$
  693. xleftmargin = 0.6em,
  694. framexleftmargin = 0.4em,
  695. $else$
  696. numbers = left,
  697. xleftmargin = 2.7em,
  698. framexleftmargin = 2.5em,
  699. $endif$
  700. backgroundcolor = \color{listing-background},
  701. basicstyle = \color{listing-text-color}\linespread{1.0}%
  702. \lst@ifdisplaystyle%
  703. $if(code-block-font-size)$$code-block-font-size$$else$\small$endif$%
  704. \fi\ttfamily{},
  705. breaklines = true,
  706. frame = single,
  707. framesep = 0.19em,
  708. rulecolor = \color{listing-rule},
  709. frameround = ffff,
  710. tabsize = 4,
  711. numberstyle = \color{listing-numbers},
  712. aboveskip = 1.0em,
  713. belowskip = 0.1em,
  714. abovecaptionskip = 0em,
  715. belowcaptionskip = 1.0em,
  716. keywordstyle = {\color{listing-keyword}\bfseries},
  717. keywordstyle = {[2]\color{listing-keyword-2}\bfseries},
  718. keywordstyle = {[3]\color{listing-keyword-3}\bfseries\itshape},
  719. sensitive = true,
  720. identifierstyle = \color{listing-identifier},
  721. commentstyle = \color{listing-comment},
  722. stringstyle = \color{listing-string},
  723. showstringspaces = false,
  724. escapeinside = {/*@}{@*/}, % Allow LaTeX inside these special comments
  725. literate =
  726. {á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1
  727. {Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1
  728. {à}{{\`a}}1 {è}{{\'e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1
  729. {À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1
  730. {ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1
  731. {Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1
  732. {â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1
  733. {Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1
  734. {œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1
  735. {ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1
  736. {€}{{\EUR}}1 {£}{{\pounds}}1 {«}{{\guillemotleft}}1
  737. {»}{{\guillemotright}}1 {ñ}{{\~n}}1 {Ñ}{{\~N}}1 {¿}{{?`}}1
  738. {…}{{\ldots}}1 {≥}{{>=}}1 {≤}{{<=}}1 {„}{{\glqq}}1 {“}{{\grqq}}1
  739. {”}{{''}}1
  740. }
  741. \lstset{style=eisvogel_listing_style}
  742. %
  743. % Java (Java SE 12, 2019-06-22)
  744. %
  745. \lstdefinelanguage{Java}{
  746. morekeywords={
  747. % normal keywords (without data types)
  748. abstract,assert,break,case,catch,class,continue,default,
  749. do,else,enum,exports,extends,final,finally,for,if,implements,
  750. import,instanceof,interface,module,native,new,package,private,
  751. protected,public,requires,return,static,strictfp,super,switch,
  752. synchronized,this,throw,throws,transient,try,volatile,while,
  753. % var is an identifier
  754. var
  755. },
  756. morekeywords={[2] % data types
  757. % primitive data types
  758. boolean,byte,char,double,float,int,long,short,
  759. % String
  760. String,
  761. % primitive wrapper types
  762. Boolean,Byte,Character,Double,Float,Integer,Long,Short
  763. % number types
  764. Number,AtomicInteger,AtomicLong,BigDecimal,BigInteger,DoubleAccumulator,DoubleAdder,LongAccumulator,LongAdder,Short,
  765. % other
  766. Object,Void,void
  767. },
  768. morekeywords={[3] % literals
  769. % reserved words for literal values
  770. null,true,false,
  771. },
  772. sensitive,
  773. morecomment = [l]//,
  774. morecomment = [s]{/*}{*/},
  775. morecomment = [s]{/**}{*/},
  776. morestring = [b]",
  777. morestring = [b]',
  778. }
  779. \lstdefinelanguage{XML}{
  780. morestring = [b]",
  781. moredelim = [s][\bfseries\color{listing-keyword}]{<}{\ },
  782. moredelim = [s][\bfseries\color{listing-keyword}]{</}{>},
  783. moredelim = [l][\bfseries\color{listing-keyword}]{/>},
  784. moredelim = [l][\bfseries\color{listing-keyword}]{>},
  785. morecomment = [s]{<?}{?>},
  786. morecomment = [s]{<!--}{-->},
  787. commentstyle = \color{listing-comment},
  788. stringstyle = \color{listing-string},
  789. identifierstyle = \color{listing-identifier}
  790. }
  791. $endif$
  792. %
  793. % header and footer
  794. %
  795. $if(beamer)$
  796. $else$
  797. $if(disable-header-and-footer)$
  798. $else$
  799. \usepackage[headsepline,footsepline]{scrlayer-scrpage}
  800. \newpairofpagestyles{eisvogel-header-footer}{
  801. \clearpairofpagestyles
  802. \ihead[$if(header-right)$$header-right$$else$$date$$endif$]{$if(header-left)$$header-left$$else$$title$$endif$}
  803. \chead[$if(header-center)$$header-center$$else$$endif$]{$if(header-center)$$header-center$$else$$endif$}
  804. \ohead[$if(header-left)$$header-left$$else$$title$$endif$]{$if(header-right)$$header-right$$else$$date$$endif$}
  805. \ifoot[$if(footer-right)$$footer-right$$else$\thepage$endif$]{$if(footer-left)$$footer-left$$else$$for(author)$$author$$sep$, $endfor$$endif$}
  806. \cfoot[$if(footer-center)$$footer-center$$else$$endif$]{$if(footer-center)$$footer-center$$else$$endif$}
  807. \ofoot[$if(footer-left)$$footer-left$$else$$for(author)$$author$$sep$, $endfor$$endif$]{$if(footer-right)$$footer-right$$else$\thepage$endif$}
  808. \addtokomafont{pageheadfoot}{\upshape}
  809. }
  810. \pagestyle{eisvogel-header-footer}
  811. $if(page-background)$
  812. \backgroundsetup{
  813. scale=1,
  814. color=black,
  815. opacity=$if(page-background-opacity)$$page-background-opacity$$else$0.2$endif$,
  816. angle=0,
  817. contents={%
  818. \includegraphics[width=\paperwidth,height=\paperheight]{$page-background$}
  819. }%
  820. }
  821. $endif$
  822. $endif$
  823. $endif$
  824. %%
  825. %% end added
  826. %%
  827. \begin{document}
  828. %%
  829. %% begin titlepage
  830. %%
  831. $if(beamer)$
  832. $else$
  833. $if(titlepage)$
  834. \begin{titlepage}
  835. $if(titlepage-background)$
  836. \newgeometry{top=2cm, right=4cm, bottom=3cm, left=4cm}
  837. $else$
  838. \newgeometry{left=6cm}
  839. $endif$
  840. $if(titlepage-color)$
  841. \definecolor{titlepage-color}{HTML}{$titlepage-color$}
  842. \newpagecolor{titlepage-color}\afterpage{\restorepagecolor}
  843. $endif$
  844. $if(titlepage-background)$
  845. \tikz[remember picture,overlay] \node[inner sep=0pt] at (current page.center){\includegraphics[width=\paperwidth,height=\paperheight]{$titlepage-background$}};
  846. $endif$
  847. \newcommand{\colorRule}[3][black]{\textcolor[HTML]{#1}{\rule{#2}{#3}}}
  848. \begin{flushleft}
  849. \noindent
  850. \\[-1em]
  851. \color[HTML]{$if(titlepage-text-color)$$titlepage-text-color$$else$5F5F5F$endif$}
  852. \makebox[0pt][l]{\colorRule[$if(titlepage-rule-color)$$titlepage-rule-color$$else$435488$endif$]{1.3\textwidth}{$if(titlepage-rule-height)$$titlepage-rule-height$$else$4$endif$pt}}
  853. \par
  854. \noindent
  855. $if(titlepage-background)$
  856. % The titlepage with a background image has other text spacing and text size
  857. {
  858. \setstretch{2}
  859. \vfill
  860. \vskip -8em
  861. \noindent {\huge \textbf{\textsf{$title$}}}
  862. $if(subtitle)$
  863. \vskip 1em
  864. {\Large \textsf{$subtitle$}}
  865. $endif$
  866. \vskip 2em
  867. \noindent {\Large \textsf{$for(author)$$author$$sep$, $endfor$} \vskip 0.6em \textsf{$date$}}
  868. \vfill
  869. }
  870. $else$
  871. {
  872. \setstretch{1.4}
  873. \vfill
  874. \noindent {\huge \textbf{\textsf{$title$}}}
  875. $if(subtitle)$
  876. \vskip 1em
  877. {\Large \textsf{$subtitle$}}
  878. $endif$
  879. \vskip 2em
  880. \noindent {\Large \textsf{$for(author)$$author$$sep$, $endfor$}}
  881. \vfill
  882. }
  883. $endif$
  884. $if(logo)$
  885. \noindent
  886. \includegraphics[width=$if(logo-width)$$logo-width$$else$35mm$endif$, left]{$logo$}
  887. $endif$
  888. $if(titlepage-background)$
  889. $else$
  890. \textsf{$date$}
  891. $endif$
  892. \end{flushleft}
  893. \end{titlepage}
  894. \restoregeometry
  895. \pagenumbering{arabic}
  896. $endif$
  897. $endif$
  898. %%
  899. %% end titlepage
  900. %%
  901. $if(has-frontmatter)$
  902. \frontmatter
  903. $endif$
  904. $if(title)$
  905. $if(beamer)$
  906. \frame{\titlepage}
  907. $endif$
  908. $if(abstract)$
  909. \begin{abstract}
  910. $abstract$
  911. \end{abstract}
  912. $endif$
  913. $endif$
  914. $if(first-chapter)$
  915. \setcounter{chapter}{$first-chapter$}
  916. \addtocounter{chapter}{-1}
  917. $endif$
  918. $for(include-before)$
  919. $include-before$
  920. $endfor$
  921. $if(toc)$
  922. $if(toc-title)$
  923. \renewcommand*\contentsname{$toc-title$}
  924. $endif$
  925. $if(beamer)$
  926. \begin{frame}[allowframebreaks]
  927. $if(toc-title)$
  928. \frametitle{$toc-title$}
  929. $endif$
  930. \tableofcontents[hideallsubsections]
  931. \end{frame}
  932. $if(toc-own-page)$
  933. \newpage
  934. $endif$
  935. $else$
  936. {
  937. $if(colorlinks)$
  938. \hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$$endif$}
  939. $endif$
  940. \setcounter{tocdepth}{$toc-depth$}
  941. \tableofcontents
  942. $if(toc-own-page)$
  943. \newpage
  944. $endif$
  945. }
  946. $endif$
  947. $endif$
  948. $if(lof)$
  949. \listoffigures
  950. $endif$
  951. $if(lot)$
  952. \listoftables
  953. $endif$
  954. $if(linestretch)$
  955. \setstretch{$linestretch$}
  956. $endif$
  957. $if(has-frontmatter)$
  958. \mainmatter
  959. $endif$
  960. $body$
  961. $if(has-frontmatter)$
  962. \backmatter
  963. $endif$
  964. $if(natbib)$
  965. $if(bibliography)$
  966. $if(biblio-title)$
  967. $if(has-chapters)$
  968. \renewcommand\bibname{$biblio-title$}
  969. $else$
  970. \renewcommand\refname{$biblio-title$}
  971. $endif$
  972. $endif$
  973. $if(beamer)$
  974. \begin{frame}[allowframebreaks]{$biblio-title$}
  975. \bibliographytrue
  976. $endif$
  977. \bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
  978. $if(beamer)$
  979. \end{frame}
  980. $endif$
  981. $endif$
  982. $endif$
  983. $if(biblatex)$
  984. $if(beamer)$
  985. \begin{frame}[allowframebreaks]{$biblio-title$}
  986. \bibliographytrue
  987. \printbibliography[heading=none]
  988. \end{frame}
  989. $else$
  990. \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
  991. $endif$
  992. $endif$
  993. $for(include-after)$
  994. $include-after$
  995. $endfor$
  996. \end{document}