LeanTeX

LeanTeX lets you embed Lean 4 code snippets directly in LaTeX and render both Lean output and diagnostics inside your compiled PDF.


Installation

Before continuing, make sure you have all required tools installed (see the Requirements tab).

1) Clone

git clone https://github.com/rgrossharv/LeanTeX.git
cd LeanTeX

2) Install Python package

python3 -m pip install .
Developer install:
python3 -m pip install -e .
If older pip errors on bdist_wheel:
python3 -m pip install --upgrade pip setuptools wheel

3) Install TeX package files

leantex install-tex

Quick Start

In your document:
\usepackage{leantex}
Build once:
leantex build path/to/file.tex
Watch mode:
leantex watch path/to/file.tex
Without global install:
PYTHONPATH=. python3 -m leantex build path/to/file.tex

LaTeX Usage

\begin{lean}[name=demo,show=both]
#check Nat.succ
\end{lean}
Shared-context mode:
\usepackage[onefile]{leantex}
# or
\usepackage{leantexonefile}

Examples

Examples live in examples/minimal. Use the dedicated examples page to view source and output: open examples page.


Documentation

For full details, see the README.