6.4 plasTeX.TeX — The TeX Stream

The TeX stream is the piece of plasTeX where the parsing of the LaTeX document takes place. While the TeX class is fairly large, there are only a few methods and attributes designated in the public API.

The TeX stream is based on a Python generator. When you feed it a LaTeX source file, it processes the file much like TeX itself. However, on the output end, rather than a DVI file, you get a plasTeX document object. The basic usage is shown in the code below.

from plasTeX.TeX import TeX
doc = TeX(file='myfile.tex').parse()