plasTeX 3.0 — A Python Framework for Processing LaTeX Documents

6.3 plasTeX.DOM — The plasTeX Document Object Model (DOM)

While most LaTeX processors use a stream model where the input is directly connected to the output, plasTeX actually works in two phases. The first phase reads in the LaTeX document, expands macros, and constructs an object similar to an XML DOM. This object is then passed to the renderer which translates it into the appropriate output format. The benefit to doing it this way is that you are not limited to a single output format. In addition, you can actually apply multiple renderers with only one parse step. This section describes the DOM used by plasTeX, its API, and the similarities and differences between the plasTeX DOM and the XML DOM.