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.texcmds– list of all TeX commands/environments, such as\py,pycodeetc. These are also (mostly) available in the documentation of the TeX package.For getting started, it’s recommended to read the documentation of the TeX package linked above first.
pythonimmediate.simple– interface that “just works” for typical users of thepythonimmediateTeX 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
pythonimmediateTeX package documentation.Some properties of the parent TeX engine (e.g. whether Unicode is supported) can be accessed from
default_engine.The rest: contain functions that controls TeX in a more “low-level” way. Start with reading the module documentation
pythonimmediate.See the documentation of
pythonimmediate.engine.ChildProcessEnginefor ways to create a TeX engine from inside Python, and seedefault_enginefor how to set which engine functions are run on.The command-line arguments that the Python component accepts (can be specified through the
args=TeX module option) are documented inpythonimmediate.pytotex.Debugging functionalities should be available:
Error messages should be as descriptive as possible.
TeX errors results in Python traceback, and Python error results in TeX traceback.
Errors in code executed with the
pycodeenvironment gives the correct traceback point to the Python line of code in the TeX file.There are some command-line flags to enable debugging functionalities, which can be passed in follows the documentation in
pythonimmediate.pytotex.
Note
Disclaimer: the sole purpose of this package is to let me do some programming in TeX in a sane programming language.
Its design is not necessarily good, usually with lots of abstraction layers piled over legacy code.
Contents:
- pythonimmediate package
- Submodules
- pythonimmediate.communicate module
- pythonimmediate.engine module
- pythonimmediate.lowlevel module
PTTBalancedTokenListPTTBlockPTTIntPTTTeXLinePTTVerbatimLinePTTVerbatimRawLinePyToTeXDataPythonCallTeXFunctionTypePythonCallTeXSyncFunctionTypePython_call_TeX_dataPython_call_TeX_extraPython_call_TeX_local()TTPBlockTTPEBlockTTPELineTTPEmbeddedLineTTPLineTTPRawLineTeXToPyDatabootstrap_code_functionsbuild_Python_call_TeX()can_be_mangled_to()check_line()define_Python_call_TeX()define_TeX_call_Python()define_internal_handler()get_bootstrap_code()mark_bootstrap_naive_replace()run_error_finish()scan_Python_call_TeX()scan_Python_call_TeX_module()
- pythonimmediate.multiengine module
- pythonimmediate.pytotex module
- pythonimmediate.simple module
define_char()escape_str()execute()execute_tokenized()f1()fully_expand()get_arg_estr()get_arg_str()get_env_body_verb_approximate()get_multiline_verb_arg()get_next_char()get_optional_arg_estr()get_optional_arg_str()get_verb_arg()is_balanced()newcommand()newenvironment()newenvironment_verb()parse_keyval()parse_keyval_items()peek_next_char()print_TeX()put_next()put_next_tokenized()renewcommand()split_balanced()strip_optional_braces()undefine_char()var
- pythonimmediate.texcmds module
- pythonimmediate.textopy module
- pythonimmediate.tikz module
- pythonimmediate.util module
- Module contents
BalancedTokenListBalancedTokenList.detokenize()BalancedTokenList.execute()BalancedTokenList.expand_estr()BalancedTokenList.expand_o()BalancedTokenList.expand_x()BalancedTokenList.get_next()BalancedTokenList.get_until()BalancedTokenList.get_until_brace()BalancedTokenList.parse_keyval()BalancedTokenList.parse_keyval_items()BalancedTokenList.put_next()BalancedTokenList.split_balanced()BalancedTokenList.strip_optional_braces()BalancedTokenList.strip_spaces()
BlueTokenCCatcodeCharacterTokenControlSequenceTokenControlSequenceTokenMakerDimensionUnitImmutableBalancedTokenListMathClassNTokenNTokenListRedirectPrintTeXTTTPBalancedTokenListTokenToken.assignableToken.blueToken.bool()Token.can_blueToken.defined()Token.deserialize()Token.deserialize_bytes()Token.dim()Token.estr()Token.get_next()Token.int()Token.is_defined()Token.is_expandable()Token.no_blueToken.noexpandToken.peek_next()Token.put_next()Token.serialize()Token.set_eq()Token.set_func()Token.set_future()Token.set_future2()Token.simple_detokenize()Token.str()Token.tl()
TokenListTokenList.balancedTokenList.balanced_parts()TokenList.check_balanced()TokenList.deserialize()TokenList.deserialize_bytes()TokenList.doc()TokenList.e3()TokenList.execute()TokenList.expand_x()TokenList.from_string()TokenList.fstr()TokenList.int()TokenList.is_balanced()TokenList.put_next()TokenList.serialize_bytes()TokenList.str()TokenList.str_codes()TokenList.str_if_unicode()
UmathcodeUnbalancedTokenListError_CatcodeManager_CountManager_FrozenRelaxToken_GroupManager_ToksManager_UmathcodeManageradd_TeX_handler()add_TeX_handler_param()add_handler()add_handler_async()call_TeX_handler()catcodecontinue_until_passed_back()continue_until_passed_back_str()convert_unit()countexpand_once()frozen_relax_tokenget_user_scope()grouplua_try_eval()peek_next_meaning()remove_TeX_handler()remove_handler()tokstypeout()umathcodewlog()
- Submodules