As another option, I just threw together a solution for TextMate. It isn't terribly complicated, but some trickery is required to use the existing LaTeX language grammar for both the implementation and the documentation.
It has a few issues. Most notably, many .dtx files do funny things with the catcode of $, and as such, TextMate will furiously try to match all $s, even when there isn't a matching pair. Since some .dtx files can exceed 30k lines, this can lock up the parser for quite some time (in addition to parsing everything wrong after the $).
I forked directly from the official latex.tmbundle on GitHub, but it could easily be integrated into the other branches.
Here's the language as a plain-text format plist:
{ scopeName = 'text.tex.latex.dtx';
firstLineMatch = '^%\s*\\iffalse\s+(?:meta-)?comment';
fileTypes = ( '.dtx' );
patterns = (
{ name = 'text.tex.latex.dtx.implementation';
begin = '(?:^(%) (\\begin){macrocode}|^(%)\s*(\\iffalse\b)(.*)$\n)';
end = '(?:^(%) (\\end){macrocode}|^(%)\s*(\\fi)\b)';
beginCaptures = {
1 = { name = 'comment.block.tex.latex.dtx'; };
2 = { name = 'keyword.control.tex'; };
3 = { name = 'comment.block.tex.latex.dtx'; };
4 = { name = 'keyword.control.tex'; };
5 = { name = 'comment.block.tex.latex.dtx'; };
};
endCaptures = {
1 = { name = 'comment.block.tex.latex.dtx'; };
2 = { name = 'keyword.control.tex'; };
3 = { name = 'comment.block.tex.latex.dtx'; };
4 = { name = 'keyword.control.tex'; };
};
patterns = (
{ match = '^(%)(<[\*/]?(?:[A-Za-z0-9!\|]+|.)>)';
captures = {
1 = { name = 'comment.block.tex.latex.dtx'; };
2 = { name = 'entity.name.selection.tex.latex.dtx'; };
};
},
{ include = 'text.tex.latex'; },
);
},
{ name = 'comment.block.tex.latex.dtx';
match = '^%';
},
{ name = 'text.tex.latex.dtx.documentation';
begin = '(\\CharacterTable)\b';
end = '(?<!\\)}';
beginCaptures = { 1 = { name = 'keyword.control.tex'; }; };
patterns = (
{ name = 'comment.block.tex.latex.dtx';
match = '^%';
},
{ name = 'markup.raw.charactertable';
match = '.';
},
);
},
{ include = 'text.tex.latex'; },
);
}
:)– mbauman Feb 11 '11 at 16:27.dtxformat is not limited to LaTeX, but as it's something the LaTeX Project came up with that's where the major use is. – Joseph Wright Feb 11 '11 at 16:30