TexRocket
A basic template engine for LaTeX. Create dynamic documents by parsing JSON data and populating a custom template.
The script parses a template and fills it with data read from json files. Provide different json files to have multiple files with the same structure but varying content. Especially useful for translations.
Requirements
Make sure you have the following programs installed on your system before moving forward.
- python
- LaTeX
Installation
Easily install TexRocket by using pip
pip install texrocket
Usage
At any time you can run the texrocket script with the -h or --help flag to display usage information
usage: texrocket [-h] [-i INPUT_JSON] [-o OUTPUT_DIR] [-v] input_tex
Dynamic LaTeX generation from JSON, developed by Alberto Mosconi
positional arguments:
input_tex the LaTeX template file
options:
-h, --help show this help message and exit
-i INPUT_JSON, --input-json INPUT_JSON
the JSON file or directory of files
-o OUTPUT_DIR, --output-dir OUTPUT_DIR
the directory for the output files
-v, --verbose print verbose output and save LaTeX logs
An example using all possible arguments is
texrocket TEMPLATE.tex -i input.json -o out/ -v
This will create an out/ folder, with the documents generated using the TEMPLATE.tex template and the values inside input.json
out/
├── source/
│ └── TEMPLATE_input.tex
├── logs/
│ └── TEMPLATE_input.log
└── TEMPLATE_input.pdf
! All the JSON files MUST have the same structure, the engine will create multiple documents (one for each .json file) starting from TEMPLATE.tex.
The generated files have the following naming scheme
<TEMPLATE FILENAME>_<JSON FILENAME>.pdf
If the input JSON file is named main.json then this will not show up
<TEMPLATE FILENAME>.pdf
Syntax
Values
To display a certain JSON value reference it with the following syntax
<section.title>
{
"section": {
"title": "The section title",
"text": "some text"
}
}
The example above will be rendered as "The section title".
Loops
You can avoid repetition of LaTeX code by using loops, which can be nested
\begin{itemize}
%startloop: first
\item <name>
\begin{itemize}
%startloop: second
\item <name>
%endloop
\end{itemize}
%endloop
\end{itemize}
{
"first": [
{
"name": "first main list item",
"second": [
{ "name": "secondary list item" }
]
},
{
"name": "second main list item",
"second": [
{ "name": "secondary list item" }
]
}
]
}
Metadata
Release files for texrocket 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| texrocket-0.0.9.tar.gz | 16.8 kB | Without provenance | Details for texrocket-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| texrocket-0.0.9-py3-none-any.whl | Python 3 | none | any | Details for texrocket-0.0.9-py3-none-any.whl |
Total release size: 34.3 kB
Release files / texrocket-0.0.9.tar.gz
| Download URL | texrocket-0.0.9.tar.gz |
|---|---|
| Size | 16.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
65a8ffafe5e263338ee5dbf8f1069aa98ff739bb8a0955be6a244c19c7f53fef
|
|
BLAKE2b-256 checksum How to use checksums |
e65a2d1f935a79f0299c48dad3b99a90ff0e914dcada48efe64613b808e07e01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2
|
Release files / texrocket-0.0.9-py3-none-any.whl
| Download URL | texrocket-0.0.9-py3-none-any.whl |
|---|---|
| Size | 17.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9571a6da8a340f83fd8b89fe57e35ac9f7e2d8bd5dd64265566f4c9a9a524ec7
|
|
BLAKE2b-256 checksum How to use checksums |
afea62102238b990f0acb39c11a29584d02c47681ad21f2efa99d0cdb525fb38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2
|
Security for texrocket 0.0.9
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.