Skip to main content

pTyX

Overview

pTyX is a LaTeX precompilator, written in Python. pTyX enables to generate LaTeX documents, using custom commands or plain python code. One single pTyX file may generate many latex documents, with different values. I developped and used pTyX to make several different versions of a same test in exams, for my student, to discourage cheating. Since it uses sympy library, pTyX has symbolic calculus abilities too.

Installation

pTyX is only tested on GNU/Linux (Ubuntu), but should work on MacOs X too.

Obviously, pTyX needs a working Python installation. Python version 3.8 (at least) is required for pTyX to run.

pTyX also needs a working LaTeX installation. Command pdflatex must be available in your terminal.

The easiest way to install it is using pip.

$ pip install ptyx

You may also download and install the latest version from Github:

$ git clone https://github.com/wxgeo/ptyx.git
$ cd ptyx
$ pip install -e .

Usage

To compile a pTyX file (see below), open a terminal, go to pTyX directory, and write:

$ ptyx my_file.ptyx

For more options:

$ ptyx --help

pTyX file specification

A pTyX file is essentially a LaTeX file, with a .ptyx extension, (optionally) some custom commands, and embedded python code.

To include python code in a pTyX file, use the #PYTHON and #END balise. A special write() command is available, to generate latex code on the flow from python.

This a simple \emph{addition}:\quad
#PYTHON
from random import randint
a = randint(5, 9)
b = randint(2, 4)
write('%s + %s = %s\\' % (a, b, a + b))
#END
Now, some basic \emph{subtraction}:\quad
#PYTHON
write('%s - %s = %s\\' % (a, b, a - b))
#END

To access any python variable outside python code scope, simply add a hashtag before the variable name.

Any valid python expression can also be evaluated this way, using syntax #{python_expr}.

$#a\mul#b=#{a*b}$

However, pTyX has also reserved tags, like conditionals statements #IF, #ELSE, #ENDIF...

(More to come...)

Metadata

Release files for ptyx 30.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ptyx 30.3.0
File Size Uploaded Provenance Actions
ptyx-30.3.0.tar.gz 56.1 kB Without provenance Details for ptyx-30.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ptyx 30.3.0
File Interpreter ABI Platform Actions
ptyx-30.3.0-py3-none-any.whl Python 3 none any Details for ptyx-30.3.0-py3-none-any.whl

Total release size: 124.3 kB

Release files / ptyx-30.3.0.tar.gz

Download URL ptyx-30.3.0.tar.gz
Size 56.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b73597a53f3ae87d939c6a8d3700c72cec440ef7a077c602505cf6c9dd48b989
BLAKE2b-256 checksum
How to use checksums
733111527568f0e042dd7cb163e01babfea9f2fc33c6de9ff3fe7ad888d92263
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / ptyx-30.3.0-py3-none-any.whl

Download URL ptyx-30.3.0-py3-none-any.whl
Size 68.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de42acf114de516e12e56d81ee295db3f7e6317aca5b60b9ea1c992e95e3da7f
BLAKE2b-256 checksum
How to use checksums
99b777864a06214deb539beb749822bf4b848c578faf32af76a8bebd2bd92ac2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for ptyx 30.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

30.3.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page