Fixed a few issues in the TeX exporter. eric7

Mon, 05 Jul 2021 19:30:32 +0200

author
Tony Arnold
date
Mon, 05 Jul 2021 19:30:32 +0200
branch
eric7
changeset 8454
c679a3a80b7f
parent 8448
85d3ebd39e0b
child 8455
3ca569b8f324

Fixed a few issues in the TeX exporter.
(grafted from 9bd0576214e705baa9557e99df6f22a2e607bd4b)

eric7/QScintilla/Exporters/ExporterTEX.py file | annotate | diff | comparison | revisions
--- a/eric7/QScintilla/Exporters/ExporterTEX.py	Fri Jul 02 17:43:19 2021 +0200
+++ b/eric7/QScintilla/Exporters/ExporterTEX.py	Mon Jul 05 19:30:32 2021 +0200
@@ -223,7 +223,7 @@
                 )
                 f.write(
                     "Source File: {0}\n\n\\noindent\n\\tiny{{\n"
-                    .format(title))
+                    .format(title.replace('_','\\_')))
                 
                 styleCurrent = self.editor.styleAt(0)
                 f.write("\\eric{0}{{"
@@ -252,10 +252,10 @@
                     elif ch == b'\\':
                         f.write("{\\textbackslash}")
                     elif ch in [b'>', b'<', b'@']:
-                        f.write("${0}$".format(ch[0]))
+                        f.write("${0}$".format(ch.decode()))
                     elif ch in [b'{', b'}', b'^', b'_', b'&', b'$', b'#',
                                 b'%', b'~']:
-                        f.write("\\{0}".format(ch[0]))
+                        f.write("\\{0}".format(ch.decode()))
                     elif ch in [b'\r', b'\n']:
                         lineIdx = -1    # because incremented below
                         if (

eric ide

mercurial