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 wtl

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.12.tar.gz (3.0 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.12-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytex_lib-0.1.12.tar.gz
  • Upload date:
  • Size: 3.0 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.12.tar.gz
Algorithm Hash digest
SHA256 d953ba2b9341ca6082e08e67dc3740e0c8f145486e970ea953c7b8fad74d5776
MD5 25ee2809b9dae162098ea34c45b15293
BLAKE2b-256 d11012cce3c03d6cc510243eddfbdd1591305e93372da4f3bee93516262652b3

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pytex_lib-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 3.3 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.12-py3-none-any.whl
Algorithm Hash digest
SHA256 ab656f0891ffd80093edcd629f606ed270e2a932e09c0f9567723945a0bbcdf8
MD5 1120dafc352707da1e992042e38467ea
BLAKE2b-256 26ba3fda66c3f669142d2fd0e0de8b8538aade712b41e64ebe124047e4362d31

See more details on using hashes here.

Provenance

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