base.tplx 8.8 KB

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