PypTeX: the Python Preprocessor for TeX
Author: Sébastien Loisel
PypTeX is the Python Preprocessor for LaTeX. It allows one to embed Python code fragments in a LaTeX template file.
Installation
pip install pyptex
- You will also need a LaTeX installation, and the default LaTeX processor is
pdflatex. - You need a Python 3 installation.
Hello, world
Put the following in example.tex:
\documentclass{article}
@{from sympy import *}
\begin{document}
$$\int x^3\,dx = @{S('integrate(x^3,x)')}+C$$
\end{document}
The command pyptex example.tex will generate example.pdf and an intermediary
pure-LaTeX file example.pyptex. The resulting PDF can be found
here
- The
pyptexexecutable tries to locate the Python 3 executable using/usr/bin/env python3. If this is causing you problems, trypython -u -m pyptex example.texinstead.
Slightly bigger examples
- 2d and 3d plotting tex | pdf
- Matrix inverse exercise tex | pdf
- The F19NB handout for numerical linear algebra at Heriot-Watt university is generated with PypTeX. pdf
TeXShop
If you want to use TeXShop on Mac, put the following into ~/Library/TeXShop/Engines/pyptex.engine and restart TeXShop:
#!/bin/bash
pyptex $1
Documentation
Detailed documentation can be found here
Metadata
Release files for pyptex 1.5.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyptex-1.5.6.tar.gz | 15.4 kB | Details |
Release files / pyptex-1.5.6.tar.gz
| Download URL | pyptex-1.5.6.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e84649b2c1a5046dc8715bdf4dfc70a63e226314850ea8f6d2fdaf8fd62c637
|
|
BLAKE2b-256 checksum How to use checksums |
8c44d29783a763d75907be0647bcb998cf0c527f564afeba2c1486be0b273bb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.15
|