##// END OF EJS Templates
Finishing touches on notebook style...
Jonathan Frederic -
Show More
@@ -70,7 +70,11 b' Note: For best display, use latex syntax highlighting. =))'
70 \usepackage{color}
70 \usepackage{color}
71
71
72 % Needed to box output/input
72 % Needed to box output/input
73 \usepackage{mdframed}
73 \usepackage{tikz}
74 \usetikzlibrary{calc,arrows,shadows}
75 \usepackage[framemethod=tikz]{mdframed}
76
77
74 \usepackage{alltt}
78 \usepackage{alltt}
75
79
76 % Used to load and display graphics
80 % Used to load and display graphics
@@ -89,12 +93,34 b' Note: For best display, use latex syntax highlighting. =))'
89
93
90 %Set pygments styles if needed...
94 %Set pygments styles if needed...
91 ((* if resources.sphinx.outputstyle == 'notebook' *))
95 ((* if resources.sphinx.outputstyle == 'notebook' *))
92 \definecolor{nbframe-border}{rgb}{0.8,0.8,0.8}
96 \definecolor{nbframe-border}{rgb}{0.867,0.867,0.867}
93 \definecolor{nbframe-bg}{rgb}{0.95,0.95,0.95}
97 \definecolor{nbframe-bg}{rgb}{0.969,0.969,0.969}
94 \definecolor{nbframe-prompt}{rgb}{0.05,0.05,0.3}
98 \definecolor{nbframe-in-prompt}{rgb}{0.0,0.0,0.502}
99 \definecolor{nbframe-out-prompt}{rgb}{0.545,0.0,0.0}
95
100
96 \newenvironment{ColorVerbatim}
101 \newenvironment{ColorVerbatim}
97 {\begin{mdframed}[backgroundcolor=nbframe-bg, userdefinedwidth=1\linewidth, leftmargin=0.08\linewidth, linecolor=nbframe-border, linewidth=1pt, usetwoside=false]}
102 {\begin{mdframed}[%
103 roundcorner=1.0pt, %
104 backgroundcolor=nbframe-bg, %
105 userdefinedwidth=1\linewidth, %
106 leftmargin=0.1\linewidth, %
107 innerleftmargin=0pt, %
108 innerrightmargin=0pt, %
109 linecolor=nbframe-border, %
110 linewidth=1pt, %
111 usetwoside=false, %
112 everyline=true, %
113 innerlinewidth=3pt, %
114 innerlinecolor=nbframe-bg, %
115 middlelinewidth=1pt, %
116 middlelinecolor=nbframe-bg, %
117 outerlinewidth=0.5pt, %
118 outerlinecolor=nbframe-border %
119 ]}
120 {\end{mdframed}}
121
122 \newenvironment{InvisibleVerbatim}
123 {\begin{mdframed}[leftmargin=0.1\linewidth,innerleftmargin=3pt,innerrightmargin=3pt, userdefinedwidth=1\linewidth, linewidth=0pt, linecolor=white, usetwoside=false]}
98 {\end{mdframed}}
124 {\end{mdframed}}
99
125
100 \renewenvironment{Verbatim}[1][\unskip]
126 \renewenvironment{Verbatim}[1][\unskip]
@@ -238,11 +264,12 b' Note: For best display, use latex syntax highlighting. =))'
238 ((( cell.input | highlight )))
264 ((( cell.input | highlight )))
239
265
240 ((* elif resources.sphinx.outputstyle == 'notebook' *))
266 ((* elif resources.sphinx.outputstyle == 'notebook' *))
241 \vspace{5pt}
267 \vspace{8pt}
242 {\color{nbframe-prompt}\textbf{In {[}((( cell.prompt_number ))){]}:}}\\*
268 \makebox[0.1\linewidth]{\hfill\tt\color{nbframe-in-prompt}In{[}((( cell.prompt_number ))){]}:}\\*
243 \vspace{-2.6\baselineskip}
269 \vspace{-3pt}
270 \vspace{-2.55\baselineskip}
244 \begin{ColorVerbatim}
271 \begin{ColorVerbatim}
245 \vspace{-0.5\baselineskip}
272 \vspace{-0.6\baselineskip}
246 ((( cell.input | highlight )))
273 ((( cell.input | highlight )))
247 \end{ColorVerbatim}
274 \end{ColorVerbatim}
248 ((* endif *))
275 ((* endif *))
@@ -276,19 +303,14 b' Note: For best display, use latex syntax highlighting. =))'
276
303
277 % Add remainer of the document contents below.
304 % Add remainer of the document contents below.
278 ((* for output in cell.outputs[1:] *))
305 ((* for output in cell.outputs[1:] *))
279 ((( render_output(output) )))
306 ((( render_output(output, cell.prompt_number) )))
280 ((* endfor *))
307 ((* endfor *))
281 ((* elif resources.sphinx.outputstyle == 'notebook' *))
308 ((* elif resources.sphinx.outputstyle == 'notebook' *))
282
309
283 %Skip one line down.
284 \vspace{1\baselineskip}
285
286 % Add document contents.
310 % Add document contents.
287 \begin{ColorVerbatim}
311 ((* for output in cell.outputs *))
288 ((* for output in cell.outputs *))
312 ((( render_output(output, cell.prompt_number) )))
289 ((( render_output(output) )))
313 ((* endfor *))
290 ((* endfor *))
291 \end{ColorVerbatim}
292 ((* endif *))
314 ((* endif *))
293 ((* endif *))
315 ((* endif *))
294 ((* endblock *))
316 ((* endblock *))
@@ -315,8 +337,9 b' Note: For best display, use latex syntax highlighting. =))'
315 ((( center_output(insert_graphics(output.key_svg)) )))
337 ((( center_output(insert_graphics(output.key_svg)) )))
316 ((*- endblock -*))
338 ((*- endblock -*))
317
339
318 ((*- block data_latex -*))
340 ((*- block data_latex *))
319 ((( center_output(output.latex | rm_math_space) )))
341 \vspace{-1\baselineskip}
342 ((* if resources.sphinx.centeroutput *))\begin{center}((* endif -*))((( output.latex | rm_math_space )))((*- if resources.sphinx.centeroutput *))\end{center} ((* endif -*))
320 ((*- endblock -*))
343 ((*- endblock -*))
321
344
322 %==============================================================================
345 %==============================================================================
@@ -325,15 +348,30 b' Note: For best display, use latex syntax highlighting. =))'
325
348
326 % Name: render_output
349 % Name: render_output
327 % Purpose: Renders an output block appropriately.
350 % Purpose: Renders an output block appropriately.
328 ((* macro render_output(output) -*))
351 ((* macro render_output(output, prompt_number) -*))
329 ((*- if output.output_type == 'pyerr' -*))
352 ((*- if output.output_type == 'pyerr' -*))
330 ((*- block pyerr scoped *))
353 ((*- block pyerr scoped *))
331 ((( custom_verbatim(super()) )))
354 ((( custom_verbatim(super()) )))
332 ((* endblock pyerr -*))
355 ((* endblock pyerr -*))
333 ((*- else -*))
356 ((*- else -*))
357
358 ((* if resources.sphinx.outputstyle == 'notebook' *))
359 ((*- if output.output_type == 'pyout' -*))
360 \makebox[0.1\linewidth]{\hfill\tt\color{nbframe-out-prompt}Out{[}((( prompt_number ))){]}:}\\*
361 \vspace{-2.55\baselineskip}
362 ((*- endif -*))
363
364 \begin{InvisibleVerbatim}
365 \vspace{-0.5\baselineskip}
366 ((*- endif -*))
367
334 ((*- block display_data scoped -*))
368 ((*- block display_data scoped -*))
335 ((( super() )))
369 ((( super() )))
336 ((*- endblock display_data -*))
370 ((*- endblock display_data -*))
371
372 ((* if resources.sphinx.outputstyle == 'notebook' *))
373 \end{InvisibleVerbatim}
374 ((*- endif -*))
337 ((*- endif -*))
375 ((*- endif -*))
338 ((*- endmacro *))
376 ((*- endmacro *))
339
377
General Comments 0
You need to be logged in to leave comments. Login now