[texworks] Regex for DTX mode

Joseph Wright joseph.wright at morningstar2.co.uk
Fri Sep 26 14:47:10 CEST 2008


Hello all,

I'm trying to get the regex system to give me something similar to "DTX
Mode" in WinEdt.  I note that I can't (1) make things bold or italic, or
(2) alter the background colour, both of which would be nice.  However,
the following does work:

[LaTeX DTX]
# comments
red			Y	\^\^A.*

# special characters
darkred		N	[$#^_{}&]

# Guards
gold        N   %<(?:[A-Za-z0-9!\|]+|.)>
lime        N   %<\*(?:[A-Za-z0-9!\|]+|.)>
crimson     N   %</(?:[A-Za-z0-9!\|]+|.)>

# Macrocode
darkolivegreen	N	^%....\\(?:begin|end)\{macrocode\}

# LaTeX environments
darkgreen	N	\\(?:begin|end)\s*\{[^}]*\}

# LaTeX packages
darkblue	N	\\usepackage\s*(?:\[[^]]*\]\s*)?\{[^}]*\}

# control sequences
blue		N	\\(?:[A-Za-z@:_]+|.)

I'd like to improve on the macrocode one: how do I specifiy exactly four
spaces?  The colours at present are not ideal: as I say, I'd like to
alter bold (for the macrocode start/stop) and background (for the guards
and also for every line starting % so the code parts stand out).
-- 
Joseph Wright


More information about the texworks mailing list