[texworks] TeXWorks LaTeX syntax highlighting

Stefan Löffler st.loeffler at gmail.com
Wed Nov 24 08:22:09 CET 2010


Hi,

this is a known issue (see
http://code.google.com/p/texworks/issues/detail?id=67). Unfortunately,
no better solution has been found yet.

On 2010-11-24 08:12, Joseph Wright wrote:
> On 24/11/2010 01:33, Vafa Khalighi wrote:
>> Texmaker has no problem highlighting Persian control sequences. See
>> attached
>> image. It exactly uses what I described before.
>
> As TeXworks uses a regex approach to highlighting, the best plan seems
> to be to change the regex. The syntax-patterns.txt file contains:
>
>   # control sequences
>   blue        N    \\(?:[A-Za-z@]+|.)
>
> which of course is therefore hard-coded for the 26 English letters
> only. I guess a better formulation would be
>
>   # control sequences
>   blue        N    \\(?:[\w@]+|.)
>
> which seems to work with Persian in my very limited test. This of
> course depends on what the Qt system decides is a 'letter'. One
> problem with that is tha the regex engine counts '_' as it is used in
> a lot of programming languages as part of function names. I guess this
> is a small price to pay for a better approach to highlighting.

>From what I gathered from the GC issue (see above), \w also highlights
numbers. So in the present case this may be a feasible workaround, but
it's not particularly good for general usage, either.
I'm not sure if there is an ideal solution for this, though. As pointed
out by others in previous mails, ultimately what TeX considers as part
of the command depends on the catcode property of the respective
characters involved. Since that can be changed dynamically, we'll never
be able to suit all needs, I'm afraid...

HTH
Stefan


More information about the texworks mailing list