19 from E5Gui import E5MessageBox |
19 from E5Gui import E5MessageBox |
20 |
20 |
21 from .ExporterBase import ExporterBase |
21 from .ExporterBase import ExporterBase |
22 |
22 |
23 import Preferences |
23 import Preferences |
|
24 |
24 |
25 |
25 class ExporterTEX(ExporterBase): |
26 class ExporterTEX(ExporterBase): |
26 """ |
27 """ |
27 Class implementing an exporter for TeX. |
28 Class implementing an exporter for TeX. |
28 """ |
29 """ |
29 CHARZ = ord('z') - ord('a') + 1 |
30 CHARZ = ord('z') - ord('a') + 1 |
30 |
31 |
31 def __init__(self, editor, parent = None): |
32 def __init__(self, editor, parent=None): |
32 """ |
33 """ |
33 Constructor |
34 Constructor |
34 |
35 |
35 @param editor reference to the editor object (QScintilla.Editor.Editor) |
36 @param editor reference to the editor object (QScintilla.Editor.Editor) |
36 @param parent parent object of the exporter (QObject) |
37 @param parent parent object of the exporter (QObject) |
146 for index in range(QsciScintilla.STYLE_MAX + 1): |
147 for index in range(QsciScintilla.STYLE_MAX + 1): |
147 styleIsUsed[index] = True |
148 styleIsUsed[index] = True |
148 styleIsUsed[QsciScintilla.STYLE_DEFAULT] = True |
149 styleIsUsed[QsciScintilla.STYLE_DEFAULT] = True |
149 |
150 |
150 try: |
151 try: |
151 f = open(filename, "w", encoding = "utf-8") |
152 f = open(filename, "w", encoding="utf-8") |
152 |
153 |
153 f.write("\\documentclass[a4paper]{article}\n") |
154 f.write("\\documentclass[a4paper]{article}\n") |
154 f.write("\\usepackage[a4paper,margin=1.5cm]{geometry}\n") |
155 f.write("\\usepackage[a4paper,margin=1.5cm]{geometry}\n") |
155 f.write("\\usepackage[T1]{fontenc}\n") |
156 f.write("\\usepackage[T1]{fontenc}\n") |
156 f.write("\\usepackage{color}\n") |
157 f.write("\\usepackage{color}\n") |
179 colour = self.editor.color() |
180 colour = self.editor.color() |
180 paper = self.editor.paper() |
181 paper = self.editor.paper() |
181 font = Preferences.getEditorOtherFonts("DefaultFont") |
182 font = Preferences.getEditorOtherFonts("DefaultFont") |
182 |
183 |
183 self.__defineTexStyle(font, colour, paper, f, 0) |
184 self.__defineTexStyle(font, colour, paper, f, 0) |
184 self.__defineTexStyle(font, colour, paper, f, |
185 self.__defineTexStyle(font, colour, paper, f, |
185 QsciScintilla.STYLE_DEFAULT) |
186 QsciScintilla.STYLE_DEFAULT) |
186 |
187 |
187 f.write("\\begin{document}\n\n") |
188 f.write("\\begin{document}\n\n") |
188 if titleFullPath: |
189 if titleFullPath: |
189 title = self.editor.getFileName() |
190 title = self.editor.getFileName() |