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.3.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

json2latex-0.0.3-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: json2latex-0.0.3.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for json2latex-0.0.3.tar.gz
Algorithm Hash digest
SHA256 c3adae82299bd23f36cf9daefa5a0d95303023581562b70c0d67d327e288feac
MD5 6b35aa98e70557a0756b47874b064eb4
BLAKE2b-256 e89ade1c5444b10a242eb1e8105bbef4286beb65c8df28235dbbc827683903d0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: json2latex-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for json2latex-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f15f65bfbe40bb9b704e6192d7ba16c9562b40408644a9e586018ab7735048a0
MD5 4bace35a07ffa959d832cdbc3e700c4b
BLAKE2b-256 39d3d70bd5a5e3c889faa0aca7868fb4025a771a884104d7593ca0acaf55cda4

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