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.4.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.4.0
File Size Uploaded Provenance Actions
ptyx-30.4.0.tar.gz 56.2 kB Without provenance Details for ptyx-30.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 124.5 kB

Release files / ptyx-30.4.0.tar.gz

Download URL ptyx-30.4.0.tar.gz
Size 56.2 kB
Tags Source
SHA-256 checksum
How to use checksums
39f32ce3f7fe2b51f24ab713e4e7a65dbebecf4111bbad0c40b1932d282aa19a
BLAKE2b-256 checksum
How to use checksums
b15e3198d5db9666b7fb150ba2eee58d6dd765e7ec39c91a8640e9adf4522e88
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.4.0-py3-none-any.whl

Download URL ptyx-30.4.0-py3-none-any.whl
Size 68.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43f21640cc34a133b739101fa78af4b2a3995ebb800cf76af9bea508255c030e
BLAKE2b-256 checksum
How to use checksums
8ff2795f807b484528f6b9ad9e63711c877f215b714a10c385f8e4a3eeb63823
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.4.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.4.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