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
,pycode
etc. These are also (mostly) available in the documentation of the TeX package.pythonimmediate.simple
– interface that “just works” for typical users of thepythonimmediate
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 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.ChildProcessEngine
for ways to create a TeX engine from inside Python, and seedefault_engine
for 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
pycode
environment 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.copy_to_stderr module
- pythonimmediate.engine 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()
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
- Module contents
BalancedTokenList
BlueToken
C
Catcode
CharacterToken
ControlSequenceToken
ControlSequenceTokenMaker
MathClass
NToken
NTokenList
PTTBalancedTokenList
PTTBlock
PTTInt
PTTTeXLine
PTTVerbatimLine
PTTVerbatimRawLine
PyToTeXData
PythonCallTeXFunctionType
PythonCallTeXSyncFunctionType
Python_call_TeX_data
Python_call_TeX_extra
Python_call_TeX_local()
RedirectPrintTeX
T
TTPBalancedTokenList
TTPBlock
TTPEBlock
TTPELine
TTPEmbeddedLine
TTPLine
TTPRawLine
TeXToPyData
Token
Token.assignable
Token.blue
Token.bool()
Token.can_blue
Token.defined()
Token.deserialize()
Token.deserialize_bytes()
Token.estr()
Token.get_next()
Token.int()
Token.is_expandable()
Token.no_blue
Token.noexpand
Token.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()
TokenList
TokenList.balanced
TokenList.balanced_parts()
TokenList.check_balanced()
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()
Umathcode
_CatcodeManager
_CountManager
_FrozenRelaxToken
_GroupManager
_UmathcodeManager
add_TeX_handler()
add_TeX_handler_param()
add_handler()
add_handler_async()
call_TeX_handler()
catcode
continue_until_passed_back()
continue_until_passed_back_str()
count
expand_once()
frozen_relax_token
get_user_scope()
group
lua_try_eval()
peek_next_meaning()
remove_TeX_handler()
remove_handler()
toks
typeout()
umathcode
wlog()