|
|
((= Latex base template (must inherit)
|
|
|
This template builds upon the abstract template, adding common latex output
|
|
|
functions. Figures, data_text,
|
|
|
This template does not define a docclass, the inheriting class must define this.=))
|
|
|
|
|
|
((*- extends 'abstract.tplx' -*))
|
|
|
|
|
|
%===============================================================================
|
|
|
% Abstract overrides
|
|
|
%===============================================================================
|
|
|
|
|
|
((* block packages *))
|
|
|
\usepackage{graphicx} % Used to insert images
|
|
|
\usepackage{adjustbox} % Used to constrain images to a maximum size
|
|
|
\usepackage{color} % Allow colors to be defined
|
|
|
\usepackage{enumerate} % Needed for markdown enumerations to work
|
|
|
\usepackage{fancyvrb} % Needed to support color codes (tex) in verbatim blocks
|
|
|
\usepackage{geometry} % Used to adjust the document margins
|
|
|
\usepackage{amsmath} % Equations
|
|
|
\usepackage{amssymb} % Equations
|
|
|
\usepackage[utf8]{inputenc} % Allow utf-8 characters in the tex document
|
|
|
\usepackage{ucs} % Extended unicode (utf-8) support
|
|
|
\usepackage{alltt} % Verbatim replacement that allows latex
|
|
|
\usepackage{grffile} % extends the file name processing of package graphics
|
|
|
%to support a larger range
|
|
|
|
|
|
% The hyperref package gives us a pdf with properly built
|
|
|
% internal navigation ('pdf bookmarks' for the table of contents,
|
|
|
% internal cross-reference links, web links for URLs, etc.)
|
|
|
\usepackage{hyperref}
|
|
|
|
|
|
% Pygments definitions
|
|
|
((( resources.latex.pygment_definitions )))
|
|
|
((* endblock packages *))
|
|
|
|
|
|
((* block definitions *))
|
|
|
\definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
|
|
|
\definecolor{darkorange}{rgb}{.71,0.21,0.01}
|
|
|
\definecolor{darkgreen}{rgb}{.12,.54,.11}
|
|
|
\definecolor{myteal}{rgb}{.26, .44, .56}
|
|
|
\definecolor{gray}{gray}{0.45}
|
|
|
\definecolor{lightgray}{gray}{.95}
|
|
|
\definecolor{mediumgray}{gray}{.8}
|
|
|
\definecolor{inputbackground}{rgb}{.95, .95, .85}
|
|
|
\definecolor{outputbackground}{rgb}{.95, .95, .95}
|
|
|
\definecolor{traceback}{rgb}{1, .95, .95}
|
|
|
|
|
|
% new ansi colors
|
|
|
\definecolor{brown}{rgb}{0.54,0.27,0.07}
|
|
|
\definecolor{purple}{rgb}{0.5,0.0,0.5}
|
|
|
\definecolor{darkgray}{gray}{0.25}
|
|
|
\definecolor{lightred}{rgb}{1.0,0.39,0.28}
|
|
|
\definecolor{lightgreen}{rgb}{0.48,0.99,0.0}
|
|
|
\definecolor{lightblue}{rgb}{0.53,0.81,0.92}
|
|
|
\definecolor{lightpurple}{rgb}{0.87,0.63,0.87}
|
|
|
\definecolor{lightcyan}{rgb}{0.5,1.0,0.83}
|
|
|
|
|
|
% Define a nice break command that doesn't care if a line doesn't already
|
|
|
% exist.
|
|
|
\def\br{\hspace*{\fill} \\* }
|
|
|
|
|
|
% Define a custom verbatim that allows latex
|
|
|
\renewenvironment{Verbatim}[1][\unskip]
|
|
|
{\begin{alltt}}
|
|
|
{\end{alltt}}
|
|
|
|
|
|
% Document title
|
|
|
\title{((( resources.metadata.name | escape_latex )))}
|
|
|
((* endblock definitions *))
|
|
|
|
|
|
((* block commands *))
|
|
|
\sloppy % Prevent overflowing lines due to hard-to-break entities
|
|
|
|
|
|
% Setup hyperref package
|
|
|
\hypersetup{
|
|
|
breaklinks=true, % so long urls are correctly broken across lines
|
|
|
colorlinks=true,
|
|
|
urlcolor=blue,
|
|
|
linkcolor=darkorange,
|
|
|
citecolor=darkgreen,
|
|
|
}
|
|
|
|
|
|
% Slightly bigger margins than the latex defaults
|
|
|
\geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=2.5cm,rmargin=2.5cm}
|
|
|
|
|
|
% Hardcode size of all verbatim environments to be a bit smaller
|
|
|
\makeatletter
|
|
|
\g@addto@macro\@verbatim\small\topsep=0.5em\partopsep=0pt
|
|
|
\makeatother
|
|
|
((* endblock commands *))
|
|
|
|
|
|
((* block predoc *))
|
|
|
((* block maketitle *))\maketitle((* endblock maketitle *))
|
|
|
((* endblock predoc *))
|
|
|
|
|
|
%===============================================================================
|
|
|
% Support blocks
|
|
|
%===============================================================================
|
|
|
|
|
|
% Displaying simple data text
|
|
|
((* block data_text *))
|
|
|
\begin{Verbatim}
|
|
|
((( output.text | escape_latex )))
|
|
|
\end{Verbatim}
|
|
|
((* endblock data_text *))
|
|
|
|
|
|
% Display python error text as-is
|
|
|
((* block pyerr *))
|
|
|
\begin{Verbatim}
|
|
|
((( super() )))
|
|
|
\end{Verbatim}
|
|
|
((* endblock pyerr *))
|
|
|
((* block traceback_line *))
|
|
|
((( line | indent | strip_ansi | escape_latex )))
|
|
|
((* endblock traceback_line *))
|
|
|
|
|
|
% Display stream ouput with coloring
|
|
|
((* block stream *))
|
|
|
\begin{Verbatim}[commandchars=\\\{\}]
|
|
|
((( output.text | ansi2latex )))
|
|
|
\end{Verbatim}
|
|
|
((* endblock stream *))
|
|
|
|
|
|
% Display latex
|
|
|
((* block data_latex -*))
|
|
|
((*- if output.latex.startswith('$'): -*))
|
|
|
((= Replace $ symbols with more explicit, equation block. =))
|
|
|
\begin{equation*}
|
|
|
((( output.latex | strip_dollars )))
|
|
|
\end{equation*}
|
|
|
((*- else -*))
|
|
|
((( output.latex )))
|
|
|
((*- endif *))
|
|
|
((* endblock data_latex *))
|
|
|
|
|
|
% Default mechanism for rendering figures
|
|
|
((*- block data_png -*))((( draw_figure(output.png_filename) )))((*- endblock -*))
|
|
|
((*- block data_jpg -*))((( draw_figure(output.jpeg_filename) )))((*- endblock -*))
|
|
|
((*- block data_svg -*))((( draw_figure(output.svg_filename) )))((*- endblock -*))
|
|
|
((*- block data_pdf -*))((( draw_figure(output.pdf_filename) )))((*- endblock -*))
|
|
|
|
|
|
% Draw a figure using the graphicx package.
|
|
|
((* macro draw_figure(filename) -*))
|
|
|
((* set filename = filename | posix_path *))
|
|
|
((*- block figure scoped -*))
|
|
|
\begin{center}
|
|
|
\adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{((( filename )))}
|
|
|
\end{center}
|
|
|
{ \hspace*{\fill} \\}
|
|
|
((*- endblock figure -*))
|
|
|
((*- endmacro *))
|
|
|
|
|
|
% Draw heading cell. Explicitly map different cell levels.
|
|
|
((* block headingcell scoped -*))
|
|
|
((*- if cell.level == 1 -*))
|
|
|
((* block h1 -*))\section((* endblock h1 -*))
|
|
|
((*- elif cell.level == 2 -*))
|
|
|
((* block h2 -*))\subsection((* endblock h2 -*))
|
|
|
((*- elif cell.level == 3 -*))
|
|
|
((* block h3 -*))\subsubsection((* endblock h3 -*))
|
|
|
((*- elif cell.level == 4 -*))
|
|
|
((* block h4 -*))\paragraph((* endblock h4 -*))
|
|
|
((*- elif cell.level == 5 -*))
|
|
|
((* block h5 -*))\subparagraph((* endblock h5 -*))
|
|
|
((*- elif cell.level == 6 -*))
|
|
|
((* block h6 -*))\\*\textit((* endblock h6 -*))
|
|
|
((*- endif -*))
|
|
|
{((( cell.source | escape_latex )))}
|
|
|
((*- endblock headingcell *))
|
|
|
|
|
|
% Redirect pyout to display data priority.
|
|
|
((* block pyout scoped *))
|
|
|
((* block data_priority scoped *))
|
|
|
((( super() )))
|
|
|
((* endblock *))
|
|
|
((* endblock pyout *))
|
|
|
|
|
|
% Render markdown
|
|
|
((* block markdowncell scoped *))
|
|
|
((( cell.source | markdown2latex )))
|
|
|
((* endblock markdowncell *))
|
|
|
|
|
|
% Spit out the contents of raw cells unmodified
|
|
|
((* block rawcell scoped *))
|
|
|
((( cell.source )))
|
|
|
((* endblock rawcell *))
|
|
|
|
|
|
% Don't display unknown types
|
|
|
((* block unknowncell scoped *))
|
|
|
((* endblock unknowncell *))
|
|
|
|
|
|
% Render code using pygments
|
|
|
((* block input scoped *))
|
|
|
((( cell.input | highlight2latex )))
|
|
|
((* endblock input *))
|