Show More
@@ -1,309 +1,309 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, we have to use a minipage environment. This causes problems |
|
17 | % preceeds, we have to use a minipage environment. This causes problems | |
18 | % for large blocks of input and output. If there is a large input/output |
|
18 | % for large blocks of input and output. If there is a large input/output | |
19 | % block, we don't want to minipage the whole thing since it will break |
|
19 | % block, we don't want to minipage the whole thing since it will break | |
20 | % the line wrapping. The solution is to split the input/output line by |
|
20 | % the line wrapping. The solution is to split the input/output line by | |
21 | % line before we minipage which allows us to minipage the first X lines |
|
21 | % line before we minipage which allows us to minipage the first X lines | |
22 | % preceeding the input/output bar. That way, a select amount of lines |
|
22 | % preceeding the input/output bar. That way, a select amount of lines | |
23 | % force the input/output bar to follow it around. |
|
23 | % force the input/output bar to follow it around. | |
24 | ((*- set min_header_lines = 3 -*)) |
|
24 | ((*- set min_header_lines = 3 -*)) | |
25 |
|
25 | |||
26 | % This is the number of characters that are permitted per line. It's |
|
26 | % This is the number of characters that are permitted per line. It's | |
27 | % important that this limit is set so characters do not run off the |
|
27 | % important that this limit is set so characters do not run off the | |
28 | % edges of latex pages (since latex does not always seem smart enough |
|
28 | % edges of latex pages (since latex does not always seem smart enough | |
29 | % to prevent this.) |
|
29 | % to prevent this.) | |
30 | ((*- set wrap_size = 87 -*)) |
|
30 | ((*- set wrap_size = 87 -*)) | |
31 |
|
31 | |||
32 | %============================================================================== |
|
32 | %============================================================================== | |
33 | % Header |
|
33 | % Header | |
34 | %============================================================================== |
|
34 | %============================================================================== | |
35 | ((* block header *)) |
|
35 | ((* block header *)) | |
36 |
|
36 | |||
37 | % Header, overrides base |
|
37 | % Header, overrides base | |
38 |
|
38 | |||
39 | % Make sure that the sphinx doc style knows who it inherits from. |
|
39 | % Make sure that the sphinx doc style knows who it inherits from. | |
40 | \def\sphinxdocclass{(((parentdocumentclass)))} |
|
40 | \def\sphinxdocclass{(((parentdocumentclass)))} | |
41 |
|
41 | |||
42 | % Declare the document class |
|
42 | % Declare the document class | |
43 | \documentclass[letterpaper,10pt,english]{((( resources.sphinx_texinputs )))/sphinx(((documentclass)))} |
|
43 | \documentclass[letterpaper,10pt,english]{((( resources.sphinx_texinputs )))/sphinx(((documentclass)))} | |
44 |
|
44 | |||
45 | % Imports |
|
45 | % Imports | |
46 | \usepackage[utf8]{inputenc} |
|
46 | \usepackage[utf8]{inputenc} | |
47 | \DeclareUnicodeCharacter{00A0}{\\nobreakspace} |
|
47 | \DeclareUnicodeCharacter{00A0}{\\nobreakspace} | |
48 | \usepackage[T1]{fontenc} |
|
48 | \usepackage[T1]{fontenc} | |
49 | \usepackage{babel} |
|
49 | \usepackage{babel} | |
50 | \usepackage{times} |
|
50 | \usepackage{times} | |
51 | \usepackage{import} |
|
51 | \usepackage{import} | |
52 | \usepackage[((( resources.sphinx_chapterstyle )))]{((( resources.sphinx_texinputs )))/fncychap} |
|
52 | \usepackage[((( resources.sphinx_chapterstyle )))]{((( resources.sphinx_texinputs )))/fncychap} | |
53 | \usepackage{longtable} |
|
53 | \usepackage{longtable} | |
54 | \usepackage{((( resources.sphinx_texinputs )))/sphinx} |
|
54 | \usepackage{((( resources.sphinx_texinputs )))/sphinx} | |
55 | \usepackage{multirow} |
|
55 | \usepackage{multirow} | |
56 |
|
56 | |||
57 | \usepackage{amsmath} |
|
57 | \usepackage{amsmath} | |
58 | \usepackage{amssymb} |
|
58 | \usepackage{amssymb} | |
59 | \usepackage{ucs} |
|
59 | \usepackage{ucs} | |
60 | \usepackage{enumerate} |
|
60 | \usepackage{enumerate} | |
61 |
|
61 | |||
|
62 | % Used to make the Input/Output rules follow around the contents. | |||
|
63 | \usepackage{needspace} | |||
|
64 | ||||
62 | % Pygments requirements |
|
65 | % Pygments requirements | |
63 | \usepackage{fancyvrb} |
|
66 | \usepackage{fancyvrb} | |
64 | \usepackage{color} |
|
67 | \usepackage{color} | |
65 |
|
68 | |||
66 | % Used to load and display graphics |
|
69 | % Used to load and display graphics | |
67 | \usepackage{graphicx} |
|
70 | \usepackage{graphicx} | |
68 | \graphicspath{ {figs/} } |
|
71 | \graphicspath{ {figs/} } | |
69 |
|
72 | |||
70 | % For formatting output while also word wrapping. |
|
73 | % For formatting output while also word wrapping. | |
71 | \usepackage{listings} |
|
74 | \usepackage{listings} | |
72 | \lstset{breaklines=true} |
|
75 | \lstset{breaklines=true} | |
73 | \lstset{basicstyle=\small\ttfamily} |
|
76 | \lstset{basicstyle=\small\ttfamily} | |
74 |
|
77 | |||
75 | %Pygments definitions |
|
78 | %Pygments definitions | |
76 | ((( resources.pygment_definitions ))) |
|
79 | ((( resources.pygment_definitions ))) | |
77 |
|
80 | |||
78 | % Help prevent overflowing lines due to urls and other hard-to-break |
|
81 | % Help prevent overflowing lines due to urls and other hard-to-break | |
79 | % entities. This doesn't catch everything... |
|
82 | % entities. This doesn't catch everything... | |
80 | \sloppy |
|
83 | \sloppy | |
81 |
|
84 | |||
82 | % Document level variables |
|
85 | % Document level variables | |
83 | \title{((( nb.metadata.name | escape_tex )))} |
|
86 | \title{((( nb.metadata.name | escape_tex )))} | |
84 | \date{((( nb.metadata._draft.date | escape_tex )))} |
|
87 | \date{((( nb.metadata._draft.date | escape_tex )))} | |
85 | \release{((( nb.metadata._draft.version | escape_tex )))} |
|
88 | \release{((( nb.metadata._draft.version | escape_tex )))} | |
86 | \author{((( nb.metadata._draft.author | escape_tex )))} |
|
89 | \author{((( nb.metadata._draft.author | escape_tex )))} | |
87 | \renewcommand{\releasename}{((( nb.metadata._draft.release | escape_tex )))} |
|
90 | \renewcommand{\releasename}{((( nb.metadata._draft.release | escape_tex )))} | |
88 |
|
91 | |||
89 | % TODO: Add option for the user to specify a logo for his/her export. |
|
92 | % TODO: Add option for the user to specify a logo for his/her export. | |
90 | \newcommand{\sphinxlogo}{} |
|
93 | \newcommand{\sphinxlogo}{} | |
91 |
|
94 | |||
92 | % Make the index page of the document. |
|
95 | % Make the index page of the document. | |
93 | \makeindex |
|
96 | \makeindex | |
94 |
|
97 | |||
95 | % Import sphinx document type specifics. |
|
98 | % Import sphinx document type specifics. | |
96 | ((* block sphinxheader *))((* endblock sphinxheader *)) |
|
99 | ((* block sphinxheader *))((* endblock sphinxheader *)) | |
97 | ((* endblock header *)) |
|
100 | ((* endblock header *)) | |
98 |
|
101 | |||
99 | %============================================================================== |
|
102 | %============================================================================== | |
100 | % Body |
|
103 | % Body | |
101 | %============================================================================== |
|
104 | %============================================================================== | |
102 | ((* block body *)) |
|
105 | ((* block body *)) | |
103 | ((* block bodyBegin *)) |
|
106 | ((* block bodyBegin *)) | |
104 | % Body |
|
107 | % Body | |
105 |
|
108 | |||
106 | % Start of the document |
|
109 | % Start of the document | |
107 | \begin{document} |
|
110 | \begin{document} | |
108 | \maketitle |
|
111 | \maketitle | |
109 | \tableofcontents |
|
112 | \tableofcontents | |
110 |
|
113 | |||
111 | ((* endblock bodyBegin *))((( super() )))((* block bodyEnd *)) |
|
114 | ((* endblock bodyBegin *))((( super() )))((* block bodyEnd *)) | |
112 |
|
115 | |||
113 | \renewcommand{\indexname}{Index} |
|
116 | \renewcommand{\indexname}{Index} | |
114 | \printindex |
|
117 | \printindex | |
115 |
|
118 | |||
116 | % End of document |
|
119 | % End of document | |
117 | \end{document} |
|
120 | \end{document} | |
118 | ((* endblock bodyEnd *)) |
|
121 | ((* endblock bodyEnd *)) | |
119 | ((* endblock body *)) |
|
122 | ((* endblock body *)) | |
120 |
|
123 | |||
121 | %============================================================================== |
|
124 | %============================================================================== | |
122 | % Footer |
|
125 | % Footer | |
123 | %============================================================================== |
|
126 | %============================================================================== | |
124 | ((* block footer *)) |
|
127 | ((* block footer *)) | |
125 | ((* endblock footer *)) |
|
128 | ((* endblock footer *)) | |
126 |
|
129 | |||
127 | %============================================================================== |
|
130 | %============================================================================== | |
128 | % Headings |
|
131 | % Headings | |
129 | % |
|
132 | % | |
130 | % Purpose: Format pynb headers as sphinx headers. Depending on the Sphinx |
|
133 | % Purpose: Format pynb headers as sphinx headers. Depending on the Sphinx | |
131 | % style that is active, this will change. Thus sphinx styles will |
|
134 | % style that is active, this will change. Thus sphinx styles will | |
132 | % override the values here. |
|
135 | % override the values here. | |
133 | %============================================================================== |
|
136 | %============================================================================== | |
134 | ((* block headingcell -*)) |
|
137 | ((* block headingcell -*)) | |
135 | \ ((= This backslash IS significant, do not delete =)) |
|
138 | \ | |
136 | ((*- if cell.level == 1 -*)) |
|
139 | ((*- if cell.level == 1 -*)) | |
137 | ((* block h1 -*))part((* endblock h1 -*)) |
|
140 | ((* block h1 -*))part((* endblock h1 -*)) | |
138 | ((*- elif cell.level == 2 -*)) |
|
141 | ((*- elif cell.level == 2 -*)) | |
139 | ((* block h2 -*))chapter((* endblock h2 -*)) |
|
142 | ((* block h2 -*))chapter((* endblock h2 -*)) | |
140 | ((*- elif cell.level == 3 -*)) |
|
143 | ((*- elif cell.level == 3 -*)) | |
141 | ((* block h3 -*))section((* endblock h3 -*)) |
|
144 | ((* block h3 -*))section((* endblock h3 -*)) | |
142 | ((*- elif cell.level == 4 -*)) |
|
145 | ((*- elif cell.level == 4 -*)) | |
143 | ((* block h4 -*))subsection((* endblock h4 -*)) |
|
146 | ((* block h4 -*))subsection((* endblock h4 -*)) | |
144 | ((*- elif cell.level == 5 -*)) |
|
147 | ((*- elif cell.level == 5 -*)) | |
145 | ((* block h5 -*))subsubsection((* endblock h5 -*)) |
|
148 | ((* block h5 -*))subsubsection((* endblock h5 -*)) | |
146 | ((*- elif cell.level == 6 -*)) |
|
149 | ((*- elif cell.level == 6 -*)) | |
147 | ((* block h6 -*))paragraph((* endblock h6 -*)) |
|
150 | ((* block h6 -*))paragraph((* endblock h6 -*)) | |
148 |
|
151 | |||
149 | ((= It's important to make sure that underscores (which tend to be common |
|
152 | ((= It's important to make sure that underscores (which tend to be common | |
150 | in IPYNB file titles) do not make their way into latex. Sometimes this |
|
153 | in IPYNB file titles) do not make their way into latex. Sometimes this | |
151 | causes latex to barf. =)) |
|
154 | causes latex to barf. =)) | |
152 |
((*- endif -*)){((( escape |
|
155 | ((*- endif -*)){((( escape_underscores(cell.source | markdown2latex ) )))} | |
153 | ((*- endblock headingcell *)) |
|
156 | ((*- endblock headingcell *)) | |
154 |
|
157 | |||
155 | %============================================================================== |
|
158 | %============================================================================== | |
156 | % Markdown |
|
159 | % Markdown | |
157 | % |
|
160 | % | |
158 | % Purpose: Convert markdown to latex. Here markdown2latex is explicitly |
|
161 | % Purpose: Convert markdown to latex. Here markdown2latex is explicitly | |
159 | % called since we know we want latex output. |
|
162 | % called since we know we want latex output. | |
160 | %============================================================================== |
|
163 | %============================================================================== | |
161 | ((*- block markdowncell scoped-*)) |
|
164 | ((*- block markdowncell scoped-*)) | |
162 | ((( cell.source | markdown2latex ))) |
|
165 | ((( cell.source | markdown2latex ))) | |
163 | ((*- endblock markdowncell -*)) |
|
166 | ((*- endblock markdowncell -*)) | |
164 |
|
167 | |||
165 | %============================================================================== |
|
168 | %============================================================================== | |
166 | % Rawcell |
|
169 | % Rawcell | |
167 | % |
|
170 | % | |
168 | % Purpose: Raw text cells allow the user to manually inject document code that |
|
171 | % Purpose: Raw text cells allow the user to manually inject document code that | |
169 | % will not get touched by the templating system. |
|
172 | % will not get touched by the templating system. | |
170 | %============================================================================== |
|
173 | %============================================================================== | |
171 | ((*- block rawcell *)) |
|
174 | ((*- block rawcell *)) | |
172 | ((( cell.source | wrap(wrap_size) ))) |
|
175 | ((( cell.source | wrap(wrap_size) ))) | |
173 | ((* endblock rawcell -*)) |
|
176 | ((* endblock rawcell -*)) | |
174 |
|
177 | |||
175 | %============================================================================== |
|
178 | %============================================================================== | |
176 | % Unknowncell |
|
179 | % Unknowncell | |
177 | % |
|
180 | % | |
178 | % Purpose: This is the catch anything unhandled. To display this data, we |
|
181 | % Purpose: This is the catch anything unhandled. To display this data, we | |
179 | % remove all possible latex conflicts and wrap the characters so they |
|
182 | % remove all possible latex conflicts and wrap the characters so they | |
180 | % can't flow off of the page. |
|
183 | % can't flow off of the page. | |
181 | %============================================================================== |
|
184 | %============================================================================== | |
182 | ((* block unknowncell scoped*)) |
|
185 | ((* block unknowncell scoped*)) | |
183 |
|
186 | |||
184 | % Unsupported cell type, no formatting |
|
187 | % Unsupported cell type, no formatting | |
185 | ((( cell.source | wrap | escape_tex ))) |
|
188 | ((( cell.source | wrap | escape_tex ))) | |
186 | ((* endblock unknowncell *)) |
|
189 | ((* endblock unknowncell *)) | |
187 |
|
190 | |||
188 | %============================================================================== |
|
191 | %============================================================================== | |
189 | % Input |
|
192 | % Input | |
190 | %============================================================================== |
|
193 | %============================================================================== | |
191 | ((* block input *)) |
|
194 | ((* block input *)) | |
192 |
|
195 | |||
193 | ((= Global variable used to determine whether or not a header bar has been |
|
196 | % Make sure that atleast 4 lines are below the HR | |
194 | applied to the group of output blocks already. We still need to set |
|
197 | \needspace{4\baselineskip} | |
195 | it to true to make sure that the block bar gets rendered.=)) |
|
198 | ||
196 | ((*- set needs_header = true -*)) |
|
199 | % Add a horizantal break, along with break title. | |
|
200 | \vspace{10pt} | |||
|
201 | {\scriptsize Input}\\* | |||
|
202 | \rule[10pt]{\linewidth}{0.5pt} | |||
|
203 | \vspace{-25pt} | |||
197 |
|
204 | |||
198 | ((* set text_begining = cell.input | wrap(wrap_size) | get_lines(end=min_header_lines) | highlight *)) |
|
205 | % Add contents below. | |
199 | ((* set text_remainer = cell.input | wrap(wrap_size) | get_lines(start=min_header_lines) | highlight *)) |
|
206 | ((( cell.input | highlight ))) | |
200 | ((( inputBlock(text_begining, text_remainer) ))) |
|
|||
201 | ((* endblock input *)) |
|
207 | ((* endblock input *)) | |
202 |
|
208 | |||
203 | %============================================================================== |
|
209 | %============================================================================== | |
204 | % Output_Group |
|
210 | % Output_Group | |
205 | % |
|
211 | % | |
206 | % Purpose: Make sure that only one header bar only attaches to the output |
|
212 | % Purpose: Make sure that only one header bar only attaches to the output | |
207 | % once. By keeping track of when an input group is started |
|
213 | % once. By keeping track of when an input group is started | |
208 | %============================================================================== |
|
214 | %============================================================================== | |
209 |
((* |
|
215 | ((* block output_group *)) | |
210 |
|
216 | |||
211 | ((= Global variable used to determine whether or not a header bar has been |
|
217 | % If the first block is an image, minipage the image. Else | |
212 | applied to the group of output blocks already. =)) |
|
218 | % request a certain amount of space for the input text. | |
213 | ((*- set needs_header = true -*)) |
|
219 | ((* if cell.outputs[0].output_type in ['display_data'] -*)) | |
214 |
|
220 | \begin{minipage}{1.0\textwidth} | ||
215 |
(( |
|
221 | ((*- else -*)) | |
|
222 | \needspace{4\baselineskip} | |||
|
223 | ((*- endif *)) | |||
|
224 | ||||
|
225 | % Add a horizantal break, along with break title. | |||
|
226 | \vspace{10pt} | |||
|
227 | {\scriptsize Output}\\* | |||
|
228 | \rule[10pt]{\linewidth}{0.5pt} | |||
|
229 | \vspace{-20pt} | |||
|
230 | ||||
|
231 | % Add the contents of the first block. | |||
|
232 | ((( render_output(cell.outputs[0]) ))) | |||
|
233 | ||||
|
234 | % Close the minipage. | |||
|
235 | ((* if cell.outputs[0].output_type in ['display_data'] -*)) | |||
|
236 | \end{minipage} | |||
|
237 | ((*- endif *)) | |||
|
238 | ||||
|
239 | % Add remainer of the document contents below. | |||
|
240 | ((* for output in cell.outputs[1:] *)) | |||
|
241 | ((( render_output(output) ))) | |||
|
242 | ((* endfor *)) | |||
216 | ((* endblock *)) |
|
243 | ((* endblock *)) | |
217 |
|
244 | |||
218 | %============================================================================== |
|
245 | %============================================================================== | |
219 | % Output types |
|
|||
220 | %============================================================================== |
|
|||
221 | ((* block pyout *)) |
|
|||
222 | ((* block data_priority scoped -*)) |
|
|||
223 | ((( inputBlock(super(),"") ))) |
|
|||
224 | ((*- endblock *)) |
|
|||
225 | ((* endblock pyout *)) |
|
|||
226 |
|
||||
227 | ((* block stream *)) |
|
|||
228 | ((* set text_begining = output.text | wrap(wrap_size) | get_lines(end=min_header_lines) *)) |
|
|||
229 | ((* set text_remainer = output.text | wrap(wrap_size) | get_lines(start=min_header_lines) *)) |
|
|||
230 | ((( inputBlock(customVerbatim(text_begining), customVerbatim(text_remainer)) ))) |
|
|||
231 | ((* endblock stream *)) |
|
|||
232 |
|
||||
233 | ((*- block display_data -*)) |
|
|||
234 | ((( inputBlock(super(), "") ))) |
|
|||
235 | ((*- endblock display_data -*)) |
|
|||
236 |
|
||||
237 | ((* block pyerr *)) |
|
|||
238 | ((* set text_begining = super() | wrap(wrap_size) | get_lines(end=min_header_lines) *)) |
|
|||
239 | ((* set text_remainer = super() | wrap(wrap_size) | get_lines(start=min_header_lines) *)) |
|
|||
240 | ((( inputBlock(customVerbatim(text_begining), customVerbatim(text_remainer)) ))) |
|
|||
241 | ((* endblock pyerr *)) |
|
|||
242 |
|
||||
243 | %============================================================================== |
|
|||
244 | % Additional formating |
|
246 | % Additional formating | |
245 | %============================================================================== |
|
247 | %============================================================================== | |
246 | ((* block data_text *)) |
|
248 | ((* block data_text *)) | |
247 |
((( custom |
|
249 | ((( custom_verbatim(output.text) ))) | |
248 | ((* endblock *)) |
|
250 | ((* endblock *)) | |
249 |
|
251 | |||
250 | ((* block traceback_line *)) |
|
252 | ((* block traceback_line *)) | |
251 |
((( line | |
|
253 | ((( line | indent| rm_ansi ))) | |
252 | ((* endblock traceback_line *)) |
|
254 | ((* endblock traceback_line *)) | |
253 |
|
255 | |||
254 | %============================================================================== |
|
256 | %============================================================================== | |
255 | % Supported image formats |
|
257 | % Supported image formats | |
256 | %============================================================================== |
|
258 | %============================================================================== | |
257 | ((*- block data_png -*)) |
|
259 | ((*- block data_png -*)) | |
258 |
((( insert |
|
260 | ((( insert_graphics(output.key_png) ))) | |
259 | ((*- endblock -*)) |
|
261 | ((*- endblock -*)) | |
260 |
|
262 | |||
261 | ((*- block data_svg -*)) |
|
263 | ((*- block data_svg -*)) | |
262 |
((( insert |
|
264 | ((( insert_graphics(output.key_svg) ))) | |
263 | ((*- endblock -*)) |
|
265 | ((*- endblock -*)) | |
264 |
|
266 | |||
265 | %============================================================================== |
|
267 | %============================================================================== | |
266 | % Support Macros |
|
268 | % Support Macros | |
267 | %============================================================================== |
|
269 | %============================================================================== | |
268 | ((* macro outputBlock(text_begining, text_remainer) -*)) |
|
270 | ((* macro render_output(output) -*)) | |
269 | ((( nbconvertBlock("Output", text_begining, text_remainer) ))) |
|
271 | ((*- if output.output_type in ['pyout'] -*)) | |
|
272 | ((*- block pyout scoped -*)) | |||
|
273 | ((( custom_verbatim(super()) ))) | |||
|
274 | ((*- endblock pyout -*)) | |||
|
275 | ((*- elif output.output_type in ['stream'] -*)) | |||
|
276 | ((*- block stream scoped -*)) | |||
|
277 | ((( custom_verbatim(output.text) ))) | |||
|
278 | ((*- endblock stream -*)) | |||
|
279 | ((*- elif output.output_type in ['display_data'] -*)) | |||
|
280 | ((*- block display_data scoped -*)) | |||
|
281 | ((( super() ))) | |||
|
282 | ((*- endblock display_data -*)) | |||
|
283 | ((*- elif output.output_type in ['pyerr'] -*)) | |||
|
284 | ((*- block pyerr scoped -*)) | |||
|
285 | ((( custom_verbatim(super()) ))) | |||
|
286 | ((*- endblock pyerr -*)) | |||
|
287 | ((*- endif -*)) | |||
270 | ((*- endmacro *)) |
|
288 | ((*- endmacro *)) | |
271 |
|
289 | |||
272 | ((* macro inputBlock(text_begining, text_remainer) -*)) |
|
290 | ((* macro custom_verbatim(text) -*)) | |
273 | ((( nbconvertBlock("Input", text_begining, text_remainer) ))) |
|
291 | \lstset{postbreak=\space, breakindent=5pt, escapebegin = \\, breaklines} | |
274 | ((*- endmacro *)) |
|
|||
275 |
|
||||
276 | ((* macro nbconvertBlock(blockTitle, text_begining, text_remainer) -*)) |
|
|||
277 | ((*- if needs_header -*)) |
|
|||
278 | \vspace{10pt} |
|
|||
279 | \begin{minipage}{\textwidth} |
|
|||
280 | {\scriptsize (((blockTitle)))}\\* |
|
|||
281 | \rule[10pt]{\linewidth}{0.5pt} |
|
|||
282 | \vspace{-25pt} |
|
|||
283 | ((( text_begining ))) |
|
|||
284 | \end{minipage}((( text_remainer ))) |
|
|||
285 | ((*- set needs_header = false -*)) |
|
|||
286 | ((*- else -*)) |
|
|||
287 | ((( text_begining ))) |
|
|||
288 | ((( text_remainer ))) |
|
|||
289 | ((*- endif -*)) |
|
|||
290 | ((*- endmacro *)) |
|
|||
291 |
|
292 | |||
292 | ((* macro customVerbatim(text) -*)) |
|
|||
293 | \begin{lstlisting} |
|
293 | \begin{lstlisting} | |
294 | ((( text ))) |
|
294 | ((( text ))) | |
295 | \end{lstlisting} |
|
295 | \end{lstlisting} | |
296 | ((*- endmacro *)) |
|
296 | ((*- endmacro *)) | |
297 |
|
297 | |||
298 |
((* macro insert |
|
298 | ((* macro insert_graphics(path) -*)) | |
299 | \begin{center} |
|
299 | \begin{center} | |
300 | \includegraphics[width=0.7\textwidth]{(((path)))} |
|
300 | \includegraphics[width=0.7\textwidth]{(((path)))} | |
301 | \par |
|
301 | \par | |
302 | \end{center} |
|
302 | \end{center} | |
303 | ((*- endmacro *)) |
|
303 | ((*- endmacro *)) | |
304 |
|
304 | |||
305 |
((* macro escape |
|
305 | ((* macro escape_underscores(text) -*)) | |
306 | ((*- set text = text|replace("_","\\_") -*)) |
|
306 | ((*- set text = text|replace("_","\\_") -*)) | |
307 | ((( text ))) |
|
307 | ((( text ))) | |
308 | ((*- endmacro *)) |
|
308 | ((*- endmacro *)) | |
309 |
|
309 |
General Comments 0
You need to be logged in to leave comments.
Login now