Get startedInstallation

Installation

Install TeXForm from pip, npm, or cargo, and verify it works in Python, JavaScript, or Rust.

TeXForm ships the same Rust core through three package registries. Install it for your language, then run the verification snippet to confirm the native module loaded.

Shell
pip install texform

The package is a compiled extension distributed as prebuilt wheels and requires Python 3.10 or newer. Bundled .pyi type stubs and a py.typed marker give you full type checking and editor completion with no separate stubs package.

Python
import texform

engine = texform.TransformEngine(profile="corpus")
print(engine.normalize(r"a \over b"))
Output
\frac { a } { b }
Shell
npm install texform

The package is powered by WebAssembly, with TypeScript declarations bundled — no separate @types package. It ships two entry points for loading the .wasm module, and choosing the right one is the most common pitfall with a WASM package: texform/node targets Node.js, and texform/bundler targets browser-oriented bundlers such as Vite or webpack 5. The bare texform import resolves to the Node entry under Node.js and the bundler entry under a bundler, so most projects can import texform directly; force a specific entry only when the automatic resolution picks the wrong one.

The bundler entry initializes the WebAssembly module at module load time, which needs a bundler that supports top-level await and .wasm assets. JavaScript and WebAssembly walks through both entry points, the bundler configuration they expect, and the handle lifecycle.

JavaScript
import { TransformEngine } from 'texform/node';

const engine = new TransformEngine({ profile: 'corpus' });
console.log(engine.normalize('a \\over b'));
Output
\frac { a } { b }
Shell
cargo add texform

The texform facade crate is the only public, stability-guaranteed entry point. It depends on internal texform-* crates that are published only because crates.io requires it; their APIs may change in any release, so do not depend on them directly.

Rust
use texform::{Profile, TransformEngine};

let engine = TransformEngine::builder().profile(Profile::Corpus).build()?;
let result = engine.normalize(r"a \over b")?;
assert_eq!(result, r"\frac { a } { b }");

Once the verification snippet runs, continue to the Quick start for the full normalize-and-inspect path.

Command-line tool#

The texform command serves shell scripts and tools that call TeXForm across a process boundary. It ships with the Python package; install it as a standalone tool, or run it once with uvx texform:

Shell
uv tool install texform    # or: pipx install texform
texform normalize --profile corpus 'a \over b'
Output
\frac { a } { b }

With a Rust toolchain, cargo install texform-cli builds the same tool as a native binary. Command line covers every command, the JSON output, and the texform serve protocol.

Next steps#

Last updated