regex for balanced parentheses?

Paul McGuire ptmcg at
Thu Jun 12 17:24:11 CEST 2008

Parsing TeX is definitely not for the faint-of-heart!  You might try
something like QuotedString('$', escQuote='$$') in pyparsing.  (I've
not poked at TeX or its ilk since the mid-80's so my TeXpertise is
long rusted away.)

I know of two projects that have taken on the problem using pyparsing
- one is the mathtext module in John Hunter's matplotlib, and Tim
Arnold posted some questions on the subject a while back - try
googling for "pyparsing tex" for further leads.

-- Paul

More information about the Python-list mailing list