plasTeX 3.0 — A Python Framework for Processing LaTeX Documents

6.5 plasTeX.Context — The TeX Context

The Context class stores all of the information associated with the currently running document. This includes things like macros, counters, labels, references, etc. The context also makes sure that localized macros get popped off when processing leaves a macro or environment. The context of a document also has the power to create new counters, dimens, if commands, macros, as well as change token category codes.

Each time a TeX object is instantiated, it will create its own context. This context will load all of the base macros and initialize all of the context information described above.