##// END OF EJS Templates
Added notebook output formatting style
Jonathan Frederic -
Show More
@@ -26,7 +26,11 b' Note: For best display, use latex syntax highlighting. =))'
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 ((*- set wrap_size = 85 -*))
29 ((* if resources.sphinx.outputstyle == 'simple' *))
30 ((*- set wrap_size = 85 -*))
31 ((* elif resources.sphinx.outputstyle == 'notebook' *))
32 ((*- set wrap_size = 70 -*))
33 ((* endif *))
30
34
31 %==============================================================================
35 %==============================================================================
32 % Header
36 % Header
@@ -86,8 +90,8 b' Note: For best display, use latex syntax highlighting. =))'
86 \definecolor{nbframe-border}{rgb}{0.8,0.8,0.8}
90 \definecolor{nbframe-border}{rgb}{0.8,0.8,0.8}
87 \definecolor{nbframe-bg}{rgb}{0.95,0.95,0.95}
91 \definecolor{nbframe-bg}{rgb}{0.95,0.95,0.95}
88
92
89 \newenvironment{ColorVerbatim}[1][\unskip]
93 \newenvironment{ColorVerbatim}
90 {#1\\*\vspace{-2.4\baselineskip}\begin{mdframed}[backgroundcolor=nbframe-bg, userdefinedwidth=1\linewidth, leftmargin=0.08\linewidth, linecolor=nbframe-border, linewidth=1pt, usetwoside=false]}
94 {\begin{mdframed}[backgroundcolor=nbframe-bg, userdefinedwidth=1\linewidth, leftmargin=0.08\linewidth, linecolor=nbframe-border, linewidth=1pt, usetwoside=false]}
91 {\end{mdframed}}
95 {\end{mdframed}}
92
96
93 \renewenvironment{Verbatim}[1][\unskip]
97 \renewenvironment{Verbatim}[1][\unskip]
@@ -223,7 +227,9 b' Note: For best display, use latex syntax highlighting. =))'
223 ((( cell.input | highlight )))
227 ((( cell.input | highlight )))
224
228
225 ((* elif resources.sphinx.outputstyle == 'notebook' *))
229 ((* elif resources.sphinx.outputstyle == 'notebook' *))
226 \begin{ColorVerbatim}[\textbf{In {[}((( cell.prompt_number ))){]}:}]
230 \textbf{In {[}((( cell.prompt_number ))){]}:}\\*
231 \vspace{-2.4\baselineskip}
232 \begin{ColorVerbatim}
227 ((( cell.input | highlight )))
233 ((( cell.input | highlight )))
228 \end{ColorVerbatim}
234 \end{ColorVerbatim}
229 ((* endif *))
235 ((* endif *))
@@ -260,10 +266,15 b' Note: For best display, use latex syntax highlighting. =))'
260 ((* endfor *))
266 ((* endfor *))
261 ((* elif resources.sphinx.outputstyle == 'notebook' *))
267 ((* elif resources.sphinx.outputstyle == 'notebook' *))
262
268
263 % Add remainer of the document contents below.
269 %Skip one line down.
264 ((* for output in cell.outputs *))
270 \vspace{1\baselineskip}
265 ((( render_output(output) )))
271
266 ((* endfor *))
272 % Add document contents.
273 \begin{ColorVerbatim}
274 ((* for output in cell.outputs *))
275 ((( render_output(output) )))
276 ((* endfor *))
277 \end{ColorVerbatim}
267 ((* endif *))
278 ((* endif *))
268 ((* endblock *))
279 ((* endblock *))
269
280
@@ -330,11 +341,15 b' Note: For best display, use latex syntax highlighting. =))'
330 % Purpose: This macro creates a verbatim style block that fits the existing
341 % Purpose: This macro creates a verbatim style block that fits the existing
331 % sphinx style more readily than standard verbatim blocks.
342 % sphinx style more readily than standard verbatim blocks.
332 ((* macro custom_verbatim(text) -*))
343 ((* macro custom_verbatim(text) -*))
333
344 ((* if resources.sphinx.outputstyle == 'simple' *))
334 \begin{lstlisting}
345 \begin{lstlisting}
335 ((( text | wrap(wrap_size) )))
346 ((( text | wrap(wrap_size) )))
336 \end{lstlisting}
347 \end{lstlisting}
337
348 ((* elif resources.sphinx.outputstyle == 'notebook' *))
349 \begin{alltt}
350 ((( text | wrap(wrap_size) )))
351 \end{alltt}
352 ((* endif *))
338 ((*- endmacro *))
353 ((*- endmacro *))
339
354
340 % Name: insert_graphics
355 % Name: insert_graphics
General Comments 0
You need to be logged in to leave comments. Login now