|
|
((============================================================================
|
|
|
NBConvert Sphinx-Latex Template
|
|
|
|
|
|
Purpose: Allow export of PDF friendly Latex inspired by Sphinx. Most of the
|
|
|
template is derived directly from Sphinx source.
|
|
|
|
|
|
Inheritance: null>display_priority>latex_base
|
|
|
|
|
|
==========================================================================))
|
|
|
|
|
|
((*- extends 'latex_base.tplx' -*))
|
|
|
|
|
|
((* block header *))
|
|
|
% Header, overrides base
|
|
|
|
|
|
% Make sure that the sphinx doc style knows who it inherits from.
|
|
|
\def\sphinxdocclass{(((parentdocumentclass)))}
|
|
|
|
|
|
% Declare the document class
|
|
|
\documentclass[letterpaper,10pt,english]{sphinx(((documentclass)))}
|
|
|
|
|
|
% Imports
|
|
|
\usepackage[utf8]{inputenc}
|
|
|
\DeclareUnicodeCharacter{00A0}{\\nobreakspace}
|
|
|
\usepackage[T1]{fontenc}
|
|
|
\usepackage{babel}
|
|
|
\usepackage{times}
|
|
|
\usepackage{import}
|
|
|
\usepackage[Bjarne]{fncychap}
|
|
|
\usepackage{longtable}
|
|
|
\usepackage{sphinx}
|
|
|
\usepackage{multirow}
|
|
|
|
|
|
% Document level variables
|
|
|
\title{((( nb.metadata.name )))}
|
|
|
\date{\today}
|
|
|
\release{}
|
|
|
\author{Unknown Author}
|
|
|
\newcommand{\sphinxlogo}{}
|
|
|
\renewcommand{\releasename}{Release}
|
|
|
\makeindex
|
|
|
|
|
|
|
|
|
((* block sphinxheader *))((* endblock sphinxheader *))
|
|
|
|
|
|
((* endblock header *))
|
|
|
|
|
|
((* block bodyBegin *))
|
|
|
% Body
|
|
|
|
|
|
% Start of the document
|
|
|
\begin{document}
|
|
|
\maketitle
|
|
|
\tableofcontents
|
|
|
|
|
|
((* endblock bodyBegin *))((* block bodyEnd *))
|
|
|
|
|
|
\renewcommand{\indexname}{Index}
|
|
|
\printindex
|
|
|
|
|
|
% End of document
|
|
|
\end{document}
|
|
|
((* endblock bodyEnd *))
|
|
|
|
|
|
% Footer
|
|
|
((* block footer *))
|
|
|
((* endblock footer *))
|
|
|
|
|
|
((* block headingcell -*))
|
|
|
\
|
|
|
((*- if cell.level == 1 -*))
|
|
|
((* block h1 -*))part((* endblock h1 -*))
|
|
|
((*- elif cell.level == 2 -*))
|
|
|
((* block h2 -*))chapter((* endblock h2 -*))
|
|
|
((*- elif cell.level == 3 -*))
|
|
|
((* block h3 -*))section((* endblock h3 -*))
|
|
|
((*- elif cell.level == 4 -*))
|
|
|
((* block h4 -*))subsection((* endblock h4 -*))
|
|
|
((*- elif cell.level == 5 -*))
|
|
|
((* block h5 -*))subsubsection((* endblock h5 -*))
|
|
|
((*- elif cell.level == 6 -*))
|
|
|
((* block h6 -*))paragraph((* endblock h6 -*))
|
|
|
((*- endif -*)){((( cell.source | markdown2latex )))}
|
|
|
((*- endblock headingcell *))
|
|
|
|
|
|
((* block unknowncell scoped*))
|
|
|
|
|
|
% Unsupported cell type, no formatting
|
|
|
((( filterOutLatex(cell.source) )))
|
|
|
((* endblock unknowncell *))
|
|
|
|
|
|
((*- block markdowncell scoped-*))
|
|
|
((( super() )))
|
|
|
((*- endblock markdowncell -*))
|
|
|
|
|
|
((= Raw text cells allow the user to manually inject document code that will
|
|
|
not get touched by the templating system. =))
|
|
|
((*- block rawcell *))
|
|
|
((( cell.source )))
|
|
|
((* endblock rawcell -*))
|
|
|
|
|
|
((* macro filterOutLatex(text) -*))
|
|
|
((*- set text = text|replace("\\","\\backslash") -*))
|
|
|
((*- set text = text|replace("{","\\{") -*))
|
|
|
((*- set text = text|replace("}","\\}") -*))
|
|
|
((*- set text = text|replace("|","\\vert") -*))
|
|
|
((( text )))
|
|
|
((*- endmacro *))
|
|
|
|
|
|
% Useful to block TODO: Remove/move this block below
|
|
|
|
|
|
\setbox0\vbox{
|
|
|
\begin{minipage}{0.95\linewidth}
|
|
|
|
|
|
\end{minipage}}
|
|
|
\begin{center}\setlength{\fboxsep}{5pt}
|
|
|
\shadowbox{\box0}\end{center}
|
|
|
|
|
|
|
|
|
((========================================================================
|
|
|
EVERYTHING BELOW HERE STILL NEEDS TO BE FILLED IN!
|
|
|
========================================================================))
|
|
|
|
|
|
((*- block codecell scoped -*))
|
|
|
((*- block input_group -*))
|
|
|
((*- block in_prompt -*))((*- endblock in_prompt -*))
|
|
|
((*- block input -*))((*- endblock input -*))
|
|
|
((*- endblock input_group -*))
|
|
|
((*- if cell.outputs -*))
|
|
|
((*- block output_group -*))
|
|
|
((*- block output_prompt -*))((*- endblock output_prompt -*))
|
|
|
((*- block outputs -*))
|
|
|
((*- for output in cell.outputs -*))
|
|
|
((*- if output.output_type in ['pyout'] -*))
|
|
|
((*- block pyout scoped -*))((*- endblock pyout -*))
|
|
|
((*- elif output.output_type in ['stream'] -*))
|
|
|
((*- block stream scoped -*))
|
|
|
((*- if output.stream in ['stdout'] -*))
|
|
|
((*- block stream_stdout scoped -*))
|
|
|
((*- endblock stream_stdout -*))
|
|
|
((*- elif output.stream in ['stderr'] -*))
|
|
|
((*- block stream_stderr scoped -*))
|
|
|
((*- endblock stream_stderr -*))
|
|
|
((*- endif -*))
|
|
|
((*- endblock stream -*))
|
|
|
((*- elif output.output_type in ['display_data'] -*))
|
|
|
((*- block display_data scoped -*))
|
|
|
((*- block data_priority scoped -*))
|
|
|
((*- endblock data_priority -*))
|
|
|
((*- endblock display_data -*))
|
|
|
((*- elif output.output_type in ['pyerr'] -*))
|
|
|
((*- block pyerr scoped -*))
|
|
|
((*- for line in output.traceback -*))
|
|
|
((*- block traceback_line scoped -*))((*- endblock traceback_line -*))
|
|
|
((*- endfor -*))
|
|
|
((*- endblock pyerr -*))
|
|
|
((*- endif -*))
|
|
|
((*- endfor -*))
|
|
|
((*- endblock outputs -*))
|
|
|
((*- endblock output_group -*))
|
|
|
((*- endif -*))
|
|
|
((*- endblock codecell -*))
|
|
|
|