[texworks] syntax pattern for inmath

Stefan Löffler st.loeffler at gmail.com
Wed Feb 3 15:42:46 CET 2010


Am 2010-02-03 14:19, schrieb Herbert Schulz:
> For curiosities sake... what happens if you use $$...$$ for displayed math equations? I see this quite a bit even with LaTeX.
>   

With "\$[^\$]+\$", I'd assume that everything between an including the
inner $ signs would be colored, but not the outer $ signs. But you could
easily adjust the regexp to work for both cases by simply saying
"\$+[^\$]+\$+" (which will actually match one or arbitrarly more $ signs).

Note, though, that none of these expressions behave correctly if you use
"\$" in the source to typeset a $ sign. This could be solved with
Perl-style look-behind assertions, but the Qt docs tell me they are not
supported. This could be worked around be changing the syntax
highlighting code in a way that would only highlight the first captured
text (if available). That way, you could match arbitrary strings before
and after the string that actually gets highlighted. But this is not
implemented ATM.

HTH
Stefan


More information about the texworks mailing list