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 that simplifies inserting function outputs into LaTeX documents. The @write_to_latex decorator allows you to automatically write function results into a specified LaTeX file at a predefined keyword location. This is particularly useful for dynamically generating LaTeX reports, papers, or documents with computed values. Installation is straightforward via pip install pytex-lib, and integration requires minimal setup.

Example Usage

Import the Library

from pytex_lib import write_to_latex

Define a Function using the write_to_latex Decorator

Use the @write_to_latex decorator to output your function’s result to a LaTeX file:

@write_to_latex
def compute_square(x):
    return f"The square of {x} is {x**2}"

Initial LaTeX Document (document.tex)

Before calling the function, your LaTeX document (document.tex) might look like this:

\documentclass{article}
\begin{document}

Here is the computed result:
% RESULT_PLACEHOLDER

\end{document}

Call the Function with the LaTeX File and Keyword

Now, execute the function, specifying the LaTeX file and the keyword where the result should be inserted:

file_path = "document.tex"
keyword = "RESULT_PLACEHOLDER"
compute_square(4, file_path=file_path, keyword=keyword)

Updated LaTeX Document (document.tex)

After running the function, document.tex will be updated as follows:

\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.11.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.11-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file pytex_lib-0.1.11.tar.gz.

File metadata

  • Download URL: pytex_lib-0.1.11.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.11.tar.gz
Algorithm Hash digest
SHA256 ea0d1139e9f8f02dc099e46dbbb490d3267a97e3359b833b6e0e15c9beef6c73
MD5 3d93dbf0aac4b920d97b91b4e4ac0850
BLAKE2b-256 9d6be09fa319b81dfac21eaa9cd69e5f7092c5c9a89aaececa0a57e9fb3f75c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytex_lib-0.1.11.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.11-py3-none-any.whl.

File metadata

  • Download URL: pytex_lib-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 3.1 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.11-py3-none-any.whl
Algorithm Hash digest
SHA256 0e471b8a6de1852f258ad0f0d60a19ec6649bcd72c42d67f32507ccc3cd80853
MD5 a762d978c981951013568bc796d031b3
BLAKE2b-256 d20b005df6b138330cc35a1efab67196b960de8647cd40831d0928bb39c03f5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytex_lib-0.1.11-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