[texworks] Regex for DTX mode

Will Robertson wspr81 at gmail.com
Fri Sep 26 16:02:53 CEST 2008

On 26/09/2008, at 10:17 PM, Joseph Wright wrote:

> 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.

I'm not so fussed about #1 but #2 would be excellent :)

I hadn't looked yet at TeXworks regexing code for all this.
Looks very promising!

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

> I'd like to improve on the macrocode one: how do I specifiy exactly  
> four
> spaces?

I'm pretty confused by this regex engine. This is the best I can do:


But that still matches four tabs. Why can't I write ( ){4} or (\ ){4}  
or even [\s^\t]{4} to match four spaces only?


More information about the texworks mailing list