Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytex_lib-0.1.13.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytex_lib-0.1.13-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

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

Hashes for pytex_lib-0.1.13.tar.gz
Algorithm Hash digest
SHA256 00e6ce190911a41f2a60923a3282965ca5b9187e5548480acb0d9bdfe51f9651
MD5 eb1db58697194c1acfbb5d7d0d2d302c
BLAKE2b-256 c9db81b236386f0c8f9a66c394387b0d3ccd1c308a3a423ea61c4c514b01b556

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytex_lib-0.1.13.tar.gz:

Publisher: default-python-publish.yml on gkerr708/pytex-lib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for pytex_lib-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 6132ad7763ec47f8e89a4bfc6ca0ba7d542aaa49fb7111f4c21e2cda26d41c71
MD5 952fb6c928a176b3aafb9b9320ba2ad2
BLAKE2b-256 97690d3f60b9185c2542de9d67ce4161910a393ed663c765bd22963f24d38c24

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page