Show More
@@ -34,6 +34,7 b' class ConverterLaTeX(Converter):' | |||||
34 | extension = 'tex' |
|
34 | extension = 'tex' | |
35 | documentclass = 'article' |
|
35 | documentclass = 'article' | |
36 | documentclass_options = '11pt,english' |
|
36 | documentclass_options = '11pt,english' | |
|
37 | equation_env = 'equation*' | |||
37 | heading_map = {1: r'\section', |
|
38 | heading_map = {1: r'\section', | |
38 | 2: r'\subsection', |
|
39 | 2: r'\subsection', | |
39 | 3: r'\subsubsection', |
|
40 | 3: r'\subsubsection', | |
@@ -71,7 +72,7 b' class ConverterLaTeX(Converter):' | |||||
71 | # tex file. |
|
72 | # tex file. | |
72 |
|
73 | |||
73 | # Tag the document at the top and set latex class |
|
74 | # Tag the document at the top and set latex class | |
74 |
final = [r'%% This file was auto-generated by IPython |
|
75 | final = [r'%% This file was auto-generated by IPython.', | |
75 | r'%% Conversion from the original notebook file:', |
|
76 | r'%% Conversion from the original notebook file:', | |
76 | r'%% {0}'.format(self.infile), |
|
77 | r'%% {0}'.format(self.infile), | |
77 | r'%%', |
|
78 | r'%%', | |
@@ -133,8 +134,10 b' class ConverterLaTeX(Converter):' | |||||
133 | return lines |
|
134 | return lines | |
134 |
|
135 | |||
135 | def _img_lines(self, img_file): |
|
136 | def _img_lines(self, img_file): | |
136 | return self.in_env('center', |
|
137 | rel_img_position = os.path.relpath(img_file, self.infile_dir) | |
137 | [r'\includegraphics[width=0.7\textwidth]{%s}' % os.path.relpath(img_file, self.infile_dir), r'\par']) |
|
138 | return self.in_env('center', | |
|
139 | [r'\includegraphics[width=0.7\textwidth]{%s}' % rel_img_position, | |||
|
140 | r'\par']) | |||
138 |
|
141 | |||
139 | def _svg_lines(self, img_file): |
|
142 | def _svg_lines(self, img_file): | |
140 | base_file = os.path.splitext(img_file)[0] |
|
143 | base_file = os.path.splitext(img_file)[0] | |
@@ -151,8 +154,8 b' class ConverterLaTeX(Converter):' | |||||
151 |
|
154 | |||
152 | # output is a dictionary like object with type as a key |
|
155 | # output is a dictionary like object with type as a key | |
153 | if 'latex' in output: |
|
156 | if 'latex' in output: | |
154 |
lines.extend(self.in_env( |
|
157 | lines.extend(self.in_env(self.equation_env, | |
155 |
|
158 | output.latex.lstrip('$$').rstrip('$$'))) | ||
156 | #use text only if no latex representation is available |
|
159 | #use text only if no latex representation is available | |
157 | elif 'text' in output: |
|
160 | elif 'text' in output: | |
158 | lines.extend(self.in_env('verbatim', output.text)) |
|
161 | lines.extend(self.in_env('verbatim', output.text)) | |
@@ -182,7 +185,8 b' class ConverterLaTeX(Converter):' | |||||
182 | return [] |
|
185 | return [] | |
183 |
|
186 | |||
184 | def render_display_format_latex(self, output): |
|
187 | def render_display_format_latex(self, output): | |
185 | return self.in_env('equation', output.latex.lstrip('$$').rstrip('$$')) |
|
188 | return self.in_env(self.equation_env, | |
|
189 | output.latex.lstrip('$$').rstrip('$$')) | |||
186 |
|
190 | |||
187 | def render_display_format_json(self, output): |
|
191 | def render_display_format_json(self, output): | |
188 | # latex ignores json |
|
192 | # latex ignores json |
General Comments 0
You need to be logged in to leave comments.
Login now