Show More
@@ -91,9 +91,10 b' Note: For best display, use latex syntax highlighting. =))' | |||
|
91 | 91 | ((* if resources.sphinx.outputstyle == 'notebook' *)) |
|
92 | 92 | \definecolor{nbframe-border}{rgb}{0.8,0.8,0.8} |
|
93 | 93 | \definecolor{nbframe-bg}{rgb}{0.95,0.95,0.95} |
|
94 | \definecolor{nbframe-prompt}{rgb}{0.05,0.05,0.3} | |
|
94 | 95 | |
|
95 | 96 | \newenvironment{ColorVerbatim} |
|
96 |
{\begin{mdframed}[backgroundcolor=nbframe-bg, |
|
|
97 | {\begin{mdframed}[backgroundcolor=nbframe-bg, userdefinedwidth=1\linewidth, leftmargin=0.08\linewidth, linecolor=nbframe-border, linewidth=1pt, usetwoside=false]} | |
|
97 | 98 | {\end{mdframed}} |
|
98 | 99 | |
|
99 | 100 | \renewenvironment{Verbatim}[1][\unskip] |
@@ -132,7 +133,10 b' Note: For best display, use latex syntax highlighting. =))' | |||
|
132 | 133 | % Start of the document |
|
133 | 134 | \begin{document} |
|
134 | 135 | \maketitle |
|
136 | ||
|
137 | ((* block toc *)) | |
|
135 | 138 | \tableofcontents |
|
139 | ((* endblock toc *)) | |
|
136 | 140 | |
|
137 | 141 | ((* endblock bodyBegin *))((( super() )))((* block bodyEnd *)) |
|
138 | 142 | |
@@ -215,9 +219,11 b' Note: For best display, use latex syntax highlighting. =))' | |||
|
215 | 219 | % Input |
|
216 | 220 | %============================================================================== |
|
217 | 221 | ((* block input *)) |
|
222 | ||
|
223 | % Make sure that atleast 4 lines are below the HR | |
|
224 | \needspace{((( min_header_lines )))\baselineskip} | |
|
225 | ||
|
218 | 226 | ((* if resources.sphinx.outputstyle == 'simple' *)) |
|
219 | % Make sure that atleast 4 lines are below the HR | |
|
220 | \needspace{((( min_header_lines )))\baselineskip} | |
|
221 | 227 | |
|
222 | 228 | % Add a horizantal break, along with break title. |
|
223 | 229 | \vspace{10pt} |
@@ -229,9 +235,11 b' Note: For best display, use latex syntax highlighting. =))' | |||
|
229 | 235 | ((( cell.input | highlight ))) |
|
230 | 236 | |
|
231 | 237 | ((* elif resources.sphinx.outputstyle == 'notebook' *)) |
|
232 | \textbf{In {[}((( cell.prompt_number ))){]}:}\\* | |
|
233 | \vspace{-2.4\baselineskip} | |
|
238 | \vspace{5pt} | |
|
239 | {\color{nbframe-prompt}\textbf{In {[}((( cell.prompt_number ))){]}:}}\\* | |
|
240 | \vspace{-2.6\baselineskip} | |
|
234 | 241 | \begin{ColorVerbatim} |
|
242 | \vspace{-0.5\baselineskip} | |
|
235 | 243 | ((( cell.input | highlight ))) |
|
236 | 244 | \end{ColorVerbatim} |
|
237 | 245 | ((* endif *)) |
@@ -244,39 +252,41 b' Note: For best display, use latex syntax highlighting. =))' | |||
|
244 | 252 | % once. By keeping track of when an input group is started |
|
245 | 253 | %============================================================================== |
|
246 | 254 | ((* block output_group *)) |
|
247 |
((* if |
|
|
248 | ||
|
249 | % If the first block is an image, minipage the image. Else | |
|
250 | % request a certain amount of space for the input text. | |
|
251 | ((( iff_figure(cell.outputs[0], "\\begin{minipage}{1.0\\textwidth}", "\\needspace{" ~ min_header_lines ~ "\\baselineskip}") ))) | |
|
252 | ||
|
253 | % Add a horizantal break, along with break title. | |
|
254 | \vspace{10pt} | |
|
255 | {\scriptsize Output}\\* | |
|
256 | \rule[10pt]{\linewidth}{0.5pt} | |
|
257 | \vspace{-20pt} | |
|
258 | ||
|
259 | % Add the contents of the first block. | |
|
260 | ((( render_output(cell.outputs[0]) ))) | |
|
261 | ||
|
262 | % Close the minipage. | |
|
263 | ((( iff_figure(cell.outputs[0], "\\end{minipage}", "") ))) | |
|
264 | ||
|
265 | % Add remainer of the document contents below. | |
|
266 | ((* for output in cell.outputs[1:] *)) | |
|
267 |
(( |
|
|
268 | ((* endfor *)) | |
|
269 | ((* elif resources.sphinx.outputstyle == 'notebook' *)) | |
|
270 | ||
|
271 | %Skip one line down. | |
|
272 | \vspace{1\baselineskip} | |
|
273 | ||
|
274 | % Add document contents. | |
|
275 | \begin{ColorVerbatim} | |
|
276 | ((* for output in cell.outputs *)) | |
|
255 | ((* if cell.outputs.__len__() > 0 *)) | |
|
256 | ((* if resources.sphinx.outputstyle == 'simple' *)) | |
|
257 | ||
|
258 | % If the first block is an image, minipage the image. Else | |
|
259 | % request a certain amount of space for the input text. | |
|
260 | ((( iff_figure(cell.outputs[0], "\\begin{minipage}{1.0\\textwidth}", "\\needspace{" ~ min_header_lines ~ "\\baselineskip}") ))) | |
|
261 | ||
|
262 | % Add a horizantal break, along with break title. | |
|
263 | \vspace{10pt} | |
|
264 | {\scriptsize Output}\\* | |
|
265 | \rule[10pt]{\linewidth}{0.5pt} | |
|
266 | \vspace{-20pt} | |
|
267 | ||
|
268 | % Add the contents of the first block. | |
|
269 | ((( render_output(cell.outputs[0]) ))) | |
|
270 | ||
|
271 | % Close the minipage. | |
|
272 | ((( iff_figure(cell.outputs[0], "\\end{minipage}", "") ))) | |
|
273 | ||
|
274 | % Add remainer of the document contents below. | |
|
275 | ((* for output in cell.outputs[1:] *)) | |
|
277 | 276 | ((( render_output(output) ))) |
|
278 | 277 | ((* endfor *)) |
|
279 | \end{ColorVerbatim} | |
|
278 | ((* elif resources.sphinx.outputstyle == 'notebook' *)) | |
|
279 | ||
|
280 | %Skip one line down. | |
|
281 | \vspace{1\baselineskip} | |
|
282 | ||
|
283 | % Add document contents. | |
|
284 | \begin{ColorVerbatim} | |
|
285 | ((* for output in cell.outputs *)) | |
|
286 | ((( render_output(output) ))) | |
|
287 | ((* endfor *)) | |
|
288 | \end{ColorVerbatim} | |
|
289 | ((* endif *)) | |
|
280 | 290 | ((* endif *)) |
|
281 | 291 | ((* endblock *)) |
|
282 | 292 | |
@@ -302,6 +312,10 b' Note: For best display, use latex syntax highlighting. =))' | |||
|
302 | 312 | ((( insert_graphics(output.key_svg) ))) |
|
303 | 313 | ((*- endblock -*)) |
|
304 | 314 | |
|
315 | ((*- block data_latex *)) | |
|
316 | ((( output.latex ))) | |
|
317 | ((* endblock -*)) | |
|
318 | ||
|
305 | 319 | %============================================================================== |
|
306 | 320 | % Support Macros |
|
307 | 321 | %============================================================================== |
@@ -309,22 +323,14 b' Note: For best display, use latex syntax highlighting. =))' | |||
|
309 | 323 | % Name: render_output |
|
310 | 324 | % Purpose: Renders an output block appropriately. |
|
311 | 325 | ((* macro render_output(output) -*)) |
|
312 |
((*- if output.output_type == 'py |
|
|
313 |
((*- block py |
|
|
314 | ((( custom_verbatim(super()) ))) | |
|
315 |
((* |
|
|
316 | ((*- elif output.output_type == 'stream' -*)) | |
|
317 | ((*- block stream scoped -*)) | |
|
318 | ((( custom_verbatim(output.text) ))) | |
|
319 | ((*- endblock stream -*)) | |
|
320 | ((*- elif output.output_type == 'display_data' -*)) | |
|
326 | ((*- if output.output_type == 'pyerr' -*)) | |
|
327 | ((*- block pyerr scoped *)) | |
|
328 | ((( custom_verbatim(super()) ))) | |
|
329 | ((* endblock pyerr -*)) | |
|
330 | ((*- else -*)) | |
|
321 | 331 | ((*- block display_data scoped -*)) |
|
322 | 332 | ((( super() ))) |
|
323 | 333 | ((*- endblock display_data -*)) |
|
324 | ((*- elif output.output_type == 'pyerr' -*)) | |
|
325 | ((*- block pyerr scoped -*)) | |
|
326 | ((( custom_verbatim(super()) ))) | |
|
327 | ((*- endblock pyerr -*)) | |
|
328 | 334 | ((*- endif -*)) |
|
329 | 335 | ((*- endmacro *)) |
|
330 | 336 |
General Comments 0
You need to be logged in to leave comments.
Login now