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