eric6/QScintilla/Exporters/ExporterTEX.py

changeset 7949
17c0a4ec3cf0
parent 7923
91e843545d9a
child 8205
4a0f1f896341
--- a/eric6/QScintilla/Exporters/ExporterTEX.py	Sun Jan 03 18:02:19 2021 +0100
+++ b/eric6/QScintilla/Exporters/ExporterTEX.py	Sun Jan 03 22:24:05 2021 +0100
@@ -26,7 +26,7 @@
     """
     Class implementing an exporter for TeX.
     """
-    CHARZ = ord('z') - ord('a') + 1
+    CHARZ = 26
     
     def __init__(self, editor, parent=None):
         """
@@ -66,11 +66,17 @@
         @return style name string (string)
         """
         buf = ""
+        if style >= 0:
+            start = ord('a')
+        else:
+            start = ord('A')
+            style = abs(style)
+        
         if style == 0:
             buf = "a"
         else:
             while style > 0:
-                buf += chr(ord('a') + (style % self.CHARZ))
+                buf += chr(start + (style % self.CHARZ))
                 style //= self.CHARZ
         return buf
     
@@ -188,6 +194,21 @@
                                     
                                     self.__defineTexStyle(
                                         font, colour, paper, f, istyle)
+                                    # get substyles
+                                    subs_start, subs_count = (
+                                        self.editor.getSubStyleRange(istyle)
+                                    )
+                                    for subs_idx in range(subs_count):
+                                        font = lex.font(subs_start + subs_idx)
+                                        colour = lex.color(
+                                            subs_start + subs_idx)
+                                        paper = lex.paper(
+                                            subs_start + subs_idx)
+                                        
+                                        self.__defineTexStyle(
+                                            font, colour, paper, f,
+                                            subs_idx - subs_start)
+                                    
                             istyle += 1
                     else:
                         colour = self.editor.color()

eric ide

mercurial