You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
1 year ago | |
---|---|---|
pytex | 1 year ago | |
tests | 1 year ago | |
.gitignore | 3 years ago | |
LICENSE | 6 years ago | |
README.md | 3 years ago | |
requirements.dev.txt | 1 year ago | |
setup.py | 3 years ago |
README.md
Pytex
Pytex is a simple package which make a bridge between Latex and Python.
Installation
pip install mypytex
texenv: Bring Python inside latex
texenv is a jinja2 environment which allow to use python commands inside latex.
- \Block{#} is the equivalent of {% block #%} in Jinja2. Every python's commands will be run like in a script. %- is also available for line statement.
- \Var{#} is the equivalent of {{#}} which print the statment.
Use the environment with a string template.
>>> from pytex import texenv
>>> text = "Hello"
>>> template = """\
\Var{text}
\Block{set a = 2}
%-set b = 3
\Var{a}
\Var{b}
"""
>>> template = texenv.from_string(template)
>>> print(template.render(text = text)
Hello
2
3