Welcome to pythonimmediate’s documentation!

This package is a Python-TeX binding. It requires the pythonimmediate TeX package to be installed.

The package works both ways – you can run Python code from TeX, or TeX code from Python.

There are different sections of the documentation:

  • pythonimmediate.simple – interface that “just works” for typical users of the pythonimmediate TeX package, to use Python coding from TeX, who does not know TeX inner details such as category codes.

    Note that this should be read in conjunction with the pythonimmediate TeX package documentation.

  • Some properties of the parent TeX interpreter can be accessed from default_engine.

  • The rest: contain functions to control the precise category codes of the tokens.

    Read expand_once() and NTokenList for some examples.

  • See the documentation of pythonimmediate.engine.ChildProcessEngine for ways to create a TeX engine from inside Python, and explanation of the engine= optional argument for most functions.

  • The command-line arguments that the Python component accepts (can be specified through the args= TeX module option) are documented in pythonimmediate.pytotex.


Indices and tables