TeXSnip
A small single-module Python package to generate LaTeX text and equations for your favorite vector graphics tool, with no dependencies required! Except LaTeX, of course.
To get started, simply run:
pip install texsnip
With a few lines of Python code, you can create .pdf files that you can then drag'n'drop into Inkscape, Illustrator, Corel Draw, or most other vector graphics programms.
from texsnip import Snip
# Here, you can modify the LaTeX preamble, for example to configure fonts.
# We use the 'libertine' package, the fonts for the current ACM SIGGRAPH template.
preamble = r"\usepackage{libertine}"
# Write the rendering equation to a file called 'rendering-equation.pdf'
Snip("rendering-equation", 8,
r"$L_o = L_e + \int_\Omega L_i f \cos\theta_i \,\mathrm{d}\omega_i$"
).generate(preamble)
If .pdfs are not supported, don't worry: the script allows you to easily create .png files as well.
Snip("rendering-equation", 8,
r"$L_o = L_e + \int_\Omega L_i f \cos\theta_i \,\mathrm{d}\omega_i$"
).generate_png(preamble)
If you are using these in presentation slides, you can assemble a list of Snips in a .pptx file (uses .png conversion)
from texsnip import Snip, pptx_snips
# Here, you can modify the LaTeX preamble, for example to configure fonts.
# We use the 'libertine' package, the fonts for the current ACM SIGGRAPH template.
preamble = r"\usepackage{libertine}"
snips = [
# Write the rendering equation to a file called 'rendering-equation.pdf'
Snip("rendering-equation", 14,
r"$L_o = L_e + \int_\Omega L_i f \cos\theta_i \,\mathrm{d}\omega_i$"
),
# Sometimes, you need individual terms
Snip("omega_i", 14,
r"$\omega_i$"
),
# Or you might want captions for your illustrations with LaTeX typesetting
Snip("a-caption", 14,
r"\textsf{a) Some \textcolor[RGB]{200,110,5}{cool} illustration}"
)
]
# Lets create a snips.pptx with all these snips in it
# This will also create the corresponding .pdf and .png files for use in other applications
pptx_snips(snips, preamble=preamble)
Dependencies
- Python >= 3.6
- LaTeX with pdfcrop (requires Perl) and xcolor, graphicx, inputenc, fontenc
To generate .png images, you will additionally need:
pip install pdf2image
which requires Poppler to be installed and in the path.
To generate .pptx files, you will need the .png dependencies and also:
pip install python-pptx PyPDF2
Metadata
Release files for texsnip 1.1.0
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 |
|---|---|---|---|---|
| texsnip-1.1.0.tar.gz | 5.1 kB | Without provenance | Details for texsnip-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| texsnip-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for texsnip-1.1.0-py3-none-any.whl |
Total release size: 10.6 kB
Release files / texsnip-1.1.0.tar.gz
| Download URL | texsnip-1.1.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae9d1ffb3365512d6c054585b7cc940bf154e7e815e28fee7f556c78f15efbfc
|
|
BLAKE2b-256 checksum How to use checksums |
9a8e0f274ef3e53fc570e85a845c48d95160e2ee74b8bbe81f7fb54f2998ff73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / texsnip-1.1.0-py3-none-any.whl
| Download URL | texsnip-1.1.0-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d05f9d7cc388442d3dcabffa43d07d22ad30404b05c2788cc35b805fd79ec44
|
|
BLAKE2b-256 checksum How to use checksums |
12a6ae835ef4d2db83ba8f63bf2e25eec10a15a3fd4698be8d951de2d7ac4ba6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for texsnip 1.1.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.