base.tex.j2 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. ((=- Latex base template (must inherit)
  2. This template builds upon the abstract template, adding common latex output
  3. functions. Figures, data_text,
  4. This template defines defines a default docclass, the inheriting class should
  5. override this.-=))
  6. ((*- extends 'document_contents.tex.j2' -*))
  7. %===============================================================================
  8. % Abstract overrides
  9. %===============================================================================
  10. ((*- block header -*))
  11. ((* block docclass *))\documentclass[11pt]{article}((* endblock docclass *))
  12. ((* block packages *))
  13. % Basic figure setup, for now with no caption control since it's done
  14. % automatically by Pandoc (which extracts ![](path) syntax from Markdown).
  15. \usepackage{graphicx}
  16. % Keep aspect ratio if custom image width or height is specified
  17. \setkeys{Gin}{keepaspectratio}
  18. % Maintain compatibility with old templates. Remove in nbconvert 6.0
  19. \let\Oldincludegraphics\includegraphics
  20. % Ensure that by default, figures have no caption (until we provide a
  21. % proper Figure object with a Caption API and a way to capture that
  22. % in the conversion process - todo).
  23. \usepackage{caption}
  24. \DeclareCaptionFormat{nocaption}{}
  25. \captionsetup{format=nocaption,aboveskip=0pt,belowskip=0pt}
  26. \usepackage{float}
  27. \floatplacement{figure}{H} % forces figures to be placed at the correct location
  28. \usepackage{xcolor} % Allow colors to be defined
  29. \usepackage{enumerate} % Needed for markdown enumerations to work
  30. \usepackage{geometry} % Used to adjust the document margins
  31. \usepackage{amsmath} % Equations
  32. \usepackage{amssymb} % Equations
  33. \usepackage{textcomp} % defines textquotesingle
  34. % Hack from http://tex.stackexchange.com/a/47451/13684:
  35. \AtBeginDocument{%
  36. \def\PYZsq{\textquotesingle}% Upright quotes in Pygmentized code
  37. }
  38. \usepackage{upquote} % Upright quotes for verbatim code
  39. \usepackage{eurosym} % defines \euro
  40. \usepackage{iftex}
  41. \ifPDFTeX
  42. \usepackage[T1]{fontenc}
  43. \IfFileExists{alphabeta.sty}{
  44. \usepackage{alphabeta}
  45. }{
  46. \usepackage[mathletters]{ucs}
  47. \usepackage[utf8x]{inputenc}
  48. }
  49. \else
  50. \usepackage{fontspec}
  51. \usepackage{unicode-math}
  52. \fi
  53. \usepackage{fancyvrb} % verbatim replacement that allows latex
  54. \usepackage{grffile} % extends the file name processing of package graphics
  55. % to support a larger range
  56. \makeatletter % fix for old versions of grffile with XeLaTeX
  57. \@ifpackagelater{grffile}{2019/11/01}
  58. {
  59. % Do nothing on new versions
  60. }
  61. {
  62. \def\Gread@@xetex#1{%
  63. \IfFileExists{"\Gin@base".bb}%
  64. {\Gread@eps{\Gin@base.bb}}%
  65. {\Gread@@xetex@aux#1}%
  66. }
  67. }
  68. \makeatother
  69. \usepackage[Export]{adjustbox} % Used to constrain images to a maximum size
  70. \adjustboxset{max size={0.9\linewidth}{0.9\paperheight}}
  71. % The hyperref package gives us a pdf with properly built
  72. % internal navigation ('pdf bookmarks' for the table of contents,
  73. % internal cross-reference links, web links for URLs, etc.)
  74. \usepackage{hyperref}
  75. % The default LaTeX title has an obnoxious amount of whitespace. By default,
  76. % titling removes some of it. It also provides customization options.
  77. \usepackage{titling}
  78. \usepackage{longtable} % longtable support required by pandoc >1.10
  79. \usepackage{booktabs} % table support for pandoc > 1.12.2
  80. \usepackage{array} % table support for pandoc >= 2.11.3
  81. \usepackage{calc} % table minipage width calculation for pandoc >= 2.11.1
  82. \usepackage[inline]{enumitem} % IRkernel/repr support (it uses the enumerate* environment)
  83. \usepackage[normalem]{ulem} % ulem is needed to support strikethroughs (\sout)
  84. % normalem makes italics be italics, not underlines
  85. \usepackage{soul} % strikethrough (\st) support for pandoc >= 3.0.0
  86. \usepackage{mathrsfs}
  87. ((* endblock packages *))
  88. ((* block definitions *))
  89. % Colors for the hyperref package
  90. \definecolor{urlcolor}{rgb}{0,.145,.698}
  91. \definecolor{linkcolor}{rgb}{.71,0.21,0.01}
  92. \definecolor{citecolor}{rgb}{.12,.54,.11}
  93. % ANSI colors
  94. \definecolor{ansi-black}{HTML}{3E424D}
  95. \definecolor{ansi-black-intense}{HTML}{282C36}
  96. \definecolor{ansi-red}{HTML}{E75C58}
  97. \definecolor{ansi-red-intense}{HTML}{B22B31}
  98. \definecolor{ansi-green}{HTML}{00A250}
  99. \definecolor{ansi-green-intense}{HTML}{007427}
  100. \definecolor{ansi-yellow}{HTML}{DDB62B}
  101. \definecolor{ansi-yellow-intense}{HTML}{B27D12}
  102. \definecolor{ansi-blue}{HTML}{208FFB}
  103. \definecolor{ansi-blue-intense}{HTML}{0065CA}
  104. \definecolor{ansi-magenta}{HTML}{D160C4}
  105. \definecolor{ansi-magenta-intense}{HTML}{A03196}
  106. \definecolor{ansi-cyan}{HTML}{60C6C8}
  107. \definecolor{ansi-cyan-intense}{HTML}{258F8F}
  108. \definecolor{ansi-white}{HTML}{C5C1B4}
  109. \definecolor{ansi-white-intense}{HTML}{A1A6B2}
  110. \definecolor{ansi-default-inverse-fg}{HTML}{FFFFFF}
  111. \definecolor{ansi-default-inverse-bg}{HTML}{000000}
  112. % common color for the border for error outputs.
  113. \definecolor{outerrorbackground}{HTML}{FFDFDF}
  114. % commands and environments needed by pandoc snippets
  115. % extracted from the output of `pandoc -s`
  116. \providecommand{\tightlist}{%
  117. \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
  118. \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
  119. % Add ',fontsize=\small' for more characters per line
  120. \newenvironment{Shaded}{}{}
  121. \newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
  122. \newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}}
  123. \newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
  124. \newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
  125. \newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
  126. \newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
  127. \newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
  128. \newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}}
  129. \newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
  130. \newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
  131. \newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}}
  132. \newcommand{\RegionMarkerTok}[1]{{#1}}
  133. \newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
  134. \newcommand{\NormalTok}[1]{{#1}}
  135. % Additional commands for more recent versions of Pandoc
  136. \newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{{#1}}}
  137. \newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
  138. \newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
  139. \newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{{#1}}}
  140. \newcommand{\ImportTok}[1]{{#1}}
  141. \newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{{#1}}}}
  142. \newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
  143. \newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
  144. \newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{{#1}}}
  145. \newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
  146. \newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{{#1}}}
  147. \newcommand{\BuiltInTok}[1]{{#1}}
  148. \newcommand{\ExtensionTok}[1]{{#1}}
  149. \newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{{#1}}}
  150. \newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{{#1}}}
  151. \newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
  152. \newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
  153. \makeatletter
  154. \newsavebox\pandoc@box
  155. \newcommand*\pandocbounded[1]{%
  156. \sbox\pandoc@box{#1}%
  157. % scaling factors for width and height
  158. \Gscale@div\@tempa\textheight{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%
  159. \Gscale@div\@tempb\linewidth{\wd\pandoc@box}%
  160. % select the smaller of both
  161. \ifdim\@tempb\p@<\@tempa\p@
  162. \let\@tempa\@tempb
  163. \fi
  164. % scaling accordingly (\@tempa < 1)
  165. \ifdim\@tempa\p@<\p@
  166. \scalebox{\@tempa}{\usebox\pandoc@box}%
  167. % scaling not needed, use as it is
  168. \else
  169. \usebox{\pandoc@box}%
  170. \fi
  171. }
  172. \makeatother
  173. % Define a nice break command that doesn't care if a line doesn't already
  174. % exist.
  175. \def\br{\hspace*{\fill} \\* }
  176. % Math Jax compatibility definitions
  177. \def\gt{>}
  178. \def\lt{<}
  179. \let\Oldtex\TeX
  180. \let\Oldlatex\LaTeX
  181. \renewcommand{\TeX}{\textrm{\Oldtex}}
  182. \renewcommand{\LaTeX}{\textrm{\Oldlatex}}
  183. % Document parameters
  184. % Document title
  185. ((* block title -*))
  186. ((*- set nb_title = nb.metadata.get('title', '') or resources['metadata']['name'] -*))
  187. \title{((( nb_title | escape_latex )))}
  188. ((*- endblock title *))
  189. ((* block date *))
  190. ((* if 'date' in nb.metadata *))
  191. \date{((( nb.metadata.date | escape_latex )))}
  192. ((* endif *))
  193. ((* endblock date *))
  194. ((* block author *))
  195. ((* if 'authors' in nb.metadata *))
  196. \author{((( nb.metadata.authors | join(', ', attribute='name') )))}
  197. ((* endif *))
  198. ((* endblock author *))
  199. ((* endblock definitions *))
  200. ((* block commands *))
  201. % Prevent overflowing lines due to hard-to-break entities
  202. \sloppy
  203. % Setup hyperref package
  204. \hypersetup{
  205. breaklinks=true, % so long urls are correctly broken across lines
  206. colorlinks=true,
  207. urlcolor=urlcolor,
  208. linkcolor=linkcolor,
  209. citecolor=citecolor,
  210. }
  211. % Slightly bigger margins than the latex defaults
  212. ((* block margins *))
  213. \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
  214. ((* endblock margins *))
  215. ((* endblock commands *))
  216. ((* endblock header *))
  217. ((* block body *))
  218. \begin{document}
  219. ((* block predoc *))
  220. ((* block maketitle *))\maketitle((* endblock maketitle *))
  221. ((* block abstract *))((* endblock abstract *))
  222. ((* endblock predoc *))
  223. ((( super() )))
  224. % Add a bibliography block to the postdoc
  225. ((* block postdoc *))
  226. ((* block bibliography *))((* endblock bibliography *))
  227. ((* endblock postdoc *))
  228. \end{document}
  229. ((* endblock body *))