texworks icon indicating copy to clipboard operation
texworks copied to clipboard

Enhanced syntax highlighting

Open GoogleCodeExporter opened this issue 10 years ago • 2 comments

It would be great if TeXworks (great editor BTW!) would support the application 
of multiple syntax highlighting rules in the same block of text.

For example if the following rules are set:
#Apply italic to inline math environments
;I  N   \$[^$]*\$    
# control sequences
blue        N   \\(?:[A-Za-z@]+|.)


Then the following code:
"The identity $-1=e^{i\pi}$ uses the most important numbers in mathematics."

Would be highlighted as follows. The part starting and ending with the $ 
symbols is set in italics. The '\pi' inside this block is set in blue italics. 
Would this be possible?


Original issue reported on code.google.com by [email protected] on 23 Aug 2010 at 10:17

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

This is not possible at the moment with the current system (which can only 
handle one rule at a time; otherwise, we'd need some sort of priority, in case 
there are contradictory rules (e.g., one with blue and one with red)). It's a 
good idea, though, and hopefully we'll find a way to make it work in the future.

Original comment by st.loeffler on 26 Aug 2010 at 3:23

  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

It seems that the regex for look around isn't supported. Is there a way to enable it? I would like to highlight for example the Name of a chapter in brackets differently from the actual Syntax, or also the citation key of a cite command. I tried for example: (?<=\chapter\s_{)[^}]_ but that doesn't work for me. Or is there an other way to achieve this? Thank you for looking into this.

subminimbus avatar Apr 06 '16 17:04 subminimbus