Utility functions for rendering XeLaTeX documents frmo Python
Project description
rvid.tex-runner
A small utility to ease programmatic usage of LaTeX from Python.
Calling XeLaTeX on output
If you just run the xelatex command, you'll get a bunch of temp files output
to your current working directory.
The function rvid.tex_runner.make_pdf_at_path() finds the xelatex-command, creates a
temp-directory, runs the command, moves the PDF-file into the location you
specified and then cleans up all the temp files.
Handling paths to external resources
To handle external resources that are needed to build your PDF files, tex-runner has a
concept of ExternalResource. This is a Python object that contains a sequence of
absolute file paths and a relative target path (basedir) where your .tex files expect
to be able to include them from. For example:
ExternalResource(
basedir="images",
files=[
"/Users/sean.banan/tex/img1.png",
"/Users/sean.banan/tex/img2.png",
]
)
This concept also comes in handy if you have differing paths in different deployment environments, since it allows you to abstract that away programmatically.
Auto-generating ExternalResource-libraries
There is a utility function for auto-generating ExternalResource-objects from filesystem paths:
>>> make_external_resource_library(source_directory="c:/pix", relative_target_directory="img")
ExternalResource(basedir="img", files=["c:/pix/q1.jpg"])
Debugging
Change rvid.tex_runner.latex:make_pdf_in_tempdir() so that it doesn't delete the tempdir after finishing the run.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 rvid.tex_runner-0.0.1-py3-none-any.whl.
File metadata
- Download URL: rvid.tex_runner-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f7912e6ad6f2006c92cdd261f38f8e277835e6ebc5cded6fde896ec82b9a97a
|
|
| MD5 |
409a25aed3cc3b1b6cb27662eb324b2e
|
|
| BLAKE2b-256 |
115ae4d94736c0f1fa25ec3cd1a9a09b9adb8243de2fef1247e41b836618f073
|