Skip to main content

py-katex

Python TeX 数学公式解析、排版与静态绘制,基于 KaTeX 0.18.11 核心移植。 数学字体和度量随包提供;通过公开 py-skia-canvas API 输出 PNG、JPEG、WebP、SVG、PDF,运行时无需 Node、浏览器或联网字体。

安装

python -m pip install py-visactor-katex==0.1.1

发行名为 py-visactor-katex,导入名为 py_katex,命令行为 py-katex。 需要 CPython 3.13;当前原生依赖支持 Windows AMD64 和 Linux glibc 2.28+ x86_64。

最小示例

from pathlib import Path
from py_katex import render

result = render(r"x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}",
                font_size=28, display_mode=True, backend="cpu", format="svg")
Path("formula.svg").write_bytes(result.data)
py-katex "x^2+y^2=z^2" --display --backend cpu -o formula.png

能力与边界

支持符号、字体、分式、根式、脚标、极限、伸缩括号与重音、矩阵、AMS/CD 环境、编号、作用域宏与显式离线资源。 默认错误会抛出异常;选择可见错误输出时应检查诊断,不能将错误图当作成功公式。 HTML/MathML 序列化、任意浏览器 CSS、交互和独立 contrib 插件(如 mhchem)不属于核心静态范围;不承诺与浏览器逐像素相同。

文档

MIT License;KaTeX 与字体归属见第三方声明。

Metadata

Release files for py-visactor-katex 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-visactor-katex 0.1.1
File Size Uploaded Provenance Actions
py_visactor_katex-0.1.1.tar.gz 754.6 kB With provenance Details for py_visactor_katex-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py-visactor-katex 0.1.1
File Interpreter ABI Platform Actions
py_visactor_katex-0.1.1-py3-none-any.whl Python 3 none any Details for py_visactor_katex-0.1.1-py3-none-any.whl

Total release size: 1.2 MB

Release files / py_visactor_katex-0.1.1.tar.gz

Download URL py_visactor_katex-0.1.1.tar.gz
Size 754.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7df84fbcf44f8b2a8335a776e19e18f5d2b3935e094435ad1927a8df4fd33738
BLAKE2b-256 checksum
How to use checksums
7db59639b9b81dae4cccdf9ca0360502c80d3825261f047d009279663e07687e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / py_visactor_katex-0.1.1-py3-none-any.whl

Download URL py_visactor_katex-0.1.1-py3-none-any.whl
Size 443.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e0350843c315b87cfbfe1541c6639ffe1d7d449847c66111e911ef9538c69aa
BLAKE2b-256 checksum
How to use checksums
274edc175ccfdd6fc54afa8fa71510c38535a28eb708a4cc98172d6d007296cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Security for py-visactor-katex 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for py_visactor_katex-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page