pandoc-scholar.latex 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  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(dir)$
  8. $if(latex-dir-rtl)$
  9. \PassOptionsToPackage{RTLdocument}{bidi}
  10. $endif$
  11. $endif$
  12. $if(CJKmainfont)$
  13. \PassOptionsToPackage{space}{xeCJK}
  14. $endif$
  15. %
  16. \documentclass[
  17. $if(fontsize)$
  18. $fontsize$,
  19. $endif$
  20. $if(lang)$
  21. $babel-lang$,
  22. $endif$
  23. $if(papersize)$
  24. $papersize$paper,
  25. $endif$
  26. $for(classoption)$
  27. $classoption$$sep$,
  28. $endfor$
  29. ]{$documentclass$}
  30. \usepackage{amsmath,amssymb}
  31. $if(fontfamily)$
  32. \usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
  33. $else$
  34. \usepackage{lmodern}
  35. $endif$
  36. $if(linestretch)$
  37. \usepackage{setspace}
  38. $endif$
  39. \usepackage{ifxetex,ifluatex}
  40. \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  41. \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
  42. \usepackage[utf8]{inputenc}
  43. \usepackage{textcomp} % provide euro and other symbols
  44. \else % if luatex or xetex
  45. $if(mathspec)$
  46. \ifxetex
  47. \usepackage{mathspec}
  48. \else
  49. \usepackage{unicode-math}
  50. \fi
  51. $else$
  52. \usepackage{unicode-math}
  53. $endif$
  54. \defaultfontfeatures{Scale=MatchLowercase}
  55. \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
  56. $if(mainfont)$
  57. \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
  58. $endif$
  59. $if(sansfont)$
  60. \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
  61. $endif$
  62. $if(monofont)$
  63. \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$]{$monofont$}
  64. $endif$
  65. $for(fontfamilies)$
  66. \newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$}
  67. $endfor$
  68. $if(mathfont)$
  69. $if(mathspec)$
  70. \ifxetex
  71. \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
  72. \else
  73. \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
  74. \fi
  75. $else$
  76. \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
  77. $endif$
  78. $endif$
  79. $if(CJKmainfont)$
  80. \ifxetex
  81. \usepackage{xeCJK}
  82. \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
  83. \fi
  84. $endif$
  85. $if(luatexjapresetoptions)$
  86. \ifluatex
  87. \usepackage[$for(luatexjapresetoptions)$$luatexjapresetoptions$$sep$,$endfor$]{luatexja-preset}
  88. \fi
  89. $endif$
  90. $if(CJKmainfont)$
  91. \ifluatex
  92. \usepackage[$for(luatexjafontspecoptions)$$luatexjafontspecoptions$$sep$,$endfor$]{luatexja-fontspec}
  93. \setmainjfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
  94. \fi
  95. $endif$
  96. \fi
  97. % Use upquote if available, for straight quotes in verbatim environments
  98. \IfFileExists{upquote.sty}{\usepackage{upquote}}{}
  99. \IfFileExists{microtype.sty}{% use microtype if available
  100. \usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype}
  101. \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
  102. }{}
  103. $if(indent)$
  104. $else$
  105. \makeatletter
  106. \@ifundefined{KOMAClassName}{% if non-KOMA class
  107. \IfFileExists{parskip.sty}{%
  108. \usepackage{parskip}
  109. }{% else
  110. \setlength{\parindent}{0pt}
  111. \setlength{\parskip}{6pt plus 2pt minus 1pt}}
  112. }{% if KOMA class
  113. \KOMAoptions{parskip=half}}
  114. \makeatother
  115. $endif$
  116. $if(verbatim-in-note)$
  117. \usepackage{fancyvrb}
  118. $endif$
  119. \usepackage{xcolor}
  120. \IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
  121. \IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
  122. \hypersetup{
  123. $if(title-meta)$
  124. pdftitle={$title-meta$},
  125. $endif$
  126. $if(author-meta)$
  127. pdfauthor={$author-meta$},
  128. $endif$
  129. $if(lang)$
  130. pdflang={$lang$},
  131. $endif$
  132. $if(subject)$
  133. pdfsubject={$subject$},
  134. $endif$
  135. $if(keywords)$
  136. pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$},
  137. $endif$
  138. $if(colorlinks)$
  139. colorlinks=true,
  140. linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$,
  141. filecolor=$if(filecolor)$$filecolor$$else$Maroon$endif$,
  142. citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$,
  143. urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$,
  144. $else$
  145. hidelinks,
  146. $endif$
  147. pdfcreator={LaTeX via pandoc}}
  148. \urlstyle{same} % disable monospaced font for URLs
  149. $if(verbatim-in-note)$
  150. \VerbatimFootnotes % allow verbatim text in footnotes
  151. $endif$
  152. $if(geometry)$
  153. \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
  154. $endif$
  155. $if(listings)$
  156. \usepackage{listings}
  157. \newcommand{\passthrough}[1]{#1}
  158. \lstset{defaultdialect=[5.3]Lua}
  159. \lstset{defaultdialect=[x86masm]Assembler}
  160. $endif$
  161. $if(lhs)$
  162. \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
  163. $endif$
  164. $if(highlighting-macros)$
  165. $highlighting-macros$
  166. $endif$
  167. $if(tables)$
  168. \usepackage{longtable,booktabs,array}
  169. \usepackage{calc} % for calculating minipage widths
  170. % Correct order of tables after \paragraph or \subparagraph
  171. \usepackage{etoolbox}
  172. \makeatletter
  173. \patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
  174. \makeatother
  175. % Allow footnotes in longtable head/foot
  176. \IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
  177. \makesavenoteenv{longtable}
  178. $endif$
  179. $if(graphics)$
  180. \usepackage{graphicx}
  181. \makeatletter
  182. \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
  183. \def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
  184. \makeatother
  185. % Scale images if necessary, so that they will not overflow the page
  186. % margins by default, and it is still possible to overwrite the defaults
  187. % using explicit options in \includegraphics[width, height, ...]{}
  188. \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
  189. % Set default figure placement to htbp
  190. \makeatletter
  191. \def\fps@figure{htbp}
  192. \makeatother
  193. $endif$
  194. $if(links-as-notes)$
  195. % Make links footnotes instead of hotlinks:
  196. \DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}}
  197. $endif$
  198. $if(strikeout)$
  199. \usepackage[normalem]{ulem}
  200. % Avoid problems with \sout in headers with hyperref
  201. \pdfstringdefDisableCommands{\renewcommand{\sout}{}}
  202. $endif$
  203. \setlength{\emergencystretch}{3em} % prevent overfull lines
  204. \providecommand{\tightlist}{%
  205. \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
  206. $if(numbersections)$
  207. \setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$}
  208. $else$
  209. \setcounter{secnumdepth}{-\maxdimen} % remove section numbering
  210. $endif$
  211. $if(block-headings)$
  212. % Make \paragraph and \subparagraph free-standing
  213. \ifx\paragraph\undefined\else
  214. \let\oldparagraph\paragraph
  215. \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
  216. \fi
  217. \ifx\subparagraph\undefined\else
  218. \let\oldsubparagraph\subparagraph
  219. \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
  220. \fi
  221. $endif$
  222. $if(pagestyle)$
  223. \pagestyle{$pagestyle$}
  224. $endif$
  225. $for(header-includes)$
  226. $header-includes$
  227. $endfor$
  228. $if(lang)$
  229. \ifxetex
  230. % Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic)
  231. \usepackage{polyglossia}
  232. \setmainlanguage[$for(polyglossia-lang.options)$$polyglossia-lang.options$$sep$,$endfor$]{$polyglossia-lang.name$}
  233. $for(polyglossia-otherlangs)$
  234. \setotherlanguage[$for(polyglossia-otherlangs.options)$$polyglossia-otherlangs.options$$sep$,$endfor$]{$polyglossia-otherlangs.name$}
  235. $endfor$
  236. \else
  237. \usepackage[$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
  238. % get rid of language-specific shorthands (see #6817):
  239. \let\LanguageShortHands\languageshorthands
  240. \def\languageshorthands#1{}
  241. $if(babel-newcommands)$
  242. $babel-newcommands$
  243. $endif$
  244. \fi
  245. $endif$
  246. \ifluatex
  247. \usepackage{selnolig} % disable illegal ligatures
  248. \fi
  249. $if(dir)$
  250. \ifxetex
  251. % Load bidi as late as possible as it modifies e.g. graphicx
  252. \usepackage{bidi}
  253. \fi
  254. \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  255. \TeXXeTstate=1
  256. \newcommand{\RL}[1]{\beginR #1\endR}
  257. \newcommand{\LR}[1]{\beginL #1\endL}
  258. \newenvironment{RTL}{\beginR}{\endR}
  259. \newenvironment{LTR}{\beginL}{\endL}
  260. \fi
  261. $endif$
  262. $if(csl-refs)$
  263. \newlength{\cslhangindent}
  264. \setlength{\cslhangindent}{1.5em}
  265. \newlength{\csllabelwidth}
  266. \setlength{\csllabelwidth}{3em}
  267. \newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
  268. {% don't indent paragraphs
  269. \setlength{\parindent}{0pt}
  270. % turn on hanging indent if param 1 is 1
  271. \ifodd #1 \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces\fi
  272. % set entry spacing
  273. \ifnum #2 > 0
  274. \setlength{\parskip}{#2\baselineskip}
  275. \fi
  276. }%
  277. {}
  278. \usepackage{calc}
  279. \newcommand{\CSLBlock}[1]{#1\hfill\break}
  280. \newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
  281. \newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
  282. \newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
  283. % for compatibility with pandoc 2.10
  284. \newenvironment{cslreferences}%
  285. {$if(csl-hanging-indent)$\setlength{\parindent}{0pt}%
  286. \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}%
  287. {\par}
  288. $endif$
  289. $if(title)$
  290. \title{$title$$if(thanks)$\thanks{$thanks$}$endif$}
  291. $endif$
  292. $if(subtitle)$
  293. \usepackage{etoolbox}
  294. \makeatletter
  295. \providecommand{\subtitle}[1]{% add subtitle to \maketitle
  296. \apptocmd{\@title}{\par {\large #1 \par}}{}{}
  297. }
  298. \makeatother
  299. \subtitle{$subtitle$}
  300. $endif$
  301. \usepackage{authblk}
  302. $for(author)$
  303. \author[$for(author.institute_indices)$%
  304. $author.institute_indices$%
  305. $sep$,$endfor$]{%
  306. $author.name$%
  307. $if(author.correspondence)$$if(author.email)$%
  308. \textsuperscript{*\,}%
  309. %$endif$$endif$%
  310. $if(author.equal_contributor)$
  311. \textsuperscript{$if(equal_contributor_symbol)$$equal_contributor_symbol$$else$\textdagger$endif$\,}%
  312. $endif$%
  313. }
  314. $endfor$
  315. $for(institute)$
  316. \affil[$institute.index$]{$institute.name$}
  317. $endfor$
  318. \date{$date$}
  319. \makeatletter
  320. \def\@maketitle{%
  321. \newpage \null \vskip 2em
  322. \begin {center}%
  323. \let \footnote \thanks
  324. {\LARGE \@title \par}%
  325. \vskip 1.5em%
  326. {\large \lineskip .5em%
  327. \begin {tabular}[t]{c}%
  328. \@author
  329. \end {tabular}\par}%
  330. $if(has_equal_contributors)$
  331. \vskip 0.5em{\textsuperscript{$if(equal_contributor_symbol)$$equal_contributor_symbol$$else$\textdagger$endif$}\,%
  332. These authors contributed equally to this work.}
  333. $endif$
  334. $if(has_correspondence)$
  335. \vskip 0.2em{\textsuperscript{*}\,Correspondence:
  336. $for(author)$$if(author.correspondence)$$if(author.email)$
  337. $author.name$ <$author.email$>\\
  338. $endif$$endif$$endfor$}%
  339. %$endif$
  340. \vskip 1em{\large \@date}%
  341. \end {center}%
  342. \par
  343. \vskip 1.5em}
  344. \makeatother
  345. \begin{document}
  346. $if(has-frontmatter)$
  347. \frontmatter
  348. $endif$
  349. $if(title)$
  350. \maketitle
  351. $if(abstract)$
  352. \begin{abstract}
  353. $abstract$
  354. \end{abstract}
  355. $endif$
  356. $endif$
  357. $for(include-before)$
  358. $include-before$
  359. $endfor$
  360. $if(toc)$
  361. $if(toc-title)$
  362. \renewcommand*\contentsname{$toc-title$}
  363. $endif$
  364. {
  365. $if(colorlinks)$
  366. \hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$$endif$}
  367. $endif$
  368. \setcounter{tocdepth}{$toc-depth$}
  369. \tableofcontents
  370. }
  371. $endif$
  372. $if(lot)$
  373. \listoftables
  374. $endif$
  375. $if(lof)$
  376. \listoffigures
  377. $endif$
  378. $if(linestretch)$
  379. \setstretch{$linestretch$}
  380. $endif$
  381. $if(has-frontmatter)$
  382. \mainmatter
  383. $endif$
  384. $body$
  385. $if(has-frontmatter)$
  386. \backmatter
  387. $endif$
  388. $for(include-after)$
  389. $include-after$
  390. $endfor$
  391. \end{document}