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