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

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

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:

\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.9.tar.gz (2.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.9-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytex_lib-0.1.9.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.10.12 Linux/5.15.0-131-generic

File hashes

Hashes for pytex_lib-0.1.9.tar.gz
Algorithm Hash digest
SHA256 3c3a162708de98411480a434b347fcc0a20df834a81f8cbd3153ff8daf6d3baf
MD5 43535bd89bb3142e36d31dd38dd16424
BLAKE2b-256 1a9d7a86cb5e2eaa12ccc58d6a1483dbd2130af9321573abf8a0f538dfbf1fc7

See more details on using hashes here.

File details

Details for the file pytex_lib-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: pytex_lib-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.10.12 Linux/5.15.0-131-generic

File hashes

Hashes for pytex_lib-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 a9eef6f07902f3e65de57d51bd0820ac68ecf05cae6f87f65bb0afee3ad1213d
MD5 b54b1e26ef62895b89cdf5b946038142
BLAKE2b-256 c8ea6d43ea63d0a24fd39c32186fa07c694b6669f03eb02c0973bb1c68e31060

See more details on using hashes here.

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