Show More
@@ -1,450 +1,450 b'' | |||
|
1 | 1 | ((= NBConvert Sphinx-Latex Template |
|
2 | 2 | |
|
3 | 3 | Purpose: Allow export of PDF friendly Latex inspired by Sphinx. Most of the |
|
4 | 4 | template is derived directly from Sphinx source. |
|
5 | 5 | |
|
6 | 6 | Inheritance: null>display_priority |
|
7 | 7 | |
|
8 | 8 | Note: For best display, use latex syntax highlighting. =)) |
|
9 | 9 | |
|
10 | 10 | ((*- extends 'display_priority.tplx' -*)) |
|
11 | 11 | |
|
12 | 12 | %============================================================================== |
|
13 | 13 | % Declarations |
|
14 | 14 | %============================================================================== |
|
15 | 15 | |
|
16 | 16 | % In order to make sure that the input/output header follows the code it |
|
17 | 17 | % preceeds, the needspace package is used to request that a certain |
|
18 | 18 | % amount of lines (specified by this variable) are reserved. If those |
|
19 | 19 | % lines aren't available on the current page, the documenter will break |
|
20 | 20 | % to the next page and the header along with accomanying lines will be |
|
21 | 21 | % rendered together. This value specifies the number of lines that |
|
22 | 22 | % the header will be forced to group with without a page break. |
|
23 | 23 | ((*- set min_header_lines = 4 -*)) |
|
24 | 24 | |
|
25 | 25 | % This is the number of characters that are permitted per line. It's |
|
26 | 26 | % important that this limit is set so characters do not run off the |
|
27 | 27 | % edges of latex pages (since latex does not always seem smart enough |
|
28 | 28 | % to prevent this in some cases.) This is only applied to textual output |
|
29 | 29 | ((* if resources.sphinx.outputstyle == 'simple' *)) |
|
30 | 30 | ((*- set wrap_size = 85 -*)) |
|
31 | 31 | ((* elif resources.sphinx.outputstyle == 'notebook' *)) |
|
32 | 32 | ((*- set wrap_size = 70 -*)) |
|
33 | 33 | ((* endif *)) |
|
34 | 34 | |
|
35 | 35 | %============================================================================== |
|
36 | 36 | % Header |
|
37 | 37 | %============================================================================== |
|
38 | 38 | ((* block header *)) |
|
39 | 39 | |
|
40 | 40 | % Header, overrides base |
|
41 | 41 | |
|
42 | 42 | % Make sure that the sphinx doc style knows who it inherits from. |
|
43 | 43 | \def\sphinxdocclass{(((parentdocumentclass)))} |
|
44 | 44 | |
|
45 | 45 | % Declare the document class |
|
46 | 46 | \documentclass[letterpaper,10pt,english]{((( resources.sphinx.texinputs )))/sphinx(((documentclass)))} |
|
47 | 47 | |
|
48 | 48 | % Imports |
|
49 | 49 | \usepackage[utf8]{inputenc} |
|
50 | 50 | \DeclareUnicodeCharacter{00A0}{\\nobreakspace} |
|
51 | 51 | \usepackage[T1]{fontenc} |
|
52 | 52 | \usepackage{babel} |
|
53 | 53 | \usepackage{times} |
|
54 | 54 | \usepackage{import} |
|
55 | 55 | \usepackage[((( resources.sphinx.chapterstyle )))]{((( resources.sphinx.texinputs )))/fncychap} |
|
56 | 56 | \usepackage{longtable} |
|
57 | 57 | \usepackage{((( resources.sphinx.texinputs )))/sphinx} |
|
58 | 58 | \usepackage{multirow} |
|
59 | 59 | |
|
60 | 60 | \usepackage{amsmath} |
|
61 | 61 | \usepackage{amssymb} |
|
62 | 62 | \usepackage{ucs} |
|
63 | 63 | \usepackage{enumerate} |
|
64 | 64 | |
|
65 | 65 | % Used to make the Input/Output rules follow around the contents. |
|
66 | 66 | \usepackage{needspace} |
|
67 | 67 | |
|
68 | 68 | % Pygments requirements |
|
69 | 69 | \usepackage{fancyvrb} |
|
70 | 70 | \usepackage{color} |
|
71 | 71 | % ansi colors additions |
|
72 | 72 | \definecolor{darkgreen}{rgb}{.12,.54,.11} |
|
73 | 73 | \definecolor{lightgray}{gray}{.95} |
|
74 | 74 | \definecolor{brown}{rgb}{0.54,0.27,0.07} |
|
75 | 75 | \definecolor{purple}{rgb}{0.5,0.0,0.5} |
|
76 | 76 | \definecolor{darkgray}{gray}{0.25} |
|
77 | 77 | \definecolor{lightred}{rgb}{1.0,0.39,0.28} |
|
78 | 78 | \definecolor{lightgreen}{rgb}{0.48,0.99,0.0} |
|
79 | 79 | \definecolor{lightblue}{rgb}{0.53,0.81,0.92} |
|
80 | 80 | \definecolor{lightpurple}{rgb}{0.87,0.63,0.87} |
|
81 | 81 | \definecolor{lightcyan}{rgb}{0.5,1.0,0.83} |
|
82 | 82 | |
|
83 | 83 | % Needed to box output/input |
|
84 | 84 | \usepackage{tikz} |
|
85 | 85 | \usetikzlibrary{calc,arrows,shadows} |
|
86 | 86 | \usepackage[framemethod=tikz]{mdframed} |
|
87 | 87 | |
|
88 | 88 | \usepackage{alltt} |
|
89 | 89 | |
|
90 | 90 | % Used to load and display graphics |
|
91 | 91 | \usepackage{graphicx} |
|
92 | 92 | \graphicspath{ {figs/} } |
|
93 | 93 | \usepackage[Export]{adjustbox} % To resize |
|
94 | 94 | |
|
95 | 95 | |
|
96 | 96 | % For formatting output while also word wrapping. |
|
97 | 97 | \usepackage{listings} |
|
98 | 98 | \lstset{breaklines=true} |
|
99 | 99 | \lstset{basicstyle=\small\ttfamily} |
|
100 | 100 | \def\smaller{\fontsize{9.5pt}{9.5pt}\selectfont} |
|
101 | 101 | |
|
102 | 102 | %Pygments definitions |
|
103 | 103 | ((( resources.sphinx.pygment_definitions ))) |
|
104 | 104 | |
|
105 | 105 | %Set pygments styles if needed... |
|
106 | 106 | ((* if resources.sphinx.outputstyle == 'notebook' *)) |
|
107 | 107 | \definecolor{nbframe-border}{rgb}{0.867,0.867,0.867} |
|
108 | 108 | \definecolor{nbframe-bg}{rgb}{0.969,0.969,0.969} |
|
109 | 109 | \definecolor{nbframe-in-prompt}{rgb}{0.0,0.0,0.502} |
|
110 | 110 | \definecolor{nbframe-out-prompt}{rgb}{0.545,0.0,0.0} |
|
111 | 111 | |
|
112 | 112 | \newenvironment{ColorVerbatim} |
|
113 | 113 | {\begin{mdframed}[% |
|
114 | 114 | roundcorner=1.0pt, % |
|
115 | 115 | backgroundcolor=nbframe-bg, % |
|
116 | 116 | userdefinedwidth=1\linewidth, % |
|
117 | 117 | leftmargin=0.1\linewidth, % |
|
118 | 118 | innerleftmargin=0pt, % |
|
119 | 119 | innerrightmargin=0pt, % |
|
120 | 120 | linecolor=nbframe-border, % |
|
121 | 121 | linewidth=1pt, % |
|
122 | 122 | usetwoside=false, % |
|
123 | 123 | everyline=true, % |
|
124 | 124 | innerlinewidth=3pt, % |
|
125 | 125 | innerlinecolor=nbframe-bg, % |
|
126 | 126 | middlelinewidth=1pt, % |
|
127 | 127 | middlelinecolor=nbframe-bg, % |
|
128 | 128 | outerlinewidth=0.5pt, % |
|
129 | 129 | outerlinecolor=nbframe-border, % |
|
130 | 130 | needspace=0pt |
|
131 | 131 | ]} |
|
132 | 132 | {\end{mdframed}} |
|
133 | 133 | |
|
134 | 134 | \newenvironment{InvisibleVerbatim} |
|
135 | 135 | {\begin{mdframed}[leftmargin=0.1\linewidth,innerleftmargin=3pt,innerrightmargin=3pt, userdefinedwidth=1\linewidth, linewidth=0pt, linecolor=white, usetwoside=false]} |
|
136 | 136 | {\end{mdframed}} |
|
137 | 137 | |
|
138 | 138 | \renewenvironment{Verbatim}[1][\unskip] |
|
139 | 139 | {\begin{alltt}\smaller} |
|
140 | 140 | {\end{alltt}} |
|
141 | 141 | ((* endif *)) |
|
142 | 142 | |
|
143 | 143 | % Help prevent overflowing lines due to urls and other hard-to-break |
|
144 | 144 | % entities. This doesn't catch everything... |
|
145 | 145 | \sloppy |
|
146 | 146 | |
|
147 | 147 | % Document level variables |
|
148 | 148 | \title{((( resources.metadata.name | escape_tex )))} |
|
149 | 149 | \date{((( resources.sphinx.date | escape_tex )))} |
|
150 | 150 | \release{((( resources.sphinx.version | escape_tex )))} |
|
151 | 151 | \author{((( resources.sphinx.author | escape_tex )))} |
|
152 | 152 | \renewcommand{\releasename}{((( resources.sphinx.release | escape_tex )))} |
|
153 | 153 | |
|
154 | 154 | % TODO: Add option for the user to specify a logo for his/her export. |
|
155 | 155 | \newcommand{\sphinxlogo}{} |
|
156 | 156 | |
|
157 | 157 | % Make the index page of the document. |
|
158 | 158 | \makeindex |
|
159 | 159 | |
|
160 | 160 | % Import sphinx document type specifics. |
|
161 | 161 | ((* block sphinxheader *))((* endblock sphinxheader *)) |
|
162 | 162 | ((* endblock header *)) |
|
163 | 163 | |
|
164 | 164 | %============================================================================== |
|
165 | 165 | % Body |
|
166 | 166 | %============================================================================== |
|
167 | 167 | ((* block body *)) |
|
168 | 168 | ((* block bodyBegin *)) |
|
169 | 169 | % Body |
|
170 | 170 | |
|
171 | 171 | % Start of the document |
|
172 | 172 | \begin{document} |
|
173 | 173 | |
|
174 | 174 | ((* if resources.sphinx.header *)) |
|
175 | 175 | \maketitle |
|
176 | 176 | ((* endif *)) |
|
177 | 177 | |
|
178 | 178 | ((* block toc *)) |
|
179 | 179 | \tableofcontents |
|
180 | 180 | ((* endblock toc *)) |
|
181 | 181 | |
|
182 | 182 | ((* endblock bodyBegin *))((( super() )))((* block bodyEnd *)) |
|
183 | 183 | |
|
184 | 184 | \renewcommand{\indexname}{Index} |
|
185 | 185 | \printindex |
|
186 | 186 | |
|
187 | 187 | % End of document |
|
188 | 188 | \end{document} |
|
189 | 189 | ((* endblock bodyEnd *)) |
|
190 | 190 | ((* endblock body *)) |
|
191 | 191 | |
|
192 | 192 | %============================================================================== |
|
193 | 193 | % Footer |
|
194 | 194 | %============================================================================== |
|
195 | 195 | ((* block footer *)) |
|
196 | 196 | ((* endblock footer *)) |
|
197 | 197 | |
|
198 | 198 | %============================================================================== |
|
199 | 199 | % Headings |
|
200 | 200 | % |
|
201 | 201 | % Purpose: Format pynb headers as sphinx headers. Depending on the Sphinx |
|
202 | 202 | % style that is active, this will change. Thus sphinx styles will |
|
203 | 203 | % override the values here. |
|
204 | 204 | %============================================================================== |
|
205 | 205 | ((* block headingcell -*)) |
|
206 | 206 | \ |
|
207 | 207 | ((*- if cell.level == 1 -*)) |
|
208 | 208 | ((* block h1 -*))part((* endblock h1 -*)) |
|
209 | 209 | ((*- elif cell.level == 2 -*)) |
|
210 | 210 | ((* block h2 -*))chapter((* endblock h2 -*)) |
|
211 | 211 | ((*- elif cell.level == 3 -*)) |
|
212 | 212 | ((* block h3 -*))section((* endblock h3 -*)) |
|
213 | 213 | ((*- elif cell.level == 4 -*)) |
|
214 | 214 | ((* block h4 -*))subsection((* endblock h4 -*)) |
|
215 | 215 | ((*- elif cell.level == 5 -*)) |
|
216 | 216 | ((* block h5 -*))subsubsection((* endblock h5 -*)) |
|
217 | 217 | ((*- elif cell.level == 6 -*)) |
|
218 | 218 | ((* block h6 -*))paragraph((* endblock h6 -*)) |
|
219 | 219 | |
|
220 | 220 | ((= It's important to make sure that underscores (which tend to be common |
|
221 | 221 | in IPYNB file titles) do not make their way into latex. Sometimes this |
|
222 | 222 | causes latex to barf. =)) |
|
223 | 223 | ((*- endif -*)){((( cell.source | markdown2latex )))} |
|
224 | 224 | ((*- endblock headingcell *)) |
|
225 | 225 | |
|
226 | 226 | %============================================================================== |
|
227 | 227 | % Markdown |
|
228 | 228 | % |
|
229 | 229 | % Purpose: Convert markdown to latex. Here markdown2latex is explicitly |
|
230 | 230 | % called since we know we want latex output. |
|
231 | 231 | %============================================================================== |
|
232 | 232 | ((*- block markdowncell scoped-*)) |
|
233 | 233 | ((( cell.source | markdown2latex ))) |
|
234 | 234 | ((*- endblock markdowncell -*)) |
|
235 | 235 | |
|
236 | 236 | %============================================================================== |
|
237 | 237 | % Rawcell |
|
238 | 238 | % |
|
239 | 239 | % Purpose: Raw text cells allow the user to manually inject document code that |
|
240 | 240 | % will not get touched by the templating system. |
|
241 | 241 | %============================================================================== |
|
242 | 242 | ((*- block rawcell *)) |
|
243 | 243 | ((( cell.source | wrap(wrap_size) ))) |
|
244 | 244 | ((* endblock rawcell -*)) |
|
245 | 245 | |
|
246 | 246 | %============================================================================== |
|
247 | 247 | % Unknowncell |
|
248 | 248 | % |
|
249 | 249 | % Purpose: This is the catch anything unhandled. To display this data, we |
|
250 | 250 | % remove all possible latex conflicts and wrap the characters so they |
|
251 | 251 | % can't flow off of the page. |
|
252 | 252 | %============================================================================== |
|
253 | 253 | ((* block unknowncell scoped*)) |
|
254 | 254 | |
|
255 | 255 | % Unsupported cell type, no formatting |
|
256 | 256 | ((( cell.source | wrap | escape_tex ))) |
|
257 | 257 | ((* endblock unknowncell *)) |
|
258 | 258 | |
|
259 | 259 | %============================================================================== |
|
260 | 260 | % Input |
|
261 | 261 | %============================================================================== |
|
262 | 262 | ((* block input *)) |
|
263 | 263 | |
|
264 | 264 | % Make sure that atleast 4 lines are below the HR |
|
265 | 265 | \needspace{((( min_header_lines )))\baselineskip} |
|
266 | 266 | |
|
267 | 267 | ((* if resources.sphinx.outputstyle == 'simple' *)) |
|
268 | 268 | |
|
269 | 269 | % Add a horizantal break, along with break title. |
|
270 | 270 | \vspace{10pt} |
|
271 | 271 | {\scriptsize Input}\\* |
|
272 | 272 | \rule[10pt]{\linewidth}{0.5pt} |
|
273 | 273 | \vspace{-25pt} |
|
274 | 274 | |
|
275 | 275 | % Add contents below. |
|
276 | 276 | ((( cell.input | highlight ))) |
|
277 | 277 | |
|
278 | 278 | ((* elif resources.sphinx.outputstyle == 'notebook' *)) |
|
279 | 279 | \vspace{6pt} |
|
280 | 280 | ((( write_prompt("In", cell.prompt_number, "nbframe-in-prompt") ))) |
|
281 | 281 | \vspace{-2.65\baselineskip} |
|
282 | 282 | \begin{ColorVerbatim} |
|
283 | 283 | \vspace{-0.7\baselineskip} |
|
284 | 284 | ((( cell.input | highlight ))) |
|
285 | 285 | ((* if cell.input == None or cell.input == '' *)) |
|
286 | 286 | \vspace{0.3\baselineskip} |
|
287 | 287 | ((* else *)) |
|
288 | 288 | \vspace{-0.2\baselineskip} |
|
289 | 289 | ((* endif *)) |
|
290 | 290 | \end{ColorVerbatim} |
|
291 | 291 | ((* endif *)) |
|
292 | 292 | ((* endblock input *)) |
|
293 | 293 | |
|
294 | 294 | %============================================================================== |
|
295 | 295 | % Output_Group |
|
296 | 296 | % |
|
297 | 297 | % Purpose: Make sure that only one header bar only attaches to the output |
|
298 | 298 | % once. By keeping track of when an input group is started |
|
299 | 299 | %============================================================================== |
|
300 | 300 | ((* block output_group *)) |
|
301 | 301 | ((* if cell.outputs.__len__() > 0 *)) |
|
302 | 302 | |
|
303 | 303 | % If the first block is an image, minipage the image. Else |
|
304 | 304 | % request a certain amount of space for the input text. |
|
305 | 305 | ((( iff_figure(cell.outputs[0], "\\begin{minipage}{1.0\\textwidth}", "\\needspace{" ~ min_header_lines ~ "\\baselineskip}") ))) |
|
306 | 306 | |
|
307 | 307 | ((* if resources.sphinx.outputstyle == 'simple' *)) |
|
308 | 308 | |
|
309 | 309 | % Add a horizantal break, along with break title. |
|
310 | 310 | \vspace{10pt} |
|
311 | 311 | {\scriptsize Output}\\* |
|
312 | 312 | \rule[10pt]{\linewidth}{0.5pt} |
|
313 | 313 | \vspace{-20pt} |
|
314 | 314 | |
|
315 | 315 | % Add the contents of the first block. |
|
316 | 316 | ((( render_output(cell.outputs[0]) ))) |
|
317 | 317 | |
|
318 | 318 | % Close the minipage. |
|
319 | 319 | ((( iff_figure(cell.outputs[0], "\\end{minipage}", "") ))) |
|
320 | 320 | |
|
321 | 321 | % Add remainer of the document contents below. |
|
322 | 322 | ((* for output in cell.outputs[1:] *)) |
|
323 | 323 | ((( render_output(output, cell.prompt_number) ))) |
|
324 | 324 | ((* endfor *)) |
|
325 | 325 | ((* elif resources.sphinx.outputstyle == 'notebook' *)) |
|
326 | 326 | |
|
327 | 327 | % Add document contents. |
|
328 | 328 | ((* for output in cell.outputs *)) |
|
329 | 329 | ((( render_output(output, cell.prompt_number) ))) |
|
330 | 330 | ((* endfor *)) |
|
331 | 331 | ((* endif *)) |
|
332 | 332 | ((* endif *)) |
|
333 | 333 | ((* endblock *)) |
|
334 | 334 | |
|
335 | 335 | %============================================================================== |
|
336 | 336 | % Additional formating |
|
337 | 337 | %============================================================================== |
|
338 | 338 | ((* block data_text *)) |
|
339 | 339 | ((( custom_verbatim(output.text) | ansi2latex))) |
|
340 | 340 | ((* endblock *)) |
|
341 | 341 | |
|
342 | 342 | ((* block traceback_line *)) |
|
343 | 343 | ((( conditionally_center_output(line | indent| rm_ansi) ))) |
|
344 | 344 | ((* endblock traceback_line *)) |
|
345 | 345 | |
|
346 | 346 | %============================================================================== |
|
347 | 347 | % Supported image formats |
|
348 | 348 | %============================================================================== |
|
349 | 349 | ((*- block data_png -*)) |
|
350 | 350 | ((( conditionally_center_output(insert_graphics(output.png_filename)) ))) |
|
351 | 351 | ((*- endblock -*)) |
|
352 | 352 | |
|
353 | 353 | ((*- block data_jpg -*)) |
|
354 | 354 | ((( conditionally_center_output(insert_graphics(output.jpg_filename)) ))) |
|
355 | 355 | ((*- endblock -*)) |
|
356 | 356 | |
|
357 | 357 | ((*- block data_svg -*)) |
|
358 | 358 | ((( conditionally_center_output(insert_graphics(output.svg_filename)) ))) |
|
359 | 359 | ((*- endblock -*)) |
|
360 | 360 | |
|
361 | 361 | ((*- block data_pdf -*)) |
|
362 |
((( conditionally_center_output(insert_graphics(output.pdf_filename |
|
|
362 | ((( conditionally_center_output(insert_graphics(output.pdf_filename)) ))) | |
|
363 | 363 | ((*- endblock -*)) |
|
364 | 364 | |
|
365 | 365 | ((*- block data_latex *)) |
|
366 | 366 | ((* if resources.sphinx.centeroutput *))\begin{center}((* endif -*))((( output.latex | rm_math_space )))((*- if resources.sphinx.centeroutput *))\end{center} ((* endif -*)) |
|
367 | 367 | ((*- endblock -*)) |
|
368 | 368 | |
|
369 | 369 | %============================================================================== |
|
370 | 370 | % Support Macros |
|
371 | 371 | %============================================================================== |
|
372 | 372 | |
|
373 | 373 | % Name: write_prompt |
|
374 | 374 | % Purpose: Renders an output/input prompt for notebook style pdfs |
|
375 | 375 | ((* macro write_prompt(prompt, number, color) -*)) |
|
376 | 376 | \makebox[0.1\linewidth]{\smaller\hfill\tt\color{((( color )))}((( prompt )))\hspace{4pt}{[}((( number ))){]}:\hspace{4pt}}\\* |
|
377 | 377 | ((*- endmacro *)) |
|
378 | 378 | |
|
379 | 379 | % Name: render_output |
|
380 | 380 | % Purpose: Renders an output block appropriately. |
|
381 | 381 | ((* macro render_output(output, prompt_number) -*)) |
|
382 | 382 | ((*- if output.output_type == 'pyerr' -*)) |
|
383 | 383 | ((*- block pyerr scoped *)) |
|
384 | 384 | ((( custom_verbatim(super()) ))) |
|
385 | 385 | ((* endblock pyerr -*)) |
|
386 | 386 | ((*- else -*)) |
|
387 | 387 | |
|
388 | 388 | ((* if resources.sphinx.outputstyle == 'notebook' *)) |
|
389 | 389 | ((*- if output.output_type == 'pyout' -*)) |
|
390 | 390 | ((( write_prompt("Out", prompt_number, "nbframe-out-prompt") ))) |
|
391 | 391 | \vspace{-2.55\baselineskip} |
|
392 | 392 | ((*- endif -*)) |
|
393 | 393 | |
|
394 | 394 | \begin{InvisibleVerbatim} |
|
395 | 395 | \vspace{-0.5\baselineskip} |
|
396 | 396 | ((*- endif -*)) |
|
397 | 397 | |
|
398 | 398 | ((*- block display_data scoped -*)) |
|
399 | 399 | ((( super() ))) |
|
400 | 400 | ((*- endblock display_data -*)) |
|
401 | 401 | |
|
402 | 402 | ((* if resources.sphinx.outputstyle == 'notebook' *)) |
|
403 | 403 | \end{InvisibleVerbatim} |
|
404 | 404 | ((*- endif -*)) |
|
405 | 405 | ((*- endif -*)) |
|
406 | 406 | ((*- endmacro *)) |
|
407 | 407 | |
|
408 | 408 | % Name: iff_figure |
|
409 | 409 | % Purpose: If the output block provided is a figure type, the 'true_content' |
|
410 | 410 | % parameter will be returned. Else, the 'false_content'. |
|
411 | 411 | ((* macro iff_figure(output, true_content, false_content) -*)) |
|
412 | 412 | ((*- set is_figure = false -*)) |
|
413 | 413 | ((*- for type in output | filter_data_type -*)) |
|
414 | 414 | ((*- if type in ['pdf', 'svg', 'png', 'jpeg','html']*)) |
|
415 | 415 | ((*- set is_figure = true -*)) |
|
416 | 416 | ((*- endif -*)) |
|
417 | 417 | ((*- endfor -*)) |
|
418 | 418 | |
|
419 | 419 | ((* if is_figure -*)) |
|
420 | 420 | ((( true_content ))) |
|
421 | 421 | ((*- else -*)) |
|
422 | 422 | ((( false_content ))) |
|
423 | 423 | ((*- endif *)) |
|
424 | 424 | ((*- endmacro *)) |
|
425 | 425 | |
|
426 | 426 | % Name: custom_verbatim |
|
427 | 427 | % Purpose: This macro creates a verbatim style block that fits the existing |
|
428 | 428 | % sphinx style more readily than standard verbatim blocks. |
|
429 | 429 | ((* macro custom_verbatim(text) -*)) |
|
430 | 430 | \begin{alltt} |
|
431 | 431 | ((*- if resources.sphinx.centeroutput *))\begin{center} ((* endif -*)) |
|
432 | 432 | ((( text | wrap(wrap_size) ))) |
|
433 | 433 | ((*- if resources.sphinx.centeroutput *))\end{center}((* endif -*)) |
|
434 | 434 | \end{alltt} |
|
435 | 435 | ((*- endmacro *)) |
|
436 | 436 | |
|
437 | 437 | % Name: conditionally_center_output |
|
438 | 438 | % Purpose: This macro centers the output if the output centering is enabled. |
|
439 | 439 | ((* macro conditionally_center_output(text) -*)) |
|
440 | 440 | ((* if resources.sphinx.centeroutput *)){\centering ((* endif *))((( text )))((* if resources.sphinx.centeroutput *))}((* endif *)) |
|
441 | 441 | ((*- endmacro *)) |
|
442 | 442 | |
|
443 | 443 | % Name: insert_graphics |
|
444 | 444 | % Purpose: This macro will insert an image in the latex document given a path. |
|
445 | 445 | ((* macro insert_graphics(path) -*)) |
|
446 | 446 | \begin{center} |
|
447 | 447 | \includegraphics[max size={\textwidth}{\textheight}]{(((path)))} |
|
448 | 448 | \par |
|
449 | 449 | \end{center} |
|
450 | 450 | ((*- endmacro *)) |
General Comments 0
You need to be logged in to leave comments.
Login now