Decorate your functions to direct the output to a LaTeX file.
Project description
pytex-lib
pytex-lib is a Python library for inserting function outputs directly into LaTeX documents.
The @write_to_latex decorator automatically writes a function’s return value into a LaTeX
file at a specified keyword location.
This is useful for generating LaTeX reports, papers, or documents that include computed results without manual editing.
Example Usage
Import the Library
from pytex_lib import write_to_latex
Define a Function Using the Decorator
Decorate a function that returns a string:
@write_to_latex
def compute_square(x):
return f"The square of {x} is {x**2}"
Initial LaTeX Document (document.tex)
The output will be inserted immediately after the line containing the keyword.
\documentclass{article}
\begin{document}
Here is the computed result:
% RESULT_PLACEHOLDER
\end{document}
Call the Function
Provide the LaTeX file path and keyword at call time:
compute_square(
4,
file_path="document.tex",
keyword="RESULT_PLACEHOLDER",
)
Updated LaTeX Document
After execution, document.tex becomes:
\documentclass{article}
\begin{document}
Here is the computed result:
% RESULT_PLACEHOLDER
The square of 4 is 16
\end{document}
Installation
pip install pytex-lib
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 pytex_lib-0.1.13.tar.gz.
File metadata
- Download URL: pytex_lib-0.1.13.tar.gz
- Upload date:
- Size: 2.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 |
00e6ce190911a41f2a60923a3282965ca5b9187e5548480acb0d9bdfe51f9651
|
|
| MD5 |
eb1db58697194c1acfbb5d7d0d2d302c
|
|
| BLAKE2b-256 |
c9db81b236386f0c8f9a66c394387b0d3ccd1c308a3a423ea61c4c514b01b556
|
Provenance
The following attestation bundles were made for pytex_lib-0.1.13.tar.gz:
Publisher:
default-python-publish.yml on gkerr708/pytex-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytex_lib-0.1.13.tar.gz -
Subject digest:
00e6ce190911a41f2a60923a3282965ca5b9187e5548480acb0d9bdfe51f9651 - Sigstore transparency entry: 767491442
- Sigstore integration time:
-
Permalink:
gkerr708/pytex-lib@219dc7530ebd57b236c299d6139a53ef38c4201e -
Branch / Tag:
refs/tags/v0.1.13 - Owner: https://github.com/gkerr708
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
default-python-publish.yml@219dc7530ebd57b236c299d6139a53ef38c4201e -
Trigger Event:
release
-
Statement type:
File details
Details for the file pytex_lib-0.1.13-py3-none-any.whl.
File metadata
- Download URL: pytex_lib-0.1.13-py3-none-any.whl
- Upload date:
- Size: 3.2 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 |
6132ad7763ec47f8e89a4bfc6ca0ba7d542aaa49fb7111f4c21e2cda26d41c71
|
|
| MD5 |
952fb6c928a176b3aafb9b9320ba2ad2
|
|
| BLAKE2b-256 |
97690d3f60b9185c2542de9d67ce4161910a393ed663c765bd22963f24d38c24
|
Provenance
The following attestation bundles were made for pytex_lib-0.1.13-py3-none-any.whl:
Publisher:
default-python-publish.yml on gkerr708/pytex-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytex_lib-0.1.13-py3-none-any.whl -
Subject digest:
6132ad7763ec47f8e89a4bfc6ca0ba7d542aaa49fb7111f4c21e2cda26d41c71 - Sigstore transparency entry: 767491446
- Sigstore integration time:
-
Permalink:
gkerr708/pytex-lib@219dc7530ebd57b236c299d6139a53ef38c4201e -
Branch / Tag:
refs/tags/v0.1.13 - Owner: https://github.com/gkerr708
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
default-python-publish.yml@219dc7530ebd57b236c299d6139a53ef38c4201e -
Trigger Event:
release
-
Statement type: