Show More
@@ -1,180 +1,181 | |||||
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 | \definecolor{orange}{cmyk}{0,0.4,0.8,0.2} |
|
34 | \definecolor{orange}{cmyk}{0,0.4,0.8,0.2} | |
34 | \definecolor{darkorange}{rgb}{.71,0.21,0.01} |
|
35 | \definecolor{darkorange}{rgb}{.71,0.21,0.01} | |
35 | \definecolor{darkgreen}{rgb}{.12,.54,.11} |
|
36 | \definecolor{darkgreen}{rgb}{.12,.54,.11} | |
36 | \definecolor{myteal}{rgb}{.26, .44, .56} |
|
37 | \definecolor{myteal}{rgb}{.26, .44, .56} | |
37 | \definecolor{gray}{gray}{0.45} |
|
38 | \definecolor{gray}{gray}{0.45} | |
38 | \definecolor{lightgray}{gray}{.95} |
|
39 | \definecolor{lightgray}{gray}{.95} | |
39 | \definecolor{mediumgray}{gray}{.8} |
|
40 | \definecolor{mediumgray}{gray}{.8} | |
40 | \definecolor{inputbackground}{rgb}{.95, .95, .85} |
|
41 | \definecolor{inputbackground}{rgb}{.95, .95, .85} | |
41 | \definecolor{outputbackground}{rgb}{.95, .95, .95} |
|
42 | \definecolor{outputbackground}{rgb}{.95, .95, .95} | |
42 | \definecolor{traceback}{rgb}{1, .95, .95} |
|
43 | \definecolor{traceback}{rgb}{1, .95, .95} | |
43 |
|
44 | |||
44 | % new ansi colors |
|
45 | % new ansi colors | |
45 | \definecolor{brown}{rgb}{0.54,0.27,0.07} |
|
46 | \definecolor{brown}{rgb}{0.54,0.27,0.07} | |
46 | \definecolor{purple}{rgb}{0.5,0.0,0.5} |
|
47 | \definecolor{purple}{rgb}{0.5,0.0,0.5} | |
47 | \definecolor{darkgray}{gray}{0.25} |
|
48 | \definecolor{darkgray}{gray}{0.25} | |
48 | \definecolor{lightred}{rgb}{1.0,0.39,0.28} |
|
49 | \definecolor{lightred}{rgb}{1.0,0.39,0.28} | |
49 | \definecolor{lightgreen}{rgb}{0.48,0.99,0.0} |
|
50 | \definecolor{lightgreen}{rgb}{0.48,0.99,0.0} | |
50 | \definecolor{lightblue}{rgb}{0.53,0.81,0.92} |
|
51 | \definecolor{lightblue}{rgb}{0.53,0.81,0.92} | |
51 | \definecolor{lightpurple}{rgb}{0.87,0.63,0.87} |
|
52 | \definecolor{lightpurple}{rgb}{0.87,0.63,0.87} | |
52 | \definecolor{lightcyan}{rgb}{0.5,1.0,0.83} |
|
53 | \definecolor{lightcyan}{rgb}{0.5,1.0,0.83} | |
53 |
|
54 | |||
54 | % 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 | |
55 | % exist. |
|
56 | % exist. | |
56 | \def\br{\hspace*{\fill} \\* } |
|
57 | \def\br{\hspace*{\fill} \\* } | |
57 |
|
58 | |||
58 | % Document parameters |
|
59 | % Document parameters | |
59 | ((* block title *))\title{((( resources.metadata.name | escape_latex )))}((* endblock title *)) |
|
60 | ((* block title *))\title{((( resources.metadata.name | escape_latex )))}((* endblock title *)) | |
60 | ((* block date *))((* endblock date *)) |
|
61 | ((* block date *))((* endblock date *)) | |
61 | ((* block author *))((* endblock author *)) |
|
62 | ((* block author *))((* endblock author *)) | |
62 | ((* endblock definitions *)) |
|
63 | ((* endblock definitions *)) | |
63 |
|
64 | |||
64 | ((* block commands *)) |
|
65 | ((* block commands *)) | |
65 | \sloppy % Prevent overflowing lines due to hard-to-break entities |
|
66 | \sloppy % Prevent overflowing lines due to hard-to-break entities | |
66 |
|
67 | |||
67 | % Setup hyperref package |
|
68 | % Setup hyperref package | |
68 | \hypersetup{ |
|
69 | \hypersetup{ | |
69 | breaklinks=true, % so long urls are correctly broken across lines |
|
70 | breaklinks=true, % so long urls are correctly broken across lines | |
70 | colorlinks=true, |
|
71 | colorlinks=true, | |
71 | urlcolor=blue, |
|
72 | urlcolor=blue, | |
72 | linkcolor=darkorange, |
|
73 | linkcolor=darkorange, | |
73 | citecolor=darkgreen, |
|
74 | citecolor=darkgreen, | |
74 | } |
|
75 | } | |
75 |
|
76 | |||
76 | % Slightly bigger margins than the latex defaults |
|
77 | % Slightly bigger margins than the latex defaults | |
77 | ((* block margins *)) |
|
78 | ((* block margins *)) | |
78 | \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in} |
|
79 | \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in} | |
79 | ((* endblock margins *)) |
|
80 | ((* endblock margins *)) | |
80 | ((* endblock commands *)) |
|
81 | ((* endblock commands *)) | |
81 |
|
82 | |||
82 | ((* block predoc *)) |
|
83 | ((* block predoc *)) | |
83 | ((* block maketitle *))\maketitle((* endblock maketitle *)) |
|
84 | ((* block maketitle *))\maketitle((* endblock maketitle *)) | |
84 | ((* endblock predoc *)) |
|
85 | ((* endblock predoc *)) | |
85 |
|
86 | |||
86 | %=============================================================================== |
|
87 | %=============================================================================== | |
87 | % Support blocks |
|
88 | % Support blocks | |
88 | %=============================================================================== |
|
89 | %=============================================================================== | |
89 |
|
90 | |||
90 | % Displaying simple data text |
|
91 | % Displaying simple data text | |
91 | ((* block data_text *)) |
|
92 | ((* block data_text *)) | |
92 | \begin{verbatim} |
|
93 | \begin{verbatim} | |
93 | ((( output.text ))) |
|
94 | ((( output.text ))) | |
94 | \end{verbatim} |
|
95 | \end{verbatim} | |
95 | ((* endblock data_text *)) |
|
96 | ((* endblock data_text *)) | |
96 |
|
97 | |||
97 | % Display python error text as-is |
|
98 | % Display python error text as-is | |
98 | ((* block pyerr *)) |
|
99 | ((* block pyerr *)) | |
99 | \begin{Verbatim}[commandchars=\\\{\}] |
|
100 | \begin{Verbatim}[commandchars=\\\{\}] | |
100 | ((( super() ))) |
|
101 | ((( super() ))) | |
101 | \end{Verbatim} |
|
102 | \end{Verbatim} | |
102 | ((* endblock pyerr *)) |
|
103 | ((* endblock pyerr *)) | |
103 | ((* block traceback_line *)) |
|
104 | ((* block traceback_line *)) | |
104 | ((( line | indent | strip_ansi | escape_latex ))) |
|
105 | ((( line | indent | strip_ansi | escape_latex ))) | |
105 | ((* endblock traceback_line *)) |
|
106 | ((* endblock traceback_line *)) | |
106 |
|
107 | |||
107 | % Display stream ouput with coloring |
|
108 | % Display stream ouput with coloring | |
108 | ((* block stream *)) |
|
109 | ((* block stream *)) | |
109 | \begin{Verbatim}[commandchars=\\\{\}] |
|
110 | \begin{Verbatim}[commandchars=\\\{\}] | |
110 | ((( output.text | ansi2latex ))) |
|
111 | ((( output.text | ansi2latex ))) | |
111 | \end{Verbatim} |
|
112 | \end{Verbatim} | |
112 | ((* endblock stream *)) |
|
113 | ((* endblock stream *)) | |
113 |
|
114 | |||
114 | % Display latex |
|
115 | % Display latex | |
115 | ((* block data_latex -*)) |
|
116 | ((* block data_latex -*)) | |
116 | ((*- if output.latex.startswith('$'): -*)) |
|
117 | ((*- if output.latex.startswith('$'): -*)) | |
117 | ((= Replace $ symbols with more explicit, equation block. =)) |
|
118 | ((= Replace $ symbols with more explicit, equation block. =)) | |
118 | \begin{equation*} |
|
119 | \begin{equation*} | |
119 | ((( output.latex | strip_dollars ))) |
|
120 | ((( output.latex | strip_dollars ))) | |
120 | \end{equation*} |
|
121 | \end{equation*} | |
121 | ((*- else -*)) |
|
122 | ((*- else -*)) | |
122 | ((( output.latex ))) |
|
123 | ((( output.latex ))) | |
123 | ((*- endif *)) |
|
124 | ((*- endif *)) | |
124 | ((* endblock data_latex *)) |
|
125 | ((* endblock data_latex *)) | |
125 |
|
126 | |||
126 | % Default mechanism for rendering figures |
|
127 | % Default mechanism for rendering figures | |
127 | ((*- block data_png -*))((( draw_figure(output.png_filename) )))((*- endblock -*)) |
|
128 | ((*- block data_png -*))((( draw_figure(output.png_filename) )))((*- endblock -*)) | |
128 | ((*- block data_jpg -*))((( draw_figure(output.jpeg_filename) )))((*- endblock -*)) |
|
129 | ((*- block data_jpg -*))((( draw_figure(output.jpeg_filename) )))((*- endblock -*)) | |
129 | ((*- block data_svg -*))((( draw_figure(output.svg_filename) )))((*- endblock -*)) |
|
130 | ((*- block data_svg -*))((( draw_figure(output.svg_filename) )))((*- endblock -*)) | |
130 | ((*- block data_pdf -*))((( draw_figure(output.pdf_filename) )))((*- endblock -*)) |
|
131 | ((*- block data_pdf -*))((( draw_figure(output.pdf_filename) )))((*- endblock -*)) | |
131 |
|
132 | |||
132 | % Draw a figure using the graphicx package. |
|
133 | % Draw a figure using the graphicx package. | |
133 | ((* macro draw_figure(filename) -*)) |
|
134 | ((* macro draw_figure(filename) -*)) | |
134 | ((* set filename = filename | posix_path *)) |
|
135 | ((* set filename = filename | posix_path *)) | |
135 | ((*- block figure scoped -*)) |
|
136 | ((*- block figure scoped -*)) | |
136 | \begin{center} |
|
137 | \begin{center} | |
137 | \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{((( filename )))} |
|
138 | \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{((( filename )))} | |
138 | \end{center} |
|
139 | \end{center} | |
139 | { \hspace*{\fill} \\} |
|
140 | { \hspace*{\fill} \\} | |
140 | ((*- endblock figure -*)) |
|
141 | ((*- endblock figure -*)) | |
141 | ((*- endmacro *)) |
|
142 | ((*- endmacro *)) | |
142 |
|
143 | |||
143 | % Draw heading cell. Explicitly map different cell levels. |
|
144 | % Draw heading cell. Explicitly map different cell levels. | |
144 | ((* block headingcell scoped -*)) |
|
145 | ((* block headingcell scoped -*)) | |
145 | ((*- if cell.level == 1 -*)) |
|
146 | ((*- if cell.level == 1 -*)) | |
146 | ((* block h1 -*))\section((* endblock h1 -*)) |
|
147 | ((* block h1 -*))\section((* endblock h1 -*)) | |
147 | ((*- elif cell.level == 2 -*)) |
|
148 | ((*- elif cell.level == 2 -*)) | |
148 | ((* block h2 -*))\subsection((* endblock h2 -*)) |
|
149 | ((* block h2 -*))\subsection((* endblock h2 -*)) | |
149 | ((*- elif cell.level == 3 -*)) |
|
150 | ((*- elif cell.level == 3 -*)) | |
150 | ((* block h3 -*))\subsubsection((* endblock h3 -*)) |
|
151 | ((* block h3 -*))\subsubsection((* endblock h3 -*)) | |
151 | ((*- elif cell.level == 4 -*)) |
|
152 | ((*- elif cell.level == 4 -*)) | |
152 | ((* block h4 -*))\paragraph((* endblock h4 -*)) |
|
153 | ((* block h4 -*))\paragraph((* endblock h4 -*)) | |
153 | ((*- elif cell.level == 5 -*)) |
|
154 | ((*- elif cell.level == 5 -*)) | |
154 | ((* block h5 -*))\subparagraph((* endblock h5 -*)) |
|
155 | ((* block h5 -*))\subparagraph((* endblock h5 -*)) | |
155 | ((*- elif cell.level == 6 -*)) |
|
156 | ((*- elif cell.level == 6 -*)) | |
156 | ((* block h6 -*))\\*\textit((* endblock h6 -*)) |
|
157 | ((* block h6 -*))\\*\textit((* endblock h6 -*)) | |
157 | ((*- endif -*)) |
|
158 | ((*- endif -*)) | |
158 | {((( cell.source | escape_latex )))} |
|
159 | {((( cell.source | escape_latex )))} | |
159 | ((*- endblock headingcell *)) |
|
160 | ((*- endblock headingcell *)) | |
160 |
|
161 | |||
161 | % Redirect pyout to display data priority. |
|
162 | % Redirect pyout to display data priority. | |
162 | ((* block pyout scoped *)) |
|
163 | ((* block pyout scoped *)) | |
163 | ((* block data_priority scoped *)) |
|
164 | ((* block data_priority scoped *)) | |
164 | ((( super() ))) |
|
165 | ((( super() ))) | |
165 | ((* endblock *)) |
|
166 | ((* endblock *)) | |
166 | ((* endblock pyout *)) |
|
167 | ((* endblock pyout *)) | |
167 |
|
168 | |||
168 | % Render markdown |
|
169 | % Render markdown | |
169 | ((* block markdowncell scoped *)) |
|
170 | ((* block markdowncell scoped *)) | |
170 | ((( cell.source | markdown2latex ))) |
|
171 | ((( cell.source | markdown2latex ))) | |
171 | ((* endblock markdowncell *)) |
|
172 | ((* endblock markdowncell *)) | |
172 |
|
173 | |||
173 | % Spit out the contents of raw cells unmodified |
|
174 | % Spit out the contents of raw cells unmodified | |
174 | ((* block rawcell scoped *)) |
|
175 | ((* block rawcell scoped *)) | |
175 | ((( cell.source ))) |
|
176 | ((( cell.source ))) | |
176 | ((* endblock rawcell *)) |
|
177 | ((* endblock rawcell *)) | |
177 |
|
178 | |||
178 | % Don't display unknown types |
|
179 | % Don't display unknown types | |
179 | ((* block unknowncell scoped *)) |
|
180 | ((* block unknowncell scoped *)) | |
180 | ((* endblock unknowncell *)) |
|
181 | ((* endblock unknowncell *)) |
General Comments 0
You need to be logged in to leave comments.
Login now