latexify
A library to generate LaTeX expression from Python code
latexify_py converts small, math-heavy pieces of Python code into human-readable LaTeX that mirrors the intent of the computation, not just its surface syntax. It parses Python functions and expressions into an abstract syntax tree (AST), applies symbolic rewrites for common mathematical constructs, and then emits LaTeX that compiles cleanly in standard environments. Typical use cases include turning analytical utilities—like probability mass functions, activation formulas, or recurrence...