Skip to main content

Export individual data from a Python script to a LaTeX document

Project description

LaTeXDatax.py

Import calculated values from a python script into a LaTeX document. This is a python interface for the datax LaTeX package [ctan].

Installation

pip install LaTeXDatax

Usage

In a python script:

from LaTeXDatax import datax
datax(
		filename = "data.tex",
		a = "Literal string",
		b = 3.141592,
		c = (3.141592,"\\meter"),
		d = (3.141592,"\\meter","%.2g"),
		e = (3.141592,"%.2g"),
     )

In the LaTeX document:

\documentclass{article}
\usepackage{siunitx}
\usepackage{datax}
\begin{document}
	The length was measured as \(d=\datax{d}\).
\end{document}

Pint integration

from pint import Quantity
from LaTeXDatax import datax
datax(filename = "data.tex", E = Quantity(24,"kg m / s^2"))

Works as you would hope, in large part because of how well pint implements siunitx strings. Hat off.

Looking for contributors

I don't know python very well. This package works, but if you have ideas for how to improve it, or you spot some python faux pas, feel free to make a PR or get in touch!

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

LaTeXDatax-1.3.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

LaTeXDatax-1.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file LaTeXDatax-1.3.tar.gz.

File metadata

  • Download URL: LaTeXDatax-1.3.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for LaTeXDatax-1.3.tar.gz
Algorithm Hash digest
SHA256 30e8da781d069d3c6f5115a19e912f05d2570e0fb65f5f62685574906912f733
MD5 ce9118db684dc1b58d09ebb5fbd2a48f
BLAKE2b-256 7ef351c60fbd93e90e49053439f2a8668fbae7e7fdc81556f2482870db46499e

See more details on using hashes here.

File details

Details for the file LaTeXDatax-1.3-py3-none-any.whl.

File metadata

  • Download URL: LaTeXDatax-1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for LaTeXDatax-1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 629479ad27c6a3e02306b8fd7d4e1684695ce05122ebc222dce74246dc2042d9
MD5 802ea0cfe517f3766e01820fc6378ede
BLAKE2b-256 ea6783dfa6e37217a1e8cdcffd82c97f67e113de79236d1047078ffd5e87bb1b

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