Convert GMPL (GNU MathProg) models into LaTeX.
Reason this release was yanked:
Initial test release
Project description
gmpl-tex
Convert a subset of GMPL (GNU MathProg) optimization models into LaTeX, so the constraints, sets, parameters, variables and objectives you wrote for a solver can go straight into a paper with readable, renamed symbols.
The tool works in two phases so you stay in control of the notation:
- Lookup-table generation - parse
model.modinto a JSON table listing every set, parameter, variable, constraint and objective name. Each name maps to a label you can edit. - LaTeX generation - render the model to LaTeX, substituting your edited labels from the JSON table.
Install
No Python project setup required for users - pick whichever you have:
# with uv (no install, runs in a throwaway environment)
uvx --from git+https://github.com/<you>/gmpl-tex gmpl-tex --help
# with pipx (installs the gmpl-tex command onto your PATH)
pipx install git+https://github.com/<you>/gmpl-tex
# with plain pip, into a virtual environment
pip install git+https://github.com/<you>/gmpl-tex
Usage
gmpl-tex model.mod [lookup.json] --json
gmpl-tex model.mod [lookup.json] [output.tex] --latex
A full run, start to finish:
# 1. generate the editable lookup table (writes model.json)
gmpl-tex model.mod --json
# 2. open model.json and edit the label on the right-hand side of each entry,
# e.g. "finishTime": "fTime"
# 3. render LaTeX using your edited labels (writes model.tex)
gmpl-tex model.mod model.json --latex
If you skip step 1 and run gmpl-tex model.mod --latex directly, a default table
is created automatically (labels equal to the raw names) and used. If a
model.json already exists next to the model, it is reused as-is and never
overwritten.
An example model is included under examples/model.mod.
Requirements
- Python 3.10 or newer
lark(installed automatically)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gmpl_tex-0.1.0.tar.gz.
File metadata
- Download URL: gmpl_tex-0.1.0.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.17.0 {"ci":null,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.12.3"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.12.3","system":{"name":"Linux","release":"6.17.0-35-generic"}} HTTPX2/2.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef3a50184e9f2b3f2034d2c9f60aa1b6672cd7485ea2f3e7ac4d7ea39c18af3a
|
|
| MD5 |
ad8201048e621bf73c9f869353301441
|
|
| BLAKE2b-256 |
fbf973cde7b3a72aa72bb7d9e2fe4252b856721d91f7672afba4bc6534f6f796
|
File details
Details for the file gmpl_tex-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gmpl_tex-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.17.0 {"ci":null,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.12.3"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.12.3","system":{"name":"Linux","release":"6.17.0-35-generic"}} HTTPX2/2.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3e3fb4eeac23c2df1acbd1cde7ef10ebbe3f44cd6c1424d3f6fdb7e307c458e
|
|
| MD5 |
69b5e9455a7d901bf702f20d8e16dbd1
|
|
| BLAKE2b-256 |
f20ab4eeedf5bbc3046724b48f756c548983c1471372396b7825b6c29a5ebac5
|