##// END OF EJS Templates
Fixed image keys in templates to reflect changes to ExtractFigureTransformer....
Jonathan Frederic -
Show More
@@ -1,266 +1,266 b''
1 ((*- extends 'display_priority.tplx' -*))
1 ((*- extends 'display_priority.tplx' -*))
2
2
3 ((* block in_prompt *))((* endblock in_prompt *))
3 ((* block in_prompt *))((* endblock in_prompt *))
4
4
5 ((* block output_prompt *))((* endblock output_prompt *))
5 ((* block output_prompt *))((* endblock output_prompt *))
6
6
7 ((* block codecell *))\begin{codecell}((( super() )))
7 ((* block codecell *))\begin{codecell}((( super() )))
8 \end{codecell}
8 \end{codecell}
9 ((* endblock *))
9 ((* endblock *))
10
10
11 ((* block input *))
11 ((* block input *))
12 \begin{codeinput}
12 \begin{codeinput}
13 \begin{lstlisting}
13 \begin{lstlisting}
14 ((( cell.input )))
14 ((( cell.input )))
15 \end{lstlisting}
15 \end{lstlisting}
16 \end{codeinput}
16 \end{codeinput}
17 ((* endblock input *))
17 ((* endblock input *))
18
18
19
19
20 ((= Those Two are for error displaying
20 ((= Those Two are for error displaying
21 even if the first one seem to do nothing,
21 even if the first one seem to do nothing,
22 it introduces a new line
22 it introduces a new line
23
23
24 =))
24 =))
25 ((* block pyerr *))
25 ((* block pyerr *))
26 \begin{traceback}
26 \begin{traceback}
27 \begin{verbatim}((( super() )))
27 \begin{verbatim}((( super() )))
28 \end{verbatim}
28 \end{verbatim}
29 \end{traceback}
29 \end{traceback}
30 ((* endblock pyerr *))
30 ((* endblock pyerr *))
31
31
32 ((* block traceback_line *))
32 ((* block traceback_line *))
33 ((( line |indent| rm_ansi )))((* endblock traceback_line *))
33 ((( line |indent| rm_ansi )))((* endblock traceback_line *))
34 ((= .... =))
34 ((= .... =))
35
35
36
36
37 ((*- block output_group -*))
37 ((*- block output_group -*))
38 \begin{codeoutput}
38 \begin{codeoutput}
39 ((( super() )))
39 ((( super() )))
40 \end{codeoutput}((* endblock *))
40 \end{codeoutput}((* endblock *))
41
41
42 ((*- block data_png -*))
42 ((*- block data_png -*))
43 \begin{center}
43 \begin{center}
44 \includegraphics[max size={0.7\textwidth}{0.9\textheight}]{(((output.key_png)))}
44 \includegraphics[max size={0.7\textwidth}{0.9\textheight}]{(((output.png_filename)))}
45 \par
45 \par
46 \end{center}
46 \end{center}
47 ((*- endblock -*))
47 ((*- endblock -*))
48
48
49 ((*- block data_jpg -*))
49 ((*- block data_jpg -*))
50 \begin{center}
50 \begin{center}
51 \includegraphics[max size={0.7\textwidth}{0.9\textheight}]{(((output.key_jpeg)))}
51 \includegraphics[max size={0.7\textwidth}{0.9\textheight}]{(((output.jpeg_filename)))}
52 \par
52 \par
53 \end{center}
53 \end{center}
54 ((*- endblock -*))
54 ((*- endblock -*))
55
55
56 ((*- block data_svg -*))
56 ((*- block data_svg -*))
57 \begin{center}
57 \begin{center}
58 \includegraphics[width=0.7\textwidth]{(((output.key_svg)))}
58 \includegraphics[width=0.7\textwidth]{(((output.svg_filename)))}
59 \par
59 \par
60 \end{center}
60 \end{center}
61 ((*- endblock -*))
61 ((*- endblock -*))
62
62
63 ((* block pyout *))
63 ((* block pyout *))
64 ((* block data_priority scoped *))((( super() )))((* endblock *))
64 ((* block data_priority scoped *))((( super() )))((* endblock *))
65 ((* endblock pyout *))
65 ((* endblock pyout *))
66
66
67 ((* block data_text *))
67 ((* block data_text *))
68 \begin{verbatim}
68 \begin{verbatim}
69 ((( output.text )))
69 ((( output.text )))
70 \end{verbatim}
70 \end{verbatim}
71 ((* endblock *))
71 ((* endblock *))
72
72
73 ((* block data_latex -*))
73 ((* block data_latex -*))
74 ((*- if output.latex.startswith('$'): -*)) \begin{equation*}
74 ((*- if output.latex.startswith('$'): -*)) \begin{equation*}
75 ((( output.latex | rm_dollars)))
75 ((( output.latex | rm_dollars)))
76 \end{equation*}
76 \end{equation*}
77 ((*- else -*)) ((( output.latex ))) ((*- endif *))
77 ((*- else -*)) ((( output.latex ))) ((*- endif *))
78 ((* endblock *))
78 ((* endblock *))
79
79
80 ((* block stream *))
80 ((* block stream *))
81 \begin{Verbatim}[commandchars=\\\{\}]
81 \begin{Verbatim}[commandchars=\\\{\}]
82 ((( output.text | ansi2latex)))
82 ((( output.text | ansi2latex)))
83 \end{Verbatim}
83 \end{Verbatim}
84 ((* endblock stream *))
84 ((* endblock stream *))
85
85
86 ((* block markdowncell scoped *))((( cell.source | markdown2latex )))
86 ((* block markdowncell scoped *))((( cell.source | markdown2latex )))
87 ((* endblock markdowncell *))
87 ((* endblock markdowncell *))
88
88
89 ((* block headingcell scoped -*))
89 ((* block headingcell scoped -*))
90 \
90 \
91 ((*- if cell.level == 1 -*))
91 ((*- if cell.level == 1 -*))
92 ((* block h1 -*))section((* endblock h1 -*))
92 ((* block h1 -*))section((* endblock h1 -*))
93 ((*- elif cell.level == 2 -*))
93 ((*- elif cell.level == 2 -*))
94 ((* block h2 -*))subsection((* endblock h2 -*))
94 ((* block h2 -*))subsection((* endblock h2 -*))
95 ((*- elif cell.level == 3 -*))
95 ((*- elif cell.level == 3 -*))
96 ((* block h3 -*))subsubsection((* endblock h3 -*))
96 ((* block h3 -*))subsubsection((* endblock h3 -*))
97 ((*- elif cell.level == 4 -*))
97 ((*- elif cell.level == 4 -*))
98 ((* block h4 -*))paragraph((* endblock h4 -*))
98 ((* block h4 -*))paragraph((* endblock h4 -*))
99 ((*- elif cell.level == 5 -*))
99 ((*- elif cell.level == 5 -*))
100 ((* block h5 -*))subparagraph((* endblock h5 -*))
100 ((* block h5 -*))subparagraph((* endblock h5 -*))
101 ((*- elif cell.level == 6 -*))
101 ((*- elif cell.level == 6 -*))
102 ((* block h6 -*))subparagraph((* endblock h6 -*))
102 ((* block h6 -*))subparagraph((* endblock h6 -*))
103 ((= 6th level not available in standard latex =))
103 ((= 6th level not available in standard latex =))
104
104
105 ((*- endif -*)){((( cell.source | markdown2latex )))}
105 ((*- endif -*)){((( cell.source | markdown2latex )))}
106 ((* endblock headingcell *))
106 ((* endblock headingcell *))
107
107
108 ((* block rawcell scoped *))
108 ((* block rawcell scoped *))
109 ((( cell.source | pycomment )))
109 ((( cell.source | pycomment )))
110 ((* endblock rawcell *))
110 ((* endblock rawcell *))
111
111
112 ((* block unknowncell scoped *))
112 ((* block unknowncell scoped *))
113 unknown type (((cell.type)))
113 unknown type (((cell.type)))
114 ((* endblock unknowncell *))
114 ((* endblock unknowncell *))
115
115
116
116
117
117
118 ((* block body *))
118 ((* block body *))
119
119
120 ((* block bodyBegin *))
120 ((* block bodyBegin *))
121 \begin{document}
121 \begin{document}
122 ((* endblock bodyBegin *))
122 ((* endblock bodyBegin *))
123
123
124 ((( super() )))
124 ((( super() )))
125
125
126 ((* block bodyEnd *))
126 ((* block bodyEnd *))
127 \end{document}
127 \end{document}
128 ((* endblock bodyEnd *))
128 ((* endblock bodyEnd *))
129 ((* endblock body *))
129 ((* endblock body *))
130
130
131 ((* block header *))
131 ((* block header *))
132 %% This file was auto-generated by IPython.
132 %% This file was auto-generated by IPython.
133 %% Conversion from the original notebook file:
133 %% Conversion from the original notebook file:
134 %%
134 %%
135 \documentclass[11pt,english]{article}
135 \documentclass[11pt,english]{article}
136
136
137 %% This is the automatic preamble used by IPython. Note that it does *not*
137 %% This is the automatic preamble used by IPython. Note that it does *not*
138 %% include a documentclass declaration, that is added at runtime to the overall
138 %% include a documentclass declaration, that is added at runtime to the overall
139 %% document.
139 %% document.
140
140
141 \usepackage{amsmath}
141 \usepackage{amsmath}
142 \usepackage{amssymb}
142 \usepackage{amssymb}
143 \usepackage{graphicx}
143 \usepackage{graphicx}
144 \usepackage{ucs}
144 \usepackage{ucs}
145 \usepackage[utf8x]{inputenc}
145 \usepackage[utf8x]{inputenc}
146
146
147 % Scale down larger images
147 % Scale down larger images
148 \usepackage[export]{adjustbox}
148 \usepackage[export]{adjustbox}
149
149
150 %fancy verbatim
150 %fancy verbatim
151 \usepackage{fancyvrb}
151 \usepackage{fancyvrb}
152 % needed for markdown enumerations to work
152 % needed for markdown enumerations to work
153 \usepackage{enumerate}
153 \usepackage{enumerate}
154
154
155 % Slightly bigger margins than the latex defaults
155 % Slightly bigger margins than the latex defaults
156 \usepackage{geometry}
156 \usepackage{geometry}
157 \geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=2.5cm,rmargin=2.5cm}
157 \geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=2.5cm,rmargin=2.5cm}
158
158
159 % Define a few colors for use in code, links and cell shading
159 % Define a few colors for use in code, links and cell shading
160 \usepackage{color}
160 \usepackage{color}
161 \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
161 \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
162 \definecolor{darkorange}{rgb}{.71,0.21,0.01}
162 \definecolor{darkorange}{rgb}{.71,0.21,0.01}
163 \definecolor{darkgreen}{rgb}{.12,.54,.11}
163 \definecolor{darkgreen}{rgb}{.12,.54,.11}
164 \definecolor{myteal}{rgb}{.26, .44, .56}
164 \definecolor{myteal}{rgb}{.26, .44, .56}
165 \definecolor{gray}{gray}{0.45}
165 \definecolor{gray}{gray}{0.45}
166 \definecolor{lightgray}{gray}{.95}
166 \definecolor{lightgray}{gray}{.95}
167 \definecolor{mediumgray}{gray}{.8}
167 \definecolor{mediumgray}{gray}{.8}
168 \definecolor{inputbackground}{rgb}{.95, .95, .85}
168 \definecolor{inputbackground}{rgb}{.95, .95, .85}
169 \definecolor{outputbackground}{rgb}{.95, .95, .95}
169 \definecolor{outputbackground}{rgb}{.95, .95, .95}
170 \definecolor{traceback}{rgb}{1, .95, .95}
170 \definecolor{traceback}{rgb}{1, .95, .95}
171
171
172 % new ansi colors
172 % new ansi colors
173 \definecolor{brown}{rgb}{0.54,0.27,0.07}
173 \definecolor{brown}{rgb}{0.54,0.27,0.07}
174 \definecolor{purple}{rgb}{0.5,0.0,0.5}
174 \definecolor{purple}{rgb}{0.5,0.0,0.5}
175 \definecolor{darkgray}{gray}{0.25}
175 \definecolor{darkgray}{gray}{0.25}
176 \definecolor{lightred}{rgb}{1.0,0.39,0.28}
176 \definecolor{lightred}{rgb}{1.0,0.39,0.28}
177 \definecolor{lightgreen}{rgb}{0.48,0.99,0.0}
177 \definecolor{lightgreen}{rgb}{0.48,0.99,0.0}
178 \definecolor{lightblue}{rgb}{0.53,0.81,0.92}
178 \definecolor{lightblue}{rgb}{0.53,0.81,0.92}
179 \definecolor{lightpurple}{rgb}{0.87,0.63,0.87}
179 \definecolor{lightpurple}{rgb}{0.87,0.63,0.87}
180 \definecolor{lightcyan}{rgb}{0.5,1.0,0.83}
180 \definecolor{lightcyan}{rgb}{0.5,1.0,0.83}
181
181
182 % Framed environments for code cells (inputs, outputs, errors, ...). The
182 % Framed environments for code cells (inputs, outputs, errors, ...). The
183 % various uses of \unskip (or not) at the end were fine-tuned by hand, so don't
183 % various uses of \unskip (or not) at the end were fine-tuned by hand, so don't
184 % randomly change them unless you're sure of the effect it will have.
184 % randomly change them unless you're sure of the effect it will have.
185 \usepackage{framed}
185 \usepackage{framed}
186
186
187 % remove extraneous vertical space in boxes
187 % remove extraneous vertical space in boxes
188 \setlength\fboxsep{0pt}
188 \setlength\fboxsep{0pt}
189
189
190 % codecell is the whole input+output set of blocks that a Code cell can
190 % codecell is the whole input+output set of blocks that a Code cell can
191 % generate.
191 % generate.
192
192
193 % TODO: unfortunately, it seems that using a framed codecell environment breaks
193 % TODO: unfortunately, it seems that using a framed codecell environment breaks
194 % the ability of the frames inside of it to be broken across pages. This
194 % the ability of the frames inside of it to be broken across pages. This
195 % causes at least the problem of having lots of empty space at the bottom of
195 % causes at least the problem of having lots of empty space at the bottom of
196 % pages as new frames are moved to the next page, and if a single frame is too
196 % pages as new frames are moved to the next page, and if a single frame is too
197 % long to fit on a page, will completely stop latex from compiling the
197 % long to fit on a page, will completely stop latex from compiling the
198 % document. So unless we figure out a solution to this, we'll have to instead
198 % document. So unless we figure out a solution to this, we'll have to instead
199 % leave the codecell env. as empty. I'm keeping the original codecell
199 % leave the codecell env. as empty. I'm keeping the original codecell
200 % definition here (a thin vertical bar) for reference, in case we find a
200 % definition here (a thin vertical bar) for reference, in case we find a
201 % solution to the page break issue.
201 % solution to the page break issue.
202
202
203 %% \newenvironment{codecell}{%
203 %% \newenvironment{codecell}{%
204 %% \def\FrameCommand{\color{mediumgray} \vrule width 1pt \hspace{5pt}}%
204 %% \def\FrameCommand{\color{mediumgray} \vrule width 1pt \hspace{5pt}}%
205 %% \MakeFramed{\vspace{-0.5em}}}
205 %% \MakeFramed{\vspace{-0.5em}}}
206 %% {\unskip\endMakeFramed}
206 %% {\unskip\endMakeFramed}
207
207
208 % For now, make this a no-op...
208 % For now, make this a no-op...
209 \newenvironment{codecell}{}
209 \newenvironment{codecell}{}
210
210
211 \newenvironment{codeinput}{%
211 \newenvironment{codeinput}{%
212 \def\FrameCommand{\colorbox{inputbackground}}%
212 \def\FrameCommand{\colorbox{inputbackground}}%
213 \MakeFramed{\advance\hsize-\width \FrameRestore}}
213 \MakeFramed{\advance\hsize-\width \FrameRestore}}
214 {\unskip\endMakeFramed}
214 {\unskip\endMakeFramed}
215
215
216 \newenvironment{codeoutput}{%
216 \newenvironment{codeoutput}{%
217 \def\FrameCommand{\colorbox{outputbackground}}%
217 \def\FrameCommand{\colorbox{outputbackground}}%
218 \vspace{-1.4em}
218 \vspace{-1.4em}
219 \MakeFramed{\advance\hsize-\width \FrameRestore}}
219 \MakeFramed{\advance\hsize-\width \FrameRestore}}
220 {\unskip\medskip\endMakeFramed}
220 {\unskip\medskip\endMakeFramed}
221
221
222 \newenvironment{traceback}{%
222 \newenvironment{traceback}{%
223 \def\FrameCommand{\colorbox{traceback}}%
223 \def\FrameCommand{\colorbox{traceback}}%
224 \MakeFramed{\advance\hsize-\width \FrameRestore}}
224 \MakeFramed{\advance\hsize-\width \FrameRestore}}
225 {\endMakeFramed}
225 {\endMakeFramed}
226
226
227 % Use and configure listings package for nicely formatted code
227 % Use and configure listings package for nicely formatted code
228 \usepackage{listingsutf8}
228 \usepackage{listingsutf8}
229 \lstset{
229 \lstset{
230 language=python,
230 language=python,
231 inputencoding=utf8x,
231 inputencoding=utf8x,
232 extendedchars=\true,
232 extendedchars=\true,
233 aboveskip=\smallskipamount,
233 aboveskip=\smallskipamount,
234 belowskip=\smallskipamount,
234 belowskip=\smallskipamount,
235 xleftmargin=2mm,
235 xleftmargin=2mm,
236 breaklines=true,
236 breaklines=true,
237 basicstyle=\small \ttfamily,
237 basicstyle=\small \ttfamily,
238 showstringspaces=false,
238 showstringspaces=false,
239 keywordstyle=\color{blue}\bfseries,
239 keywordstyle=\color{blue}\bfseries,
240 commentstyle=\color{myteal},
240 commentstyle=\color{myteal},
241 stringstyle=\color{darkgreen},
241 stringstyle=\color{darkgreen},
242 identifierstyle=\color{darkorange},
242 identifierstyle=\color{darkorange},
243 columns=fullflexible, % tighter character kerning, like verb
243 columns=fullflexible, % tighter character kerning, like verb
244 }
244 }
245
245
246 % The hyperref package gives us a pdf with properly built
246 % The hyperref package gives us a pdf with properly built
247 % internal navigation ('pdf bookmarks' for the table of contents,
247 % internal navigation ('pdf bookmarks' for the table of contents,
248 % internal cross-reference links, web links for URLs, etc.)
248 % internal cross-reference links, web links for URLs, etc.)
249 \usepackage{hyperref}
249 \usepackage{hyperref}
250 \hypersetup{
250 \hypersetup{
251 breaklinks=true, % so long urls are correctly broken across lines
251 breaklinks=true, % so long urls are correctly broken across lines
252 colorlinks=true,
252 colorlinks=true,
253 urlcolor=blue,
253 urlcolor=blue,
254 linkcolor=darkorange,
254 linkcolor=darkorange,
255 citecolor=darkgreen,
255 citecolor=darkgreen,
256 }
256 }
257
257
258 % hardcode size of all verbatim environments to be a bit smaller
258 % hardcode size of all verbatim environments to be a bit smaller
259 \makeatletter
259 \makeatletter
260 \g@addto@macro\@verbatim\small\topsep=0.5em\partopsep=0pt
260 \g@addto@macro\@verbatim\small\topsep=0.5em\partopsep=0pt
261 \makeatother
261 \makeatother
262
262
263 % Prevent overflowing lines due to urls and other hard-to-break entities.
263 % Prevent overflowing lines due to urls and other hard-to-break entities.
264 \sloppy
264 \sloppy
265
265
266 ((* endblock *))
266 ((* endblock *))
@@ -1,442 +1,446 b''
1 ((= NBConvert Sphinx-Latex Template
1 ((= NBConvert Sphinx-Latex Template
2
2
3 Purpose: Allow export of PDF friendly Latex inspired by Sphinx. Most of the
3 Purpose: Allow export of PDF friendly Latex inspired by Sphinx. Most of the
4 template is derived directly from Sphinx source.
4 template is derived directly from Sphinx source.
5
5
6 Inheritance: null>display_priority
6 Inheritance: null>display_priority
7
7
8 Note: For best display, use latex syntax highlighting. =))
8 Note: For best display, use latex syntax highlighting. =))
9
9
10 ((*- extends 'display_priority.tplx' -*))
10 ((*- extends 'display_priority.tplx' -*))
11
11
12 %==============================================================================
12 %==============================================================================
13 % Declarations
13 % Declarations
14 %==============================================================================
14 %==============================================================================
15
15
16 % In order to make sure that the input/output header follows the code it
16 % In order to make sure that the input/output header follows the code it
17 % preceeds, the needspace package is used to request that a certain
17 % preceeds, the needspace package is used to request that a certain
18 % amount of lines (specified by this variable) are reserved. If those
18 % amount of lines (specified by this variable) are reserved. If those
19 % lines aren't available on the current page, the documenter will break
19 % lines aren't available on the current page, the documenter will break
20 % to the next page and the header along with accomanying lines will be
20 % to the next page and the header along with accomanying lines will be
21 % rendered together. This value specifies the number of lines that
21 % rendered together. This value specifies the number of lines that
22 % the header will be forced to group with without a page break.
22 % the header will be forced to group with without a page break.
23 ((*- set min_header_lines = 4 -*))
23 ((*- set min_header_lines = 4 -*))
24
24
25 % This is the number of characters that are permitted per line. It's
25 % This is the number of characters that are permitted per line. It's
26 % important that this limit is set so characters do not run off the
26 % important that this limit is set so characters do not run off the
27 % edges of latex pages (since latex does not always seem smart enough
27 % edges of latex pages (since latex does not always seem smart enough
28 % to prevent this in some cases.) This is only applied to textual output
28 % to prevent this in some cases.) This is only applied to textual output
29 ((* if resources.sphinx.outputstyle == 'simple' *))
29 ((* if resources.sphinx.outputstyle == 'simple' *))
30 ((*- set wrap_size = 85 -*))
30 ((*- set wrap_size = 85 -*))
31 ((* elif resources.sphinx.outputstyle == 'notebook' *))
31 ((* elif resources.sphinx.outputstyle == 'notebook' *))
32 ((*- set wrap_size = 70 -*))
32 ((*- set wrap_size = 70 -*))
33 ((* endif *))
33 ((* endif *))
34
34
35 %==============================================================================
35 %==============================================================================
36 % Header
36 % Header
37 %==============================================================================
37 %==============================================================================
38 ((* block header *))
38 ((* block header *))
39
39
40 % Header, overrides base
40 % Header, overrides base
41
41
42 % Make sure that the sphinx doc style knows who it inherits from.
42 % Make sure that the sphinx doc style knows who it inherits from.
43 \def\sphinxdocclass{(((parentdocumentclass)))}
43 \def\sphinxdocclass{(((parentdocumentclass)))}
44
44
45 % Declare the document class
45 % Declare the document class
46 \documentclass[letterpaper,10pt,english]{((( resources.sphinx.texinputs )))/sphinx(((documentclass)))}
46 \documentclass[letterpaper,10pt,english]{((( resources.sphinx.texinputs )))/sphinx(((documentclass)))}
47
47
48 % Imports
48 % Imports
49 \usepackage[utf8]{inputenc}
49 \usepackage[utf8]{inputenc}
50 \DeclareUnicodeCharacter{00A0}{\\nobreakspace}
50 \DeclareUnicodeCharacter{00A0}{\\nobreakspace}
51 \usepackage[T1]{fontenc}
51 \usepackage[T1]{fontenc}
52 \usepackage{babel}
52 \usepackage{babel}
53 \usepackage{times}
53 \usepackage{times}
54 \usepackage{import}
54 \usepackage{import}
55 \usepackage[((( resources.sphinx.chapterstyle )))]{((( resources.sphinx.texinputs )))/fncychap}
55 \usepackage[((( resources.sphinx.chapterstyle )))]{((( resources.sphinx.texinputs )))/fncychap}
56 \usepackage{longtable}
56 \usepackage{longtable}
57 \usepackage{((( resources.sphinx.texinputs )))/sphinx}
57 \usepackage{((( resources.sphinx.texinputs )))/sphinx}
58 \usepackage{multirow}
58 \usepackage{multirow}
59
59
60 \usepackage{amsmath}
60 \usepackage{amsmath}
61 \usepackage{amssymb}
61 \usepackage{amssymb}
62 \usepackage{ucs}
62 \usepackage{ucs}
63 \usepackage{enumerate}
63 \usepackage{enumerate}
64
64
65 % Used to make the Input/Output rules follow around the contents.
65 % Used to make the Input/Output rules follow around the contents.
66 \usepackage{needspace}
66 \usepackage{needspace}
67
67
68 % Pygments requirements
68 % Pygments requirements
69 \usepackage{fancyvrb}
69 \usepackage{fancyvrb}
70 \usepackage{color}
70 \usepackage{color}
71 % ansi colors additions
71 % ansi colors additions
72 \definecolor{darkgreen}{rgb}{.12,.54,.11}
72 \definecolor{darkgreen}{rgb}{.12,.54,.11}
73 \definecolor{lightgray}{gray}{.95}
73 \definecolor{lightgray}{gray}{.95}
74 \definecolor{brown}{rgb}{0.54,0.27,0.07}
74 \definecolor{brown}{rgb}{0.54,0.27,0.07}
75 \definecolor{purple}{rgb}{0.5,0.0,0.5}
75 \definecolor{purple}{rgb}{0.5,0.0,0.5}
76 \definecolor{darkgray}{gray}{0.25}
76 \definecolor{darkgray}{gray}{0.25}
77 \definecolor{lightred}{rgb}{1.0,0.39,0.28}
77 \definecolor{lightred}{rgb}{1.0,0.39,0.28}
78 \definecolor{lightgreen}{rgb}{0.48,0.99,0.0}
78 \definecolor{lightgreen}{rgb}{0.48,0.99,0.0}
79 \definecolor{lightblue}{rgb}{0.53,0.81,0.92}
79 \definecolor{lightblue}{rgb}{0.53,0.81,0.92}
80 \definecolor{lightpurple}{rgb}{0.87,0.63,0.87}
80 \definecolor{lightpurple}{rgb}{0.87,0.63,0.87}
81 \definecolor{lightcyan}{rgb}{0.5,1.0,0.83}
81 \definecolor{lightcyan}{rgb}{0.5,1.0,0.83}
82
82
83 % Needed to box output/input
83 % Needed to box output/input
84 \usepackage{tikz}
84 \usepackage{tikz}
85 \usetikzlibrary{calc,arrows,shadows}
85 \usetikzlibrary{calc,arrows,shadows}
86 \usepackage[framemethod=tikz]{mdframed}
86 \usepackage[framemethod=tikz]{mdframed}
87
87
88 \usepackage{alltt}
88 \usepackage{alltt}
89
89
90 % Used to load and display graphics
90 % Used to load and display graphics
91 \usepackage{graphicx}
91 \usepackage{graphicx}
92 \graphicspath{ {figs/} }
92 \graphicspath{ {figs/} }
93 \usepackage[Export]{adjustbox} % To resize
93 \usepackage[Export]{adjustbox} % To resize
94
94
95
95
96 % For formatting output while also word wrapping.
96 % For formatting output while also word wrapping.
97 \usepackage{listings}
97 \usepackage{listings}
98 \lstset{breaklines=true}
98 \lstset{breaklines=true}
99 \lstset{basicstyle=\small\ttfamily}
99 \lstset{basicstyle=\small\ttfamily}
100 \def\smaller{\fontsize{9.5pt}{9.5pt}\selectfont}
100 \def\smaller{\fontsize{9.5pt}{9.5pt}\selectfont}
101
101
102 %Pygments definitions
102 %Pygments definitions
103 ((( resources.sphinx.pygment_definitions )))
103 ((( resources.sphinx.pygment_definitions )))
104
104
105 %Set pygments styles if needed...
105 %Set pygments styles if needed...
106 ((* if resources.sphinx.outputstyle == 'notebook' *))
106 ((* if resources.sphinx.outputstyle == 'notebook' *))
107 \definecolor{nbframe-border}{rgb}{0.867,0.867,0.867}
107 \definecolor{nbframe-border}{rgb}{0.867,0.867,0.867}
108 \definecolor{nbframe-bg}{rgb}{0.969,0.969,0.969}
108 \definecolor{nbframe-bg}{rgb}{0.969,0.969,0.969}
109 \definecolor{nbframe-in-prompt}{rgb}{0.0,0.0,0.502}
109 \definecolor{nbframe-in-prompt}{rgb}{0.0,0.0,0.502}
110 \definecolor{nbframe-out-prompt}{rgb}{0.545,0.0,0.0}
110 \definecolor{nbframe-out-prompt}{rgb}{0.545,0.0,0.0}
111
111
112 \newenvironment{ColorVerbatim}
112 \newenvironment{ColorVerbatim}
113 {\begin{mdframed}[%
113 {\begin{mdframed}[%
114 roundcorner=1.0pt, %
114 roundcorner=1.0pt, %
115 backgroundcolor=nbframe-bg, %
115 backgroundcolor=nbframe-bg, %
116 userdefinedwidth=1\linewidth, %
116 userdefinedwidth=1\linewidth, %
117 leftmargin=0.1\linewidth, %
117 leftmargin=0.1\linewidth, %
118 innerleftmargin=0pt, %
118 innerleftmargin=0pt, %
119 innerrightmargin=0pt, %
119 innerrightmargin=0pt, %
120 linecolor=nbframe-border, %
120 linecolor=nbframe-border, %
121 linewidth=1pt, %
121 linewidth=1pt, %
122 usetwoside=false, %
122 usetwoside=false, %
123 everyline=true, %
123 everyline=true, %
124 innerlinewidth=3pt, %
124 innerlinewidth=3pt, %
125 innerlinecolor=nbframe-bg, %
125 innerlinecolor=nbframe-bg, %
126 middlelinewidth=1pt, %
126 middlelinewidth=1pt, %
127 middlelinecolor=nbframe-bg, %
127 middlelinecolor=nbframe-bg, %
128 outerlinewidth=0.5pt, %
128 outerlinewidth=0.5pt, %
129 outerlinecolor=nbframe-border, %
129 outerlinecolor=nbframe-border, %
130 needspace=0pt
130 needspace=0pt
131 ]}
131 ]}
132 {\end{mdframed}}
132 {\end{mdframed}}
133
133
134 \newenvironment{InvisibleVerbatim}
134 \newenvironment{InvisibleVerbatim}
135 {\begin{mdframed}[leftmargin=0.1\linewidth,innerleftmargin=3pt,innerrightmargin=3pt, userdefinedwidth=1\linewidth, linewidth=0pt, linecolor=white, usetwoside=false]}
135 {\begin{mdframed}[leftmargin=0.1\linewidth,innerleftmargin=3pt,innerrightmargin=3pt, userdefinedwidth=1\linewidth, linewidth=0pt, linecolor=white, usetwoside=false]}
136 {\end{mdframed}}
136 {\end{mdframed}}
137
137
138 \renewenvironment{Verbatim}[1][\unskip]
138 \renewenvironment{Verbatim}[1][\unskip]
139 {\begin{alltt}\smaller}
139 {\begin{alltt}\smaller}
140 {\end{alltt}}
140 {\end{alltt}}
141 ((* endif *))
141 ((* endif *))
142
142
143 % Help prevent overflowing lines due to urls and other hard-to-break
143 % Help prevent overflowing lines due to urls and other hard-to-break
144 % entities. This doesn't catch everything...
144 % entities. This doesn't catch everything...
145 \sloppy
145 \sloppy
146
146
147 % Document level variables
147 % Document level variables
148 \title{((( resources.metadata.name | escape_tex )))}
148 \title{((( resources.metadata.name | escape_tex )))}
149 \date{((( resources.sphinx.date | escape_tex )))}
149 \date{((( resources.sphinx.date | escape_tex )))}
150 \release{((( resources.sphinx.version | escape_tex )))}
150 \release{((( resources.sphinx.version | escape_tex )))}
151 \author{((( resources.sphinx.author | escape_tex )))}
151 \author{((( resources.sphinx.author | escape_tex )))}
152 \renewcommand{\releasename}{((( resources.sphinx.release | escape_tex )))}
152 \renewcommand{\releasename}{((( resources.sphinx.release | escape_tex )))}
153
153
154 % TODO: Add option for the user to specify a logo for his/her export.
154 % TODO: Add option for the user to specify a logo for his/her export.
155 \newcommand{\sphinxlogo}{}
155 \newcommand{\sphinxlogo}{}
156
156
157 % Make the index page of the document.
157 % Make the index page of the document.
158 \makeindex
158 \makeindex
159
159
160 % Import sphinx document type specifics.
160 % Import sphinx document type specifics.
161 ((* block sphinxheader *))((* endblock sphinxheader *))
161 ((* block sphinxheader *))((* endblock sphinxheader *))
162 ((* endblock header *))
162 ((* endblock header *))
163
163
164 %==============================================================================
164 %==============================================================================
165 % Body
165 % Body
166 %==============================================================================
166 %==============================================================================
167 ((* block body *))
167 ((* block body *))
168 ((* block bodyBegin *))
168 ((* block bodyBegin *))
169 % Body
169 % Body
170
170
171 % Start of the document
171 % Start of the document
172 \begin{document}
172 \begin{document}
173
173
174 ((* if resources.sphinx.header *))
174 ((* if resources.sphinx.header *))
175 \maketitle
175 \maketitle
176 ((* endif *))
176 ((* endif *))
177
177
178 ((* block toc *))
178 ((* block toc *))
179 \tableofcontents
179 \tableofcontents
180 ((* endblock toc *))
180 ((* endblock toc *))
181
181
182 ((* endblock bodyBegin *))((( super() )))((* block bodyEnd *))
182 ((* endblock bodyBegin *))((( super() )))((* block bodyEnd *))
183
183
184 \renewcommand{\indexname}{Index}
184 \renewcommand{\indexname}{Index}
185 \printindex
185 \printindex
186
186
187 % End of document
187 % End of document
188 \end{document}
188 \end{document}
189 ((* endblock bodyEnd *))
189 ((* endblock bodyEnd *))
190 ((* endblock body *))
190 ((* endblock body *))
191
191
192 %==============================================================================
192 %==============================================================================
193 % Footer
193 % Footer
194 %==============================================================================
194 %==============================================================================
195 ((* block footer *))
195 ((* block footer *))
196 ((* endblock footer *))
196 ((* endblock footer *))
197
197
198 %==============================================================================
198 %==============================================================================
199 % Headings
199 % Headings
200 %
200 %
201 % Purpose: Format pynb headers as sphinx headers. Depending on the Sphinx
201 % Purpose: Format pynb headers as sphinx headers. Depending on the Sphinx
202 % style that is active, this will change. Thus sphinx styles will
202 % style that is active, this will change. Thus sphinx styles will
203 % override the values here.
203 % override the values here.
204 %==============================================================================
204 %==============================================================================
205 ((* block headingcell -*))
205 ((* block headingcell -*))
206 \
206 \
207 ((*- if cell.level == 1 -*))
207 ((*- if cell.level == 1 -*))
208 ((* block h1 -*))part((* endblock h1 -*))
208 ((* block h1 -*))part((* endblock h1 -*))
209 ((*- elif cell.level == 2 -*))
209 ((*- elif cell.level == 2 -*))
210 ((* block h2 -*))chapter((* endblock h2 -*))
210 ((* block h2 -*))chapter((* endblock h2 -*))
211 ((*- elif cell.level == 3 -*))
211 ((*- elif cell.level == 3 -*))
212 ((* block h3 -*))section((* endblock h3 -*))
212 ((* block h3 -*))section((* endblock h3 -*))
213 ((*- elif cell.level == 4 -*))
213 ((*- elif cell.level == 4 -*))
214 ((* block h4 -*))subsection((* endblock h4 -*))
214 ((* block h4 -*))subsection((* endblock h4 -*))
215 ((*- elif cell.level == 5 -*))
215 ((*- elif cell.level == 5 -*))
216 ((* block h5 -*))subsubsection((* endblock h5 -*))
216 ((* block h5 -*))subsubsection((* endblock h5 -*))
217 ((*- elif cell.level == 6 -*))
217 ((*- elif cell.level == 6 -*))
218 ((* block h6 -*))paragraph((* endblock h6 -*))
218 ((* block h6 -*))paragraph((* endblock h6 -*))
219
219
220 ((= It's important to make sure that underscores (which tend to be common
220 ((= It's important to make sure that underscores (which tend to be common
221 in IPYNB file titles) do not make their way into latex. Sometimes this
221 in IPYNB file titles) do not make their way into latex. Sometimes this
222 causes latex to barf. =))
222 causes latex to barf. =))
223 ((*- endif -*)){((( cell.source | markdown2latex )))}
223 ((*- endif -*)){((( cell.source | markdown2latex )))}
224 ((*- endblock headingcell *))
224 ((*- endblock headingcell *))
225
225
226 %==============================================================================
226 %==============================================================================
227 % Markdown
227 % Markdown
228 %
228 %
229 % Purpose: Convert markdown to latex. Here markdown2latex is explicitly
229 % Purpose: Convert markdown to latex. Here markdown2latex is explicitly
230 % called since we know we want latex output.
230 % called since we know we want latex output.
231 %==============================================================================
231 %==============================================================================
232 ((*- block markdowncell scoped-*))
232 ((*- block markdowncell scoped-*))
233 ((( cell.source | markdown2latex )))
233 ((( cell.source | markdown2latex )))
234 ((*- endblock markdowncell -*))
234 ((*- endblock markdowncell -*))
235
235
236 %==============================================================================
236 %==============================================================================
237 % Rawcell
237 % Rawcell
238 %
238 %
239 % Purpose: Raw text cells allow the user to manually inject document code that
239 % Purpose: Raw text cells allow the user to manually inject document code that
240 % will not get touched by the templating system.
240 % will not get touched by the templating system.
241 %==============================================================================
241 %==============================================================================
242 ((*- block rawcell *))
242 ((*- block rawcell *))
243 ((( cell.source | wrap(wrap_size) )))
243 ((( cell.source | wrap(wrap_size) )))
244 ((* endblock rawcell -*))
244 ((* endblock rawcell -*))
245
245
246 %==============================================================================
246 %==============================================================================
247 % Unknowncell
247 % Unknowncell
248 %
248 %
249 % Purpose: This is the catch anything unhandled. To display this data, we
249 % Purpose: This is the catch anything unhandled. To display this data, we
250 % remove all possible latex conflicts and wrap the characters so they
250 % remove all possible latex conflicts and wrap the characters so they
251 % can't flow off of the page.
251 % can't flow off of the page.
252 %==============================================================================
252 %==============================================================================
253 ((* block unknowncell scoped*))
253 ((* block unknowncell scoped*))
254
254
255 % Unsupported cell type, no formatting
255 % Unsupported cell type, no formatting
256 ((( cell.source | wrap | escape_tex )))
256 ((( cell.source | wrap | escape_tex )))
257 ((* endblock unknowncell *))
257 ((* endblock unknowncell *))
258
258
259 %==============================================================================
259 %==============================================================================
260 % Input
260 % Input
261 %==============================================================================
261 %==============================================================================
262 ((* block input *))
262 ((* block input *))
263
263
264 % Make sure that atleast 4 lines are below the HR
264 % Make sure that atleast 4 lines are below the HR
265 \needspace{((( min_header_lines )))\baselineskip}
265 \needspace{((( min_header_lines )))\baselineskip}
266
266
267 ((* if resources.sphinx.outputstyle == 'simple' *))
267 ((* if resources.sphinx.outputstyle == 'simple' *))
268
268
269 % Add a horizantal break, along with break title.
269 % Add a horizantal break, along with break title.
270 \vspace{10pt}
270 \vspace{10pt}
271 {\scriptsize Input}\\*
271 {\scriptsize Input}\\*
272 \rule[10pt]{\linewidth}{0.5pt}
272 \rule[10pt]{\linewidth}{0.5pt}
273 \vspace{-25pt}
273 \vspace{-25pt}
274
274
275 % Add contents below.
275 % Add contents below.
276 ((( cell.input | highlight )))
276 ((( cell.input | highlight )))
277
277
278 ((* elif resources.sphinx.outputstyle == 'notebook' *))
278 ((* elif resources.sphinx.outputstyle == 'notebook' *))
279 \vspace{6pt}
279 \vspace{6pt}
280 ((( write_prompt("In", cell.prompt_number, "nbframe-in-prompt") )))
280 ((( write_prompt("In", cell.prompt_number, "nbframe-in-prompt") )))
281 \vspace{-2.65\baselineskip}
281 \vspace{-2.65\baselineskip}
282 \begin{ColorVerbatim}
282 \begin{ColorVerbatim}
283 \vspace{-0.7\baselineskip}
283 \vspace{-0.7\baselineskip}
284 ((( cell.input | highlight )))
284 ((( cell.input | highlight )))
285 ((* if cell.input == None or cell.input == '' *))
285 ((* if cell.input == None or cell.input == '' *))
286 \vspace{0.3\baselineskip}
286 \vspace{0.3\baselineskip}
287 ((* else *))
287 ((* else *))
288 \vspace{-0.2\baselineskip}
288 \vspace{-0.2\baselineskip}
289 ((* endif *))
289 ((* endif *))
290 \end{ColorVerbatim}
290 \end{ColorVerbatim}
291 ((* endif *))
291 ((* endif *))
292 ((* endblock input *))
292 ((* endblock input *))
293
293
294 %==============================================================================
294 %==============================================================================
295 % Output_Group
295 % Output_Group
296 %
296 %
297 % Purpose: Make sure that only one header bar only attaches to the output
297 % Purpose: Make sure that only one header bar only attaches to the output
298 % once. By keeping track of when an input group is started
298 % once. By keeping track of when an input group is started
299 %==============================================================================
299 %==============================================================================
300 ((* block output_group *))
300 ((* block output_group *))
301 ((* if cell.outputs.__len__() > 0 *))
301 ((* if cell.outputs.__len__() > 0 *))
302
302
303 % If the first block is an image, minipage the image. Else
303 % If the first block is an image, minipage the image. Else
304 % request a certain amount of space for the input text.
304 % request a certain amount of space for the input text.
305 ((( iff_figure(cell.outputs[0], "\\begin{minipage}{1.0\\textwidth}", "\\needspace{" ~ min_header_lines ~ "\\baselineskip}") )))
305 ((( iff_figure(cell.outputs[0], "\\begin{minipage}{1.0\\textwidth}", "\\needspace{" ~ min_header_lines ~ "\\baselineskip}") )))
306
306
307 ((* if resources.sphinx.outputstyle == 'simple' *))
307 ((* if resources.sphinx.outputstyle == 'simple' *))
308
308
309 % Add a horizantal break, along with break title.
309 % Add a horizantal break, along with break title.
310 \vspace{10pt}
310 \vspace{10pt}
311 {\scriptsize Output}\\*
311 {\scriptsize Output}\\*
312 \rule[10pt]{\linewidth}{0.5pt}
312 \rule[10pt]{\linewidth}{0.5pt}
313 \vspace{-20pt}
313 \vspace{-20pt}
314
314
315 % Add the contents of the first block.
315 % Add the contents of the first block.
316 ((( render_output(cell.outputs[0]) )))
316 ((( render_output(cell.outputs[0]) )))
317
317
318 % Close the minipage.
318 % Close the minipage.
319 ((( iff_figure(cell.outputs[0], "\\end{minipage}", "") )))
319 ((( iff_figure(cell.outputs[0], "\\end{minipage}", "") )))
320
320
321 % Add remainer of the document contents below.
321 % Add remainer of the document contents below.
322 ((* for output in cell.outputs[1:] *))
322 ((* for output in cell.outputs[1:] *))
323 ((( render_output(output, cell.prompt_number) )))
323 ((( render_output(output, cell.prompt_number) )))
324 ((* endfor *))
324 ((* endfor *))
325 ((* elif resources.sphinx.outputstyle == 'notebook' *))
325 ((* elif resources.sphinx.outputstyle == 'notebook' *))
326
326
327 % Add document contents.
327 % Add document contents.
328 ((* for output in cell.outputs *))
328 ((* for output in cell.outputs *))
329 ((( render_output(output, cell.prompt_number) )))
329 ((( render_output(output, cell.prompt_number) )))
330 ((* endfor *))
330 ((* endfor *))
331 ((* endif *))
331 ((* endif *))
332 ((* endif *))
332 ((* endif *))
333 ((* endblock *))
333 ((* endblock *))
334
334
335 %==============================================================================
335 %==============================================================================
336 % Additional formating
336 % Additional formating
337 %==============================================================================
337 %==============================================================================
338 ((* block data_text *))
338 ((* block data_text *))
339 ((( custom_verbatim(output.text) | ansi2latex)))
339 ((( custom_verbatim(output.text) | ansi2latex)))
340 ((* endblock *))
340 ((* endblock *))
341
341
342 ((* block traceback_line *))
342 ((* block traceback_line *))
343 ((( conditionally_center_output(line | indent| rm_ansi) )))
343 ((( conditionally_center_output(line | indent| rm_ansi) )))
344 ((* endblock traceback_line *))
344 ((* endblock traceback_line *))
345
345
346 %==============================================================================
346 %==============================================================================
347 % Supported image formats
347 % Supported image formats
348 %==============================================================================
348 %==============================================================================
349 ((*- block data_png -*))
349 ((*- block data_png -*))
350 ((( conditionally_center_output(insert_graphics(output.key_png)) )))
350 ((( conditionally_center_output(insert_graphics(output.png_filename)) )))
351 ((*- endblock -*))
352
353 ((*- block data_jpg -*))
354 ((( conditionally_center_output(insert_graphics(output.jpg_filename)) )))
351 ((*- endblock -*))
355 ((*- endblock -*))
352
356
353 ((*- block data_svg -*))
357 ((*- block data_svg -*))
354 ((( conditionally_center_output(insert_graphics(output.key_svg)) )))
358 ((( conditionally_center_output(insert_graphics(output.svg_filename)) )))
355 ((*- endblock -*))
359 ((*- endblock -*))
356
360
357 ((*- block data_latex *))
361 ((*- block data_latex *))
358 ((* if resources.sphinx.centeroutput *))\begin{center}((* endif -*))((( output.latex | rm_math_space )))((*- if resources.sphinx.centeroutput *))\end{center} ((* endif -*))
362 ((* if resources.sphinx.centeroutput *))\begin{center}((* endif -*))((( output.latex | rm_math_space )))((*- if resources.sphinx.centeroutput *))\end{center} ((* endif -*))
359 ((*- endblock -*))
363 ((*- endblock -*))
360
364
361 %==============================================================================
365 %==============================================================================
362 % Support Macros
366 % Support Macros
363 %==============================================================================
367 %==============================================================================
364
368
365 % Name: write_prompt
369 % Name: write_prompt
366 % Purpose: Renders an output/input prompt for notebook style pdfs
370 % Purpose: Renders an output/input prompt for notebook style pdfs
367 ((* macro write_prompt(prompt, number, color) -*))
371 ((* macro write_prompt(prompt, number, color) -*))
368 \makebox[0.1\linewidth]{\smaller\hfill\tt\color{((( color )))}((( prompt )))\hspace{4pt}{[}((( number ))){]}:\hspace{4pt}}\\*
372 \makebox[0.1\linewidth]{\smaller\hfill\tt\color{((( color )))}((( prompt )))\hspace{4pt}{[}((( number ))){]}:\hspace{4pt}}\\*
369 ((*- endmacro *))
373 ((*- endmacro *))
370
374
371 % Name: render_output
375 % Name: render_output
372 % Purpose: Renders an output block appropriately.
376 % Purpose: Renders an output block appropriately.
373 ((* macro render_output(output, prompt_number) -*))
377 ((* macro render_output(output, prompt_number) -*))
374 ((*- if output.output_type == 'pyerr' -*))
378 ((*- if output.output_type == 'pyerr' -*))
375 ((*- block pyerr scoped *))
379 ((*- block pyerr scoped *))
376 ((( custom_verbatim(super()) )))
380 ((( custom_verbatim(super()) )))
377 ((* endblock pyerr -*))
381 ((* endblock pyerr -*))
378 ((*- else -*))
382 ((*- else -*))
379
383
380 ((* if resources.sphinx.outputstyle == 'notebook' *))
384 ((* if resources.sphinx.outputstyle == 'notebook' *))
381 ((*- if output.output_type == 'pyout' -*))
385 ((*- if output.output_type == 'pyout' -*))
382 ((( write_prompt("Out", prompt_number, "nbframe-out-prompt") )))
386 ((( write_prompt("Out", prompt_number, "nbframe-out-prompt") )))
383 \vspace{-2.55\baselineskip}
387 \vspace{-2.55\baselineskip}
384 ((*- endif -*))
388 ((*- endif -*))
385
389
386 \begin{InvisibleVerbatim}
390 \begin{InvisibleVerbatim}
387 \vspace{-0.5\baselineskip}
391 \vspace{-0.5\baselineskip}
388 ((*- endif -*))
392 ((*- endif -*))
389
393
390 ((*- block display_data scoped -*))
394 ((*- block display_data scoped -*))
391 ((( super() )))
395 ((( super() )))
392 ((*- endblock display_data -*))
396 ((*- endblock display_data -*))
393
397
394 ((* if resources.sphinx.outputstyle == 'notebook' *))
398 ((* if resources.sphinx.outputstyle == 'notebook' *))
395 \end{InvisibleVerbatim}
399 \end{InvisibleVerbatim}
396 ((*- endif -*))
400 ((*- endif -*))
397 ((*- endif -*))
401 ((*- endif -*))
398 ((*- endmacro *))
402 ((*- endmacro *))
399
403
400 % Name: iff_figure
404 % Name: iff_figure
401 % Purpose: If the output block provided is a figure type, the 'true_content'
405 % Purpose: If the output block provided is a figure type, the 'true_content'
402 % parameter will be returned. Else, the 'false_content'.
406 % parameter will be returned. Else, the 'false_content'.
403 ((* macro iff_figure(output, true_content, false_content) -*))
407 ((* macro iff_figure(output, true_content, false_content) -*))
404 ((*- set is_figure = false -*))
408 ((*- set is_figure = false -*))
405 ((*- for type in output | filter_data_type -*))
409 ((*- for type in output | filter_data_type -*))
406 ((*- if type in ['pdf', 'svg', 'png', 'jpeg','html']*))
410 ((*- if type in ['pdf', 'svg', 'png', 'jpeg','html']*))
407 ((*- set is_figure = true -*))
411 ((*- set is_figure = true -*))
408 ((*- endif -*))
412 ((*- endif -*))
409 ((*- endfor -*))
413 ((*- endfor -*))
410
414
411 ((* if is_figure -*))
415 ((* if is_figure -*))
412 ((( true_content )))
416 ((( true_content )))
413 ((*- else -*))
417 ((*- else -*))
414 ((( false_content )))
418 ((( false_content )))
415 ((*- endif *))
419 ((*- endif *))
416 ((*- endmacro *))
420 ((*- endmacro *))
417
421
418 % Name: custom_verbatim
422 % Name: custom_verbatim
419 % Purpose: This macro creates a verbatim style block that fits the existing
423 % Purpose: This macro creates a verbatim style block that fits the existing
420 % sphinx style more readily than standard verbatim blocks.
424 % sphinx style more readily than standard verbatim blocks.
421 ((* macro custom_verbatim(text) -*))
425 ((* macro custom_verbatim(text) -*))
422 \begin{alltt}
426 \begin{alltt}
423 ((*- if resources.sphinx.centeroutput *))\begin{center} ((* endif -*))
427 ((*- if resources.sphinx.centeroutput *))\begin{center} ((* endif -*))
424 ((( text | wrap(wrap_size) )))
428 ((( text | wrap(wrap_size) )))
425 ((*- if resources.sphinx.centeroutput *))\end{center}((* endif -*))
429 ((*- if resources.sphinx.centeroutput *))\end{center}((* endif -*))
426 \end{alltt}
430 \end{alltt}
427 ((*- endmacro *))
431 ((*- endmacro *))
428
432
429 % Name: conditionally_center_output
433 % Name: conditionally_center_output
430 % Purpose: This macro centers the output if the output centering is enabled.
434 % Purpose: This macro centers the output if the output centering is enabled.
431 ((* macro conditionally_center_output(text) -*))
435 ((* macro conditionally_center_output(text) -*))
432 ((* if resources.sphinx.centeroutput *)){\centering ((* endif *))((( text )))((* if resources.sphinx.centeroutput *))}((* endif *))
436 ((* if resources.sphinx.centeroutput *)){\centering ((* endif *))((( text )))((* if resources.sphinx.centeroutput *))}((* endif *))
433 ((*- endmacro *))
437 ((*- endmacro *))
434
438
435 % Name: insert_graphics
439 % Name: insert_graphics
436 % Purpose: This macro will insert an image in the latex document given a path.
440 % Purpose: This macro will insert an image in the latex document given a path.
437 ((* macro insert_graphics(path) -*))
441 ((* macro insert_graphics(path) -*))
438 \begin{center}
442 \begin{center}
439 \includegraphics[max size={\textwidth}{\textheight}]{(((path)))}
443 \includegraphics[max size={\textwidth}{\textheight}]{(((path)))}
440 \par
444 \par
441 \end{center}
445 \end{center}
442 ((*- endmacro *))
446 ((*- endmacro *))
@@ -1,73 +1,73 b''
1 {% extends 'display_priority.tpl' %}
1 {% extends 'display_priority.tpl' %}
2 {% block in_prompt %}
2 {% block in_prompt %}
3 In[{{cell.prompt_number if cell.prompt_number else ' '}}]:{% endblock in_prompt %}
3 In[{{cell.prompt_number if cell.prompt_number else ' '}}]:{% endblock in_prompt %}
4
4
5 {% block output_prompt %}{% if cell.haspyout %}Out[{{cell.prompt_number}}]:
5 {% block output_prompt %}{% if cell.haspyout %}Out[{{cell.prompt_number}}]:
6 {%- endif %}{%- endblock output_prompt %}
6 {%- endif %}{%- endblock output_prompt %}
7
7
8 {% block input %}
8 {% block input %}
9 ```
9 ```
10 {{ cell.input}}
10 {{ cell.input}}
11 ```
11 ```
12 {% endblock input %}
12 {% endblock input %}
13
13
14 {% block pyerr %}
14 {% block pyerr %}
15 {{ super() }}
15 {{ super() }}
16 {% endblock pyerr %}
16 {% endblock pyerr %}
17
17
18 {% block traceback_line %}
18 {% block traceback_line %}
19 {{ line |indent| rm_ansi }}{% endblock traceback_line %}
19 {{ line |indent| rm_ansi }}{% endblock traceback_line %}
20
20
21 {% block pyout %}
21 {% block pyout %}
22 {% block data_priority scoped %}{{ super()}}{% endblock %}
22 {% block data_priority scoped %}{{ super()}}{% endblock %}
23 {% endblock pyout %}
23 {% endblock pyout %}
24
24
25 {% block stream %}
25 {% block stream %}
26 {{ output.text| indent }}
26 {{ output.text| indent }}
27 {% endblock stream %}
27 {% endblock stream %}
28
28
29
29
30
30
31
31
32 {% block data_svg %}
32 {% block data_svg %}
33 [!image]({{output.key_svg}})
33 [!image]({{output.svg_filename}})
34 {% endblock data_svg %}
34 {% endblock data_svg %}
35
35
36 {% block data_png %}
36 {% block data_png %}
37 [!image]({{output.key_png}})
37 [!image]({{output.png_filename}})
38 {% endblock data_png %}
38 {% endblock data_png %}
39
39
40 {% block data_jpg %}
40 {% block data_jpg %}
41 [!image]({{output.key_jpg}})
41 [!image]({{output.jpg_filename}})
42 {% endblock data_jpg %}
42 {% endblock data_jpg %}
43
43
44
44
45
45
46 {% block data_latex %}
46 {% block data_latex %}
47 $$
47 $$
48 {{output.latex}}
48 {{output.latex}}
49 $$
49 $$
50 {% endblock data_latex %}
50 {% endblock data_latex %}
51
51
52 {% block data_text scoped %}
52 {% block data_text scoped %}
53
53
54 {{output.text | indent}}
54 {{output.text | indent}}
55
55
56 {% endblock data_text %}
56 {% endblock data_text %}
57
57
58 {% block markdowncell scoped %}
58 {% block markdowncell scoped %}
59 {{ cell.source | wrap(80)}}
59 {{ cell.source | wrap(80)}}
60 {% endblock markdowncell %}
60 {% endblock markdowncell %}
61
61
62 {% block headingcell scoped %}
62 {% block headingcell scoped %}
63
63
64 {{ '#' * cell.level }} {{ cell.source }}
64 {{ '#' * cell.level }} {{ cell.source }}
65
65
66 {% endblock headingcell %}
66 {% endblock headingcell %}
67
67
68 {% block rawcell scoped %}{{ cell.source }}
68 {% block rawcell scoped %}{{ cell.source }}
69 {% endblock rawcell %}
69 {% endblock rawcell %}
70
70
71 {% block unknowncell scoped %}
71 {% block unknowncell scoped %}
72 unknown type {{cell.type}}
72 unknown type {{cell.type}}
73 {% endblock unknowncell %}
73 {% endblock unknowncell %}
@@ -1,89 +1,89 b''
1 {%- extends 'display_priority.tpl' -%}
1 {%- extends 'display_priority.tpl' -%}
2 {% block in_prompt -%}
2 {% block in_prompt -%}
3 In[{{cell.prompt_number if cell.prompt_number else ' '}}]:
3 In[{{cell.prompt_number if cell.prompt_number else ' '}}]:
4
4
5 .. code:: python
5 .. code:: python
6
6
7 {% endblock in_prompt %}
7 {% endblock in_prompt %}
8
8
9 {% block output_prompt %}{% if cell.haspyout -%}
9 {% block output_prompt %}{% if cell.haspyout -%}
10 Out[{{cell.prompt_number}}]:{% endif %}{% endblock output_prompt %}
10 Out[{{cell.prompt_number}}]:{% endif %}{% endblock output_prompt %}
11
11
12 {% block input %}{{ cell.input | indent}}
12 {% block input %}{{ cell.input | indent}}
13
13
14 {% endblock input %}
14 {% endblock input %}
15
15
16 {% block pyerr %}::
16 {% block pyerr %}::
17 {{ super() }}
17 {{ super() }}
18 {% endblock pyerr %}
18 {% endblock pyerr %}
19
19
20 {% block traceback_line %}
20 {% block traceback_line %}
21 {{ line |indent| rm_ansi }}{% endblock traceback_line %}
21 {{ line |indent| rm_ansi }}{% endblock traceback_line %}
22
22
23 {% block pyout %}
23 {% block pyout %}
24 {% block data_priority scoped %}{{ super()}}{% endblock %}
24 {% block data_priority scoped %}{{ super()}}{% endblock %}
25 {% endblock pyout %}
25 {% endblock pyout %}
26
26
27 {% block stream %}
27 {% block stream %}
28 .. parsed-literal::
28 .. parsed-literal::
29
29
30 {{ output.text| indent }}
30 {{ output.text| indent }}
31 {% endblock stream %}
31 {% endblock stream %}
32
32
33
33
34
34
35
35
36 {% block data_svg %}.. image:: {{output.key_svg}}
36 {% block data_svg %}.. image:: {{output.svg_filename}}
37
37
38 {% endblock data_svg %}
38 {% endblock data_svg %}
39
39
40 {% block data_png %}.. image:: {{output.key_png}}
40 {% block data_png %}.. image:: {{output.png_filename}}
41
41
42 {% endblock data_png %}
42 {% endblock data_png %}
43
43
44 {% block data_jpg %}..jpg image:: {{output.key_jpg}}
44 {% block data_jpg %}..jpg image:: {{output.jpg_filename}}
45
45
46 {% endblock data_jpg %}
46 {% endblock data_jpg %}
47
47
48
48
49
49
50 {% block data_latex %}.. math::
50 {% block data_latex %}.. math::
51
51
52 {{output.latex| indent}}
52 {{output.latex| indent}}
53
53
54 {% endblock data_latex %}
54 {% endblock data_latex %}
55
55
56 {% block data_text scoped %}.. parsed-literal::
56 {% block data_text scoped %}.. parsed-literal::
57
57
58 {{output.text | indent}}
58 {{output.text | indent}}
59
59
60 {% endblock data_text %}
60 {% endblock data_text %}
61
61
62 {% block markdowncell scoped %}{{ cell.source | markdown2rst }}
62 {% block markdowncell scoped %}{{ cell.source | markdown2rst }}
63 {% endblock markdowncell %}
63 {% endblock markdowncell %}
64
64
65 {% block headingcell scoped %}
65 {% block headingcell scoped %}
66 {%- set len = cell.source|length -%}
66 {%- set len = cell.source|length -%}
67 {{ cell.source | markdown2rst }}
67 {{ cell.source | markdown2rst }}
68 {% if cell.level == 1 %}
68 {% if cell.level == 1 %}
69 {{- '=' * len }}
69 {{- '=' * len }}
70 {%- elif cell.level == 2 %}
70 {%- elif cell.level == 2 %}
71 {{- '-' * len }}
71 {{- '-' * len }}
72 {%- elif cell.level == 3 %}
72 {%- elif cell.level == 3 %}
73 {{- '~' * len }}
73 {{- '~' * len }}
74 {%- elif cell.level == 4 %}
74 {%- elif cell.level == 4 %}
75 {{- '.' * len }}
75 {{- '.' * len }}
76 {%- elif cell.level == 5 %}
76 {%- elif cell.level == 5 %}
77 {{- '\\' * len }}
77 {{- '\\' * len }}
78 {%- elif cell.level == 6 %}
78 {%- elif cell.level == 6 %}
79 {{- '`' * len }}
79 {{- '`' * len }}
80 {% endif %}
80 {% endif %}
81
81
82 {% endblock headingcell %}
82 {% endblock headingcell %}
83
83
84 {% block rawcell scoped %}{{ cell.source }}
84 {% block rawcell scoped %}{{ cell.source }}
85 {% endblock rawcell %}
85 {% endblock rawcell %}
86
86
87 {% block unknowncell scoped %}
87 {% block unknowncell scoped %}
88 unknown type {{cell.type}}
88 unknown type {{cell.type}}
89 {% endblock unknowncell %}
89 {% endblock unknowncell %}
General Comments 0
You need to be logged in to leave comments. Login now