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