##// END OF EJS Templates
Finishing up results of in person review
Jonathan Frederic -
Show More
@@ -1,41 +1,41 b''
1 ((= Black&white ipython input/output style =))
1 ((= Black&white ipython input/output style =))
2
2
3 ((*- extends 'latex_base.tplx' -*))
3 ((*- extends 'latex_base.tplx' -*))
4
4
5 %===============================================================================
5 %===============================================================================
6 % Input
6 % Input
7 %===============================================================================
7 %===============================================================================
8
8
9 ((* block input scoped *))
9 ((* block input scoped *))
10 ((( add_prompt(cell.input, cell, 'In ') )))
10 ((( add_prompt(cell.input, cell, 'In ') )))
11 ((* endblock input *))
11 ((* endblock input *))
12
12
13
13
14 %===============================================================================
14 %===============================================================================
15 % Output
15 % Output
16 %===============================================================================
16 %===============================================================================
17
17
18 ((* block pyout scoped *))
18 ((* block pyout scoped *))
19 ((*- for type in output | filter_data_type -*))
19 ((*- for type in output | filter_data_type -*))
20 ((*- if type in ['text']*))
20 ((*- if type in ['text']*))
21 ((( add_prompt(output.text, cell, 'Out') )))
21 ((( add_prompt(output.text, cell, 'Out') )))
22 ((*- else -*))
22 ((*- else -*))
23 \verb+Out[((( cell.prompt_number )))]:+((( super() )))
23 \verb+Out[((( cell.prompt_number )))]:+((( super() )))
24 ((*- endif -*))
24 ((*- endif -*))
25 ((*- endfor -*))
25 ((*- endfor -*))
26 ((* endblock pyout *))
26 ((* endblock pyout *))
27
27
28
28
29 %==============================================================================
29 %==============================================================================
30 % Support Macros
30 % Support Macros
31 %==============================================================================
31 %==============================================================================
32
32
33 % Name: draw_prompt
33 % Name: draw_prompt
34 % Purpose: Renders an output/input prompt
34 % Purpose: Renders an output/input prompt
35 ((* macro add_prompt(text, cell, prompt) -*))
35 ((* macro add_prompt(text, cell, prompt) -*))
36 ((*- set prompt_number = "" ~ cell.prompt_number -*))
36 ((*- set prompt_number = "" ~ cell.prompt_number -*))
37 ((*- set prompt_number_replacement = "." * (prompt_number | length + 2) -*))
37 ((*- set prompt_number_replacement = "." * (prompt_number | length + 2) -*))
38 \begin{verbatim}
38 \begin{verbatim}
39 (((- text | add_prompts(first=prompt ~ '[' ~ prompt_number ~ ']: ', cont=' ' ~ prompt_number_replacement ~ ': ') -)))
39 (((- text | add_prompts(first=prompt ~ '[' ~ prompt_number ~ ']: ', cont='') -)))
40 \end{verbatim}
40 \end{verbatim}
41 ((*- endmacro *))
41 ((*- endmacro *))
@@ -1,60 +1,54 b''
1 ((= IPython input/output style =))
1 ((= IPython input/output style =))
2
2
3 ((*- extends 'latex_base.tplx' -*))
3 ((*- extends 'latex_base.tplx' -*))
4
4
5 % Custom definitions
5 % Custom definitions
6 ((* block definitions *))
6 ((* block definitions *))
7 ((( super() )))
7 ((( super() )))
8
8
9 % Pygments definitions
9 % Pygments definitions
10 ((( resources.latex.pygment_definitions )))
10 ((( resources.latex.pygment_definitions )))
11
11
12 % % Exact colors from ipy
12 % Exact colors from NB
13 % \definecolor{incolor}{rgb}{0.094, 0.698, 0.094}
13 \definecolor{incolor}{rgb}{0.0, 0.0, 0.5}
14 % \definecolor{lightincolor}{rgb}{0.329, 1.000, 0.329}
14 \definecolor{outcolor}{rgb}{0.545, 0.0, 0.0}
15 % \definecolor{outcolor}{rgb}{0.698, 0.094, 0.094}
15
16 % \definecolor{lightoutcolor}{rgb}{1.000, 0.329, 0.329}
17
18 \definecolor{incolor}{rgb}{0.1, 0.5, 0.1}
19 \definecolor{lightincolor}{rgb}{0.1, 0.7, 0.1}
20 \definecolor{outcolor}{rgb}{0.5, 0.1, 0.1}
21 \definecolor{lightoutcolor}{rgb}{0.7, 0.1, 0.1}
22 ((* endblock definitions *))
16 ((* endblock definitions *))
23
17
24 %===============================================================================
18 %===============================================================================
25 % Input
19 % Input
26 %===============================================================================
20 %===============================================================================
27
21
28 ((* block input scoped *))
22 ((* block input scoped *))
29 ((( add_prompt(cell.input | highlight2latex(strip_verbatim=True), cell, 'In ', 'incolor') )))
23 ((( add_prompt(cell.input | highlight2latex(strip_verbatim=True), cell, 'In ', 'incolor') )))
30 ((* endblock input *))
24 ((* endblock input *))
31
25
32
26
33 %===============================================================================
27 %===============================================================================
34 % Output
28 % Output
35 %===============================================================================
29 %===============================================================================
36
30
37 ((* block pyout scoped *))
31 ((* block pyout scoped *))
38 ((*- for type in output | filter_data_type -*))
32 ((*- for type in output | filter_data_type -*))
39 ((*- if type in ['text']*))
33 ((*- if type in ['text']*))
40 ((( add_prompt(output.text | escape_latex, cell, 'Out', 'outcolor') )))
34 ((( add_prompt(output.text | escape_latex, cell, 'Out', 'outcolor') )))
41 ((* else -*))
35 ((* else -*))
42 \texttt{\color{outcolor}Out[{\color{lightoutcolor}((( cell.prompt_number )))}]:}((( super() )))
36 \texttt{\color{outcolor}Out[{\color{outcolor}((( cell.prompt_number )))}]:}((( super() )))
43 ((*- endif -*))
37 ((*- endif -*))
44 ((*- endfor -*))
38 ((*- endfor -*))
45 ((* endblock pyout *))
39 ((* endblock pyout *))
46
40
47
41
48 %==============================================================================
42 %==============================================================================
49 % Support Macros
43 % Support Macros
50 %==============================================================================
44 %==============================================================================
51
45
52 % Name: draw_prompt
46 % Name: draw_prompt
53 % Purpose: Renders an output/input prompt
47 % Purpose: Renders an output/input prompt
54 ((* macro add_prompt(text, cell, prompt, prompt_color) -*))
48 ((* macro add_prompt(text, cell, prompt, prompt_color) -*))
55 ((*- set prompt_number = "" ~ cell.prompt_number -*))
49 ((*- set prompt_number = "" ~ cell.prompt_number -*))
56 ((*- set prompt_number_replacement = "." * (prompt_number | length + 2) -*))
50 ((*- set prompt_number_replacement = "." * (prompt_number | length + 2) -*))
57 \begin{Verbatim}[commandchars=\\\{\}]
51 \begin{Verbatim}[commandchars=\\\{\}]
58 ((( text | add_prompts(first='{\color{' ~ prompt_color ~ '}' ~ prompt ~ '[{\\color{light' ~ prompt_color ~ '}' ~ prompt_number ~ '}]:} ', cont=' {\color{' ~ prompt_color ~ '}' ~ prompt_number_replacement ~ ':} ') )))
52 ((( text | add_prompts(first='{\color{' ~ prompt_color ~ '}' ~ prompt ~ '[{\\color{' ~ prompt_color ~ '}' ~ prompt_number ~ '}]:} ', cont='') )))
59 \end{Verbatim}
53 \end{Verbatim}
60 ((*- endmacro *))
54 ((*- endmacro *))
@@ -1,183 +1,184 b''
1 ((= Latex base template (must inherit)
1 ((= Latex base template (must inherit)
2 This template builds upon the abstract template, adding common latex output
2 This template builds upon the abstract template, adding common latex output
3 functions. Figures, data_text,
3 functions. Figures, data_text,
4 This template does not define a docclass, the inheriting class must define this.=))
4 This template does not define a docclass, the inheriting class must define this.=))
5
5
6 ((*- extends 'abstract.tplx' -*))
6 ((*- extends 'abstract.tplx' -*))
7
7
8 %===============================================================================
8 %===============================================================================
9 % Abstract overrides
9 % Abstract overrides
10 %===============================================================================
10 %===============================================================================
11
11
12 ((* block packages *))
12 ((* block packages *))
13 \usepackage{graphicx} % Used to insert images
13 \usepackage{graphicx} % Used to insert images
14 \usepackage{adjustbox} % Used to constrain images to a maximum size
14 \usepackage{adjustbox} % Used to constrain images to a maximum size
15 \usepackage{color} % Allow colors to be defined
15 \usepackage{color} % Allow colors to be defined
16 \usepackage{enumerate} % Needed for markdown enumerations to work
16 \usepackage{enumerate} % Needed for markdown enumerations to work
17 \usepackage{geometry} % Used to adjust the document margins
17 \usepackage{geometry} % Used to adjust the document margins
18 \usepackage{amsmath} % Equations
18 \usepackage{amsmath} % Equations
19 \usepackage{amssymb} % Equations
19 \usepackage{amssymb} % Equations
20 \usepackage[utf8]{inputenc} % Allow utf-8 characters in the tex document
20 \usepackage[utf8]{inputenc} % Allow utf-8 characters in the tex document
21 \usepackage{ucs} % Extended unicode (utf-8) support
21 \usepackage{ucs} % Extended unicode (utf-8) support
22 \usepackage{fancyvrb} % verbatim replacement that allows latex
22 \usepackage{fancyvrb} % verbatim replacement that allows latex
23 \usepackage{grffile} % extends the file name processing of package graphics
23 \usepackage{grffile} % extends the file name processing of package graphics
24 %to support a larger range
24 %to support a larger range
25
25
26 % The hyperref package gives us a pdf with properly built
26 % The hyperref package gives us a pdf with properly built
27 % internal navigation ('pdf bookmarks' for the table of contents,
27 % internal navigation ('pdf bookmarks' for the table of contents,
28 % internal cross-reference links, web links for URLs, etc.)
28 % internal cross-reference links, web links for URLs, etc.)
29 \usepackage{hyperref}
29 \usepackage{hyperref}
30 ((* endblock packages *))
30 ((* endblock packages *))
31
31
32 ((* block definitions *))
32 ((* block definitions *))
33
33
34 \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
34 \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
35 \definecolor{darkorange}{rgb}{.71,0.21,0.01}
35 \definecolor{darkorange}{rgb}{.71,0.21,0.01}
36 \definecolor{darkgreen}{rgb}{.12,.54,.11}
36 \definecolor{darkgreen}{rgb}{.12,.54,.11}
37 \definecolor{myteal}{rgb}{.26, .44, .56}
37 \definecolor{myteal}{rgb}{.26, .44, .56}
38 \definecolor{gray}{gray}{0.45}
38 \definecolor{gray}{gray}{0.45}
39 \definecolor{lightgray}{gray}{.95}
39 \definecolor{lightgray}{gray}{.95}
40 \definecolor{mediumgray}{gray}{.8}
40 \definecolor{mediumgray}{gray}{.8}
41 \definecolor{inputbackground}{rgb}{.95, .95, .85}
41 \definecolor{inputbackground}{rgb}{.95, .95, .85}
42 \definecolor{outputbackground}{rgb}{.95, .95, .95}
42 \definecolor{outputbackground}{rgb}{.95, .95, .95}
43 \definecolor{traceback}{rgb}{1, .95, .95}
43 \definecolor{traceback}{rgb}{1, .95, .95}
44
44
45 % new ansi colors
45 % new ansi colors
46 \definecolor{brown}{rgb}{0.54,0.27,0.07}
46 \definecolor{brown}{rgb}{0.54,0.27,0.07}
47 \definecolor{purple}{rgb}{0.5,0.0,0.5}
47 \definecolor{purple}{rgb}{0.5,0.0,0.5}
48 \definecolor{darkgray}{gray}{0.25}
48 \definecolor{darkgray}{gray}{0.25}
49 \definecolor{lightred}{rgb}{1.0,0.39,0.28}
49 \definecolor{lightred}{rgb}{1.0,0.39,0.28}
50 \definecolor{lightgreen}{rgb}{0.48,0.99,0.0}
50 \definecolor{lightgreen}{rgb}{0.48,0.99,0.0}
51 \definecolor{lightblue}{rgb}{0.53,0.81,0.92}
51 \definecolor{lightblue}{rgb}{0.53,0.81,0.92}
52 \definecolor{lightpurple}{rgb}{0.87,0.63,0.87}
52 \definecolor{lightpurple}{rgb}{0.87,0.63,0.87}
53 \definecolor{lightcyan}{rgb}{0.5,1.0,0.83}
53 \definecolor{lightcyan}{rgb}{0.5,1.0,0.83}
54
54
55 % Define a nice break command that doesn't care if a line doesn't already
55 % Define a nice break command that doesn't care if a line doesn't already
56 % exist.
56 % exist.
57 \def\br{\hspace*{\fill} \\* }
57 \def\br{\hspace*{\fill} \\* }
58
58
59 % Document parameters
59 % Document parameters
60 ((* block title *))\title{((( resources.metadata.name | escape_latex )))}((* endblock title *))
60 ((* block title *))\title{((( resources.metadata.name | escape_latex )))}((* endblock title *))
61 ((* block date *))((* endblock date *))
61 ((* block date *))((* endblock date *))
62 ((* block author *))((* endblock author *))
62 ((* block author *))((* endblock author *))
63 ((* endblock definitions *))
63 ((* endblock definitions *))
64
64
65 ((* block commands *))
65 ((* block commands *))
66 \sloppy % Prevent overflowing lines due to hard-to-break entities
66 \sloppy % Prevent overflowing lines due to hard-to-break entities
67
67
68 % Setup hyperref package
68 % Setup hyperref package
69 \hypersetup{
69 \hypersetup{
70 breaklinks=true, % so long urls are correctly broken across lines
70 breaklinks=true, % so long urls are correctly broken across lines
71 colorlinks=true,
71 colorlinks=true,
72 urlcolor=blue,
72 urlcolor=blue,
73 linkcolor=darkorange,
73 linkcolor=darkorange,
74 citecolor=darkgreen,
74 citecolor=darkgreen,
75 }
75 }
76
76
77 % Slightly bigger margins than the latex defaults
77 % Slightly bigger margins than the latex defaults
78 ((* block margins *))
78 ((* block margins *))
79 \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
79 \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
80 ((* endblock margins *))
80 ((* endblock margins *))
81 ((* endblock commands *))
81 ((* endblock commands *))
82
82
83 ((* block predoc *))
83 ((* block predoc *))
84 ((* block maketitle *))\maketitle((* endblock maketitle *))
84 ((* block maketitle *))\maketitle((* endblock maketitle *))
85 ((* block abstract *))((* endblock abstract *))
85 ((* endblock predoc *))
86 ((* endblock predoc *))
86
87
87 %===============================================================================
88 %===============================================================================
88 % Support blocks
89 % Support blocks
89 %===============================================================================
90 %===============================================================================
90
91
91 % Displaying simple data text
92 % Displaying simple data text
92 ((* block data_text *))
93 ((* block data_text *))
93 \begin{verbatim}
94 \begin{verbatim}
94 ((( output.text )))
95 ((( output.text )))
95 \end{verbatim}
96 \end{verbatim}
96 ((* endblock data_text *))
97 ((* endblock data_text *))
97
98
98 % Display python error text as-is
99 % Display python error text as-is
99 ((* block pyerr *))
100 ((* block pyerr *))
100 \begin{Verbatim}[commandchars=\\\{\}]
101 \begin{Verbatim}[commandchars=\\\{\}]
101 ((( super() )))
102 ((( super() )))
102 \end{Verbatim}
103 \end{Verbatim}
103 ((* endblock pyerr *))
104 ((* endblock pyerr *))
104 ((* block traceback_line *))
105 ((* block traceback_line *))
105 ((( line | indent | strip_ansi | escape_latex )))
106 ((( line | indent | strip_ansi | escape_latex )))
106 ((* endblock traceback_line *))
107 ((* endblock traceback_line *))
107
108
108 % Display stream ouput with coloring
109 % Display stream ouput with coloring
109 ((* block stream *))
110 ((* block stream *))
110 \begin{Verbatim}[commandchars=\\\{\}]
111 \begin{Verbatim}[commandchars=\\\{\}]
111 ((( output.text | ansi2latex )))
112 ((( output.text | ansi2latex )))
112 \end{Verbatim}
113 \end{Verbatim}
113 ((* endblock stream *))
114 ((* endblock stream *))
114
115
115 % Display latex
116 % Display latex
116 ((* block data_latex -*))
117 ((* block data_latex -*))
117 ((*- if output.latex.startswith('$'): -*))
118 ((*- if output.latex.startswith('$'): -*))
118 ((= Replace $ symbols with more explicit, equation block. =))
119 ((= Replace $ symbols with more explicit, equation block. =))
119 \begin{equation*}
120 \begin{equation*}
120 ((( output.latex | strip_dollars )))
121 ((( output.latex | strip_dollars )))
121 \end{equation*}
122 \end{equation*}
122 ((*- else -*))
123 ((*- else -*))
123 ((( output.latex )))
124 ((( output.latex )))
124 ((*- endif *))
125 ((*- endif *))
125 ((* endblock data_latex *))
126 ((* endblock data_latex *))
126
127
127 % Default mechanism for rendering figures
128 % Default mechanism for rendering figures
128 ((*- block data_png -*))((( draw_figure(output.png_filename) )))((*- endblock -*))
129 ((*- block data_png -*))((( draw_figure(output.png_filename) )))((*- endblock -*))
129 ((*- block data_jpg -*))((( draw_figure(output.jpeg_filename) )))((*- endblock -*))
130 ((*- block data_jpg -*))((( draw_figure(output.jpeg_filename) )))((*- endblock -*))
130 ((*- block data_svg -*))((( draw_figure(output.svg_filename) )))((*- endblock -*))
131 ((*- block data_svg -*))((( draw_figure(output.svg_filename) )))((*- endblock -*))
131 ((*- block data_pdf -*))((( draw_figure(output.pdf_filename) )))((*- endblock -*))
132 ((*- block data_pdf -*))((( draw_figure(output.pdf_filename) )))((*- endblock -*))
132
133
133 % Draw a figure using the graphicx package.
134 % Draw a figure using the graphicx package.
134 ((* macro draw_figure(filename) -*))
135 ((* macro draw_figure(filename) -*))
135 ((* set filename = filename | posix_path *))
136 ((* set filename = filename | posix_path *))
136 ((*- block figure scoped -*))
137 ((*- block figure scoped -*))
137 \begin{center}
138 \begin{center}
138 \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{((( filename )))}
139 \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{((( filename )))}
139 \end{center}
140 \end{center}
140 { \hspace*{\fill} \\}
141 { \hspace*{\fill} \\}
141 ((*- endblock figure -*))
142 ((*- endblock figure -*))
142 ((*- endmacro *))
143 ((*- endmacro *))
143
144
144 % Draw heading cell. Explicitly map different cell levels.
145 % Draw heading cell. Explicitly map different cell levels.
145 ((* block headingcell scoped *))
146 ((* block headingcell scoped *))
146
147
147 ((* if cell.level == 1 -*))
148 ((* if cell.level == 1 -*))
148 ((* block h1 -*))\section((* endblock h1 -*))
149 ((* block h1 -*))\section((* endblock h1 -*))
149 ((* elif cell.level == 2 -*))
150 ((* elif cell.level == 2 -*))
150 ((* block h2 -*))\subsection((* endblock h2 -*))
151 ((* block h2 -*))\subsection((* endblock h2 -*))
151 ((* elif cell.level == 3 -*))
152 ((* elif cell.level == 3 -*))
152 ((* block h3 -*))\subsubsection((* endblock h3 -*))
153 ((* block h3 -*))\subsubsection((* endblock h3 -*))
153 ((* elif cell.level == 4 -*))
154 ((* elif cell.level == 4 -*))
154 ((* block h4 -*))\paragraph((* endblock h4 -*))
155 ((* block h4 -*))\paragraph((* endblock h4 -*))
155 ((* elif cell.level == 5 -*))
156 ((* elif cell.level == 5 -*))
156 ((* block h5 -*))\subparagraph((* endblock h5 -*))
157 ((* block h5 -*))\subparagraph((* endblock h5 -*))
157 ((* elif cell.level == 6 -*))
158 ((* elif cell.level == 6 -*))
158 ((* block h6 -*))\\*\textit((* endblock h6 -*))
159 ((* block h6 -*))\\*\textit((* endblock h6 -*))
159 ((*- endif -*))
160 ((*- endif -*))
160 {((( cell.source | escape_latex )))}
161 {((( cell.source | escape_latex )))}
161
162
162 ((* endblock headingcell *))
163 ((* endblock headingcell *))
163
164
164 % Redirect pyout to display data priority.
165 % Redirect pyout to display data priority.
165 ((* block pyout scoped *))
166 ((* block pyout scoped *))
166 ((* block data_priority scoped *))
167 ((* block data_priority scoped *))
167 ((( super() )))
168 ((( super() )))
168 ((* endblock *))
169 ((* endblock *))
169 ((* endblock pyout *))
170 ((* endblock pyout *))
170
171
171 % Render markdown
172 % Render markdown
172 ((* block markdowncell scoped *))
173 ((* block markdowncell scoped *))
173 ((( cell.source | markdown2latex )))
174 ((( cell.source | markdown2latex )))
174 ((* endblock markdowncell *))
175 ((* endblock markdowncell *))
175
176
176 % Spit out the contents of raw cells unmodified
177 % Spit out the contents of raw cells unmodified
177 ((* block rawcell scoped *))
178 ((* block rawcell scoped *))
178 ((( cell.source )))
179 ((( cell.source )))
179 ((* endblock rawcell *))
180 ((* endblock rawcell *))
180
181
181 % Don't display unknown types
182 % Don't display unknown types
182 ((* block unknowncell scoped *))
183 ((* block unknowncell scoped *))
183 ((* endblock unknowncell *))
184 ((* endblock unknowncell *))
General Comments 0
You need to be logged in to leave comments. Login now