primera_parte/latex-template/document_contents.tex.j2 (2818B)
1 ((*- extends 'display_priority.j2' -*)) 2 3 %=============================================================================== 4 % Support blocks 5 %=============================================================================== 6 7 % Displaying simple data text 8 ((* block data_text *)) 9 \begin{Verbatim}[commandchars=\\\{\}] 10 ((( output.data['text/plain'] | escape_latex | ansi2latex ))) 11 \end{Verbatim} 12 ((* endblock data_text *)) 13 14 % Display python error text with colored frame (saves printer ink vs bkgnd) 15 ((* block error *)) 16 \begin{Verbatim}[commandchars=\\\{\}, frame=single, framerule=2mm, rulecolor=\color{outerrorbackground}] 17 (((- super() ))) 18 \end{Verbatim} 19 ((* endblock error *)) 20 % Display error lines with coloring 21 ((*- block traceback_line *)) 22 ((( line | escape_latex | ansi2latex ))) 23 ((*- endblock traceback_line *)) 24 25 % Display stream ouput with coloring 26 ((* block stream *)) 27 \begin{Verbatim}[commandchars=\\\{\}] 28 ((( output.text | escape_latex | ansi2latex ))) 29 \end{Verbatim} 30 ((* endblock stream *)) 31 32 % Display latex 33 ((* block data_latex -*)) 34 ((( output.data['text/latex'] | strip_files_prefix ))) 35 ((* endblock data_latex *)) 36 37 % Display markdown 38 ((* block data_markdown -*)) 39 ((( output.data['text/markdown'] | citation2latex | strip_files_prefix | convert_pandoc('markdown+tex_math_double_backslash', 'latex')))) 40 ((* endblock data_markdown *)) 41 42 % Default mechanism for rendering figures 43 ((*- block data_png -*))((( draw_figure(output.metadata.filenames['image/png']) )))((*- endblock -*)) 44 ((*- block data_jpg -*))((( draw_figure(output.metadata.filenames['image/jpeg']) )))((*- endblock -*)) 45 ((*- block data_svg -*))((( draw_figure(output.metadata.filenames['image/svg+xml']) )))((*- endblock -*)) 46 ((*- block data_pdf -*))((( draw_figure(output.metadata.filenames['application/pdf']) )))((*- endblock -*)) 47 48 % Draw a figure using the graphicx package. 49 ((* macro draw_figure(filename) -*)) 50 ((* set filename = filename | posix_path *)) 51 ((*- block figure scoped -*)) 52 \vspace{-0.50em} 53 \begin{center} 54 \adjustimage{max size={\linewidth}{\paperheight}}{((( filename )))} 55 \end{center} 56 { \hspace*{\fill} \\} 57 \vspace{-2.75em} 58 ((*- endblock figure -*)) 59 ((*- endmacro *)) 60 61 % Redirect execute_result to display data priority. 62 ((* block execute_result scoped *)) 63 ((* block data_priority scoped *)) 64 ((( super() ))) 65 ((* endblock *)) 66 ((* endblock execute_result *)) 67 68 % Render markdown 69 ((* block markdowncell scoped *)) 70 ((( cell.source | citation2latex | strip_files_prefix | convert_pandoc('markdown+tex_math_double_backslash', 'json',extra_args=[]) | resolve_references | convert_explicitly_relative_paths | convert_pandoc('json','latex')))) 71 ((* endblock markdowncell *)) 72 73 % Don't display unknown types 74 ((* block unknowncell scoped *)) 75 ((* endblock unknowncell *))