eric6/QScintilla/Exporters/ExporterTEX.py

changeset 8453
9bd0576214e7
parent 8259
2bbec88047dd
diff -r 365065cc950c -r 9bd0576214e7 eric6/QScintilla/Exporters/ExporterTEX.py
--- a/eric6/QScintilla/Exporters/ExporterTEX.py	Mon Jul 05 19:30:08 2021 +0200
+++ b/eric6/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