[texworks] Improving Syntax Highlighting

Chris Jefferson chris at bubblescope.net
Sun May 6 12:50:52 CEST 2012


I am planning on having a look at the syntax highlighting code. I 
thought I would see if anyone was currently working on this, or if 
anyone had any major suggestions.

Having had a look at the code, here are my initial thoughts:

The current system uses QSyntaxHighlighter. It seems very silly to 
consider switching to anything else.
This implies a number of limitations. The big one is no multi-line user 
regular expressions, sorry. Specific multi-line things can be custom 
written in C++ obviously.

The things I would most like, in order of preference, are:

1) Matching of maths ( both $ $ and \( \) ).
2) Ability to highlight specific \begin{x} ... \end{x} sections.
3) Highlighting of parts of regular expressions (for example, in 
\textbf{XYZ}, make the XYZ bold).

Also, I would like to make the code slightly easier to chain engines 
together, under the restriction that the code still "looks like" and 
understands QSyntaxHighlighter objects. It doesn't seem work wrapping 
the library in another set of functions, which basically do exactly the 
same thing.

Any comments or thoughts welcome, particularly if there is anything else 
someone particularly wants doing, or if someone else is already looking 
at this code!


More information about the texworks mailing list