[texworks] Highlighting for .dtx file?

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Aug 26 19:40:52 CEST 2013


Hello all,

TeXworks' syntax highlighting comes set up for LaTeX and ConTeXt 'user
documents', as well as the 'no highlighting' option. One thing that I've
been asked a few times is for some settings for editing LaTeX Documented
Source (.dtx) files. Would it be of any broader interest to add this to
the standard set? Alternatively, if this seems rather too specialised
for the TeXworks core, is there any interest in trying to sort out a
single place to collect up useful add-ons to TeXworks, akin to WinEdt's
community site (http://www.winedt.org)? (Or of course is there one already?)

For reference, I currently use:

    [LaTeX DTX]

    # comments
    red        Y    \^\^A.*

    # Guards
    orange         N    %<(?:[A-Za-z0-9!\|]+|.)>
    limegreen      N    %<\*(?:[A-Za-z0-9!\|]+|.)>
    crimson        N    %</(?:[A-Za-z0-9!\|]+|.)>
    darkviolet     N    %<@@=(?:[A-Za-z]+|.)>

    # special characters
    darkred        N    \^\^\^\^\^[0-9a-z]{5}
    darkred        N    \^\^\^\^[0-9a-z]{4}
    darkred        N    \^\^\^[0-9a-z]{3}
    darkred        N    \^\^[0-9a-z]{2}
    darkred        N    [$#^_{}&]
    gray           N    ^%%.*
    gray           N    ^%

    # Macrocode
    green        N    \\(?:begin|end)\{macrocode\}

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

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

which covers both 'standard' LaTeX2e .dtx files and also LaTeX3/expl3.
(Colour scheme is based on WinEdt's dtx editing mode.)
-- 
Joseph Wright


More information about the texworks mailing list