Skip to main content

Include python variable values in a LaTeX document

Project description

python-latex-bridge

Python package to include python variables in a LaTeX document.

Example

Some use cases given a file with

from bridge import save
from uncertainties import ufloat
from pint import UnitRegistry
ureg = UnitRegistry()
Q = ureg.Quantity
  • Any python value:
    x = 1024
    save(x) # creates `variables/variable.dat` containing "1024"
    
  • Uncertain value:
    x = ufloat(3.1, 0.2)
    save(x, name='height') # creates `variables/height.dat` containing "3.10 \pm 0.20"
    
  • Variable with unit
    x = Q(42, 'mm')
    save(x, path='values') # creates `values/variable.dat` containing "42\,\si[]{\milli\meter}"
    
  • Error and unit:
    x = Q(ufloat(420, 7), 'ohm')
    save(x) # creates `variables/variable.dat` containing "(420 \pm 7)\,\si[]{\ohm}"
    

Usage in LaTeX

To fetch the value in a LaTeX document, simply include the .dat file in math mode

$\include{variables/variable.dat}$

assuming the .tex file and the variables/ folder share the same parent directory.

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

python-latex-bridge-0.0.1.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

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

python_latex_bridge-0.0.1-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file python-latex-bridge-0.0.1.tar.gz.

File metadata

  • Download URL: python-latex-bridge-0.0.1.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

File hashes

Hashes for python-latex-bridge-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9c8cfaff9393a741b9a929847b1a1ccfcc3b85c63d8a8d6bda50568c923c0f4f
MD5 154a57867e2923559cf0495ce2962b9f
BLAKE2b-256 2bda042b8514578f0e17329868fabb222041ad110b2769c608e86b0f229b9356

See more details on using hashes here.

File details

Details for the file python_latex_bridge-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: python_latex_bridge-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

File hashes

Hashes for python_latex_bridge-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3e141ee7841d7901522a60ca2c3229c8ae8614a3c6402cdb20c48c5106b57478
MD5 651a51e162b64034803a409c13a1d7d1
BLAKE2b-256 53d1d2e153486c72075c855c5c7f1a477100e17640be32fa432a2da16c95158c

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