-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnb-latex.tplx
86 lines (69 loc) · 2.78 KB
/
nb-latex.tplx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
((= Latex base template (must inherit)
This template builds upon the abstract template, adding common latex output
functions. Figures, data_text,
This template does not define a docclass, the inheriting class must define this.=))
((*- extends 'display_priority.tplx' -*))
%===============================================================================
% Abstract overrides
%===============================================================================
((* block header *))
((* endblock header *))
((* block body *))
((( super() )))
((* endblock body *))
%===============================================================================
% Support blocks
%===============================================================================
% Displaying simple data text
((* block data_text *))
((( output.data['text/plain'] | markdown2latex )))
((* endblock data_text *))
% Display python error text as-is
((* block error *))
\begin{Verbatim}[commandchars=\\\{\}]
((( super() )))
\end{Verbatim}
((* endblock error *))
((* block traceback_line *))
((( line | indent | strip_ansi | escape_latex )))
((* endblock traceback_line *))
% Display stream ouput with coloring
((* block stream *))
((( output.text | markdown2latex )))
((* endblock stream *))
% Display latex
((* block data_latex -*))
((( output.data['text/latex'] | citation2latex | strip_files_prefix | markdown2latex )))
((* endblock data_latex *))
% Display markdown
((* block data_markdown -*))
((( output.data['text/markdown'] | citation2latex | strip_files_prefix | markdown2latex )))
((* endblock data_markdown *))
% Default mechanism for rendering figures
((*- block data_png -*))((( draw_figure(output.metadata.filenames['image/png']) )))((*- endblock -*))
((*- block data_jpg -*))((( draw_figure(output.metadata.filenames['image/jpeg']) )))((*- endblock -*))
((*- block data_svg -*))((( draw_figure(output.metadata.filenames['image/svg+xml']) )))((*- endblock -*))
((*- block data_pdf -*))((( draw_figure(output.metadata.filenames['application/pdf']) )))((*- endblock -*))
% Draw a figure using the graphicx package.
((* macro draw_figure(filename) -*))
((* set filename = filename | posix_path *))
((*- block figure scoped -*))
\begin{figure*}[h]
\includegraphics[width=\linewidth]{((( filename )))}%
\caption{ Data Output }
\end{figure*}
((*- endblock figure -*))
((*- endmacro *))
% Redirect execute_result to display data priority.
((* block execute_result scoped *))
((* block data_priority scoped *))
((( super() )))
((* endblock *))
((* endblock execute_result *))
% Render markdown
((* block markdowncell scoped *))
((( cell.source | citation2latex | strip_files_prefix | markdown2latex )))
((* endblock markdowncell *))
% Don't display unknown types
((* block unknowncell scoped *))
((* endblock unknowncell *))