Skip to main content

A Python CLI tool for converting LaTeX equations into Typst equations

Project description

tex2typ

Release Build status codecov Commit activity License Checked with mypy Ruff

A Python CLI tool for converting LaTeX equations into Typst equations and back

Quick start as a uv tool (recommended)

uvx tex2typ <YourLaTeXEquation> <options>

Example:

uvx tex2typ "\boldsymbol{H^i} = -\frac{1}{j\omega\mu_0}\nabla\times\boldsymbol{E^i}" -c

Will return and copy to clipboard:

$ bold(H^i) = - frac(1, j omega mu_0) nabla times bold(E^i) $

Installation

tex2typ requires Pandoc and Typst to be installed

tex2typ is hosted on PyPI and can be installed through uv or pip. We recommend using it as a uvx tool: uv:

uvx tex2typ

Running CLI

If using a virtual env or conda, run

uvx tex2typ <YourEquation> <options>

Where -c automatically copies the resulting Typst equation to your clipboard, and -r allows you to convert back from Typst to LaTeX.

Example:

uvx tex2typ "\boldsymbol{H^i} = -\frac{1}{j\omega\mu_0}\nabla\times\boldsymbol{E^i}" -c

Which will return and copy to the clipboard:

$ bold(H^i) = - frac(1, j omega mu_0) nabla times bold(E^i) $

Typst to LaTeX

By providing the -r option, one can convert from typst to LaTeX. Example:

uvx run tex2typ "bold(H^i) = - frac(1, j omega mu_0) nabla times bold(E^i)" -r

Will return:

\mathbf{H^i} = -\frac{1}{j\omega\mu_0}\nabla\times\mathbf{E^i}

Options:

  • -c or --copy: Copy the result to your clipboard
  • -r or --reverse: Convert from Typst to LaTeX (default is LaTeX to Typst)

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

tex2typ-0.0.3.tar.gz (32.8 MB view details)

Uploaded Source

Built Distribution

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

tex2typ-0.0.3-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tex2typ-0.0.3.tar.gz
  • Upload date:
  • Size: 32.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for tex2typ-0.0.3.tar.gz
Algorithm Hash digest
SHA256 23a5e96947ef336de333bbc7c6718f8206a26334aba1ec323de6365042c10170
MD5 47c2b92323669800ec0c02a41cacc39a
BLAKE2b-256 80eae967b49d220f5175e22be6231824aa3a5bf2a13786a8c937ff7309d12a0a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tex2typ-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for tex2typ-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0680f01c8f1279faa2d94f13fac78f868c3a356f6c41d1346f52b9c5a9ca8155
MD5 c72f88534a8737accf49ffb666bffd93
BLAKE2b-256 87ed33a0d0190db08b8775ab35e167ed00f482cd76c4e04cf9c233480630c656

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