LaTeX <-> JSON parser/generator for structured math documents
Project description
The library transforms raw LaTeX files into a structured JSON format based on logical blocks. This allows LLMs to process mathematical content without being overwhelmed by LaTeX formatting commands. JSON Structure Produced
The parser outputs a consistent hierarchical structure:
env = "other": Capture plain text or LaTeX commands located outside any \begin...\end environment.
env = "theorem", "definition", "equation", etc.: Capture structured content from specific LaTeX environments.
Preamble Configuration 🛠️
The generator can prepend a LaTeX preamble to ensure the output is a stand-alone, compilable document. By default, it looks for a file named preambule.tex. Example preambule.tex
Create a preambule.tex in your working directory:
Note: Including \begin{document} in your preamble is required if you want the generated output to be directly compilable.
Usage (Python API) 🐍
- Parse a LaTeX file to JSON
- Parse raw LaTeX text directly
- Generate LaTeX from a JSON file
- Generate LaTeX from an in-memory JSON dictionary Command Line Interface (CLI) 💻
If enabled in your pyproject.toml, you can use the library directly from your terminal:
Convert LaTeX to JSON:
Convert JSON to LaTeX: Notes & Current Limitations ⚠️
Scope: The parser currently targets standard environments of the form \begin{ENV} ... \end{ENV}.
Metadata: Environment options (e.g., \begin{theorem}[Optional title]) are currently kept within the content block and not yet extracted as separate metadata.
Applications: This library is ideal for:
RAG / AI Search: Indexing mathematical proofs by semantic chunks.
Educational Platforms: Segmenting long courses into manageable units.
Automated Publishing: Programmatically generating LaTeX documents from structured data.
Development 🛠️ License 📄
MIT
Project details
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 laguchori_latex-0.1.5.tar.gz.
File metadata
- Download URL: laguchori_latex-0.1.5.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4acff3cc2ee307eaf9c66183f1bb1724855822b64f1ffc4c59f015839c6c2224
|
|
| MD5 |
6d736c4d8af342d02e092a41d10fb695
|
|
| BLAKE2b-256 |
e6fd67d7f554b5566c9f16293a726d4d738b026431bc9f285b62b2827fb73066
|
Provenance
The following attestation bundles were made for laguchori_latex-0.1.5.tar.gz:
Publisher:
publish.yml on laguchoritarik/laguchori-latex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
laguchori_latex-0.1.5.tar.gz -
Subject digest:
4acff3cc2ee307eaf9c66183f1bb1724855822b64f1ffc4c59f015839c6c2224 - Sigstore transparency entry: 987556377
- Sigstore integration time:
-
Permalink:
laguchoritarik/laguchori-latex@aaa0ebea4d15b261fd9536bafd33400d5702b958 -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/laguchoritarik
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aaa0ebea4d15b261fd9536bafd33400d5702b958 -
Trigger Event:
push
-
Statement type:
File details
Details for the file laguchori_latex-0.1.5-py3-none-any.whl.
File metadata
- Download URL: laguchori_latex-0.1.5-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff19efc8543a255977ec1dff9e4b8d8fad43078fc3c36ab1a59757bb726d732f
|
|
| MD5 |
f331df1521735cf23406416372c6ff35
|
|
| BLAKE2b-256 |
4c26706dea064086dd7581d94e0649bf7dcc86b86564dfdc6959cabcc178bbac
|
Provenance
The following attestation bundles were made for laguchori_latex-0.1.5-py3-none-any.whl:
Publisher:
publish.yml on laguchoritarik/laguchori-latex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
laguchori_latex-0.1.5-py3-none-any.whl -
Subject digest:
ff19efc8543a255977ec1dff9e4b8d8fad43078fc3c36ab1a59757bb726d732f - Sigstore transparency entry: 987556407
- Sigstore integration time:
-
Permalink:
laguchoritarik/laguchori-latex@aaa0ebea4d15b261fd9536bafd33400d5702b958 -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/laguchoritarik
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aaa0ebea4d15b261fd9536bafd33400d5702b958 -
Trigger Event:
push
-
Statement type: