[texworks] \verb syntax highlighting (was: texworks)

Stefan Löffler st.loeffler at gmail.com
Mon Jun 7 07:28:25 CEST 2010


Am 2010-06-05 22:29, schrieb Mario Cupelli:
> Example:
> \verb+%a+ some text
> If the verb content includes a comment character (without escaping it),
> then the rest of the text will be highlighted as comment.

As Jonathan explained, syntax highlighting is based on simple rules, and
not on parsing the TeX code. There is a possible change, but whether
it's really an improvement I can't tell:
Put the following two lines into
<TWresources>/configuration/syntax-patterns.txt just after "[LaTeX]":
# verb workaround
;        N    \\verb(.).*\1

This will simply not highlight any \verb... command. Note, though, that
the "\verb" part itself is also not highlighted anymore! The reason for
this is that Qt doesn't support lookbehind assertions, and we can't
specify styles only for parts of matches.
Another issue is that if you have to \verb... commands with the same
delimiter character on one line, everything in-between will be
highlighted as well (I tried "[^\1]*", but it didn't work).
So, all in all, you can use it, of course, but I don't think that it
would be a good default for most users seeing that it has some quite
special caveats.


More information about the texworks mailing list