eric7/QScintilla/Exporters/ExporterTEX.py

branch
eric7
changeset 8454
c679a3a80b7f
parent 8358
144a6b854f70
child 8522
4f263b89a293
equal deleted inserted replaced
8448:85d3ebd39e0b 8454:c679a3a80b7f
221 if titleFullPath else 221 if titleFullPath else
222 os.path.basename(self.editor.getFileName()) 222 os.path.basename(self.editor.getFileName())
223 ) 223 )
224 f.write( 224 f.write(
225 "Source File: {0}\n\n\\noindent\n\\tiny{{\n" 225 "Source File: {0}\n\n\\noindent\n\\tiny{{\n"
226 .format(title)) 226 .format(title.replace('_','\\_')))
227 227
228 styleCurrent = self.editor.styleAt(0) 228 styleCurrent = self.editor.styleAt(0)
229 f.write("\\eric{0}{{" 229 f.write("\\eric{0}{{"
230 .format(self.__texStyle(styleCurrent))) 230 .format(self.__texStyle(styleCurrent)))
231 231
250 lineIdx += ts - 1 250 lineIdx += ts - 1
251 f.write("\\hspace*{{{0:d}em}}".format(ts)) 251 f.write("\\hspace*{{{0:d}em}}".format(ts))
252 elif ch == b'\\': 252 elif ch == b'\\':
253 f.write("{\\textbackslash}") 253 f.write("{\\textbackslash}")
254 elif ch in [b'>', b'<', b'@']: 254 elif ch in [b'>', b'<', b'@']:
255 f.write("${0}$".format(ch[0])) 255 f.write("${0}$".format(ch.decode()))
256 elif ch in [b'{', b'}', b'^', b'_', b'&', b'$', b'#', 256 elif ch in [b'{', b'}', b'^', b'_', b'&', b'$', b'#',
257 b'%', b'~']: 257 b'%', b'~']:
258 f.write("\\{0}".format(ch[0])) 258 f.write("\\{0}".format(ch.decode()))
259 elif ch in [b'\r', b'\n']: 259 elif ch in [b'\r', b'\n']:
260 lineIdx = -1 # because incremented below 260 lineIdx = -1 # because incremented below
261 if ( 261 if (
262 ch == b'\r' and 262 ch == b'\r' and
263 self.editor.byteAt(pos + 1) == b'\n' 263 self.editor.byteAt(pos + 1) == b'\n'

eric ide

mercurial