Skip to main content

A package for converting JSON and other similar structures to a format accessible using LaTeX.

Project description

Travis Status Documentation Status PyPI Version License

JSON to LaTeX

json2latex is a library for converting a nested Python structure to a format accessible in LaTeX.

Installation

JSON to LaTeX can be installed using pip by running pip install json2latex,

Usage

Full documentation of JSON to LaTeX is provided here. The basic usage is as follows.

The following Python code saves a file, `out.tex which includes the necessary LaTeX commands to access the data in LaTeX.

import json2latex

data = dict(a="test", b=[1, 2])

with open('out.tex', 'w') as f:
    json2latex.dump('data', data, f)

The same result can be accomplished by running,

json2latex example.json data out.tex

where example.json is a JSON file containing the same data is the data` dictionary in the Python example.

The code output by JSON to LaTeX can be used as follows. First the file needs to be imported in LaTeX using \input{out.tex}. Then, the following commands can be used to access the data:

  • \data will expand to the full JSON representation of the input, {"a": "test", "b": [1, 2]}.
  • \data[a] will expand to test.
  • \data[b] will expand to [1, 2].
  • \data[b][0] will expand to 1.
  • \data[b][1] will expand to 2.
  • \data[b][2], and all other undefined values, will expand to ??.

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

json2latex-0.0.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

json2latex-0.0.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file json2latex-0.0.2.tar.gz.

File metadata

  • Download URL: json2latex-0.0.2.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0

File hashes

Hashes for json2latex-0.0.2.tar.gz
Algorithm Hash digest
SHA256 b3e5cbc1c146fef7d3c68df8e7181d92bd377cbe413e82c5fbd38cdc2b5b168b
MD5 d6a3c96a51d77925c7346d98efb8a579
BLAKE2b-256 0c6f96dacfaf281181d67941c449f90e17f3b7fecca8a53d87fc336f0b4e6d0d

See more details on using hashes here.

File details

Details for the file json2latex-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: json2latex-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0

File hashes

Hashes for json2latex-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 16736ec76bcbdd3ff60426259a5f462ade6a643106fe1c75baec4a27003cdfb9
MD5 b80f00bbc43e5d113900aa7de0b73ddb
BLAKE2b-256 6620d775b0a666d279d90f3e0bcc1aff5c03bc24c7f7e6e9bd4b91e850633739

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page