[TxMt] A LaTeX Documented Source (.dtx) language grammar

Matt Bauman mbauman at gmail.com
Fri Feb 11 23:46:50 UTC 2011


Hello all,

I just threw together a new language for the LaTeX bundle: LaTeX Documented Source (.dtx).  It isn't terribly complicated, but some trickery is required to use the existing LaTeX language for both the implementation and the documentation (lines that start with a single %).

It still 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.  Also, it only sets the scope 'text.tex.latex.dtx' for the entire file and 'text.tex.latex.dtx.implementation' for the implementation code. It may be useful to flag the inverse of the implementation as 'text.tex.latex.dtx.documentation,' but unfortunately that is beyond my language grammar abilities.

I forked directly from the official latex.tmbundle on GitHub, but it could easily be integrated into the other branches.

https://github.com/mbauman/latex.tmbundle/commit/721a7dc6bdd7df4eedcec33e41450f9f4c78a275

I don't know how many people work with .dtx files, but I figured this may be generally useful to some.

Best regards,
Matt Bauman


More information about the textmate mailing list