Skip to main content

Python KaTeX

Contains functionality to convert an image into KaTeX, using \rules

Also currently only set up to work with Facebook Messengers KaTeX setup, but it should be simple to adapt for other applications.

More functionality is planned, and PRs welcome!

Installation

$ # This will install the python package `katex`, along with the shell command
$ # `image_to_katex`
$ pip install katex

Basic usage

$ # This will generate KaTeX output for that image, where the image is scaled
$ # down to 30 pixels, and where each pixel is 5 units wide
$ image_to_katex image.png -s 30 -ps 5
$ # Display help message
$ image_to_katex --help

Facebook KaTeX info

KaTeX version: v0.8.2 (17/8-2017)

Max length of Facebook messages is 20000 chars.

Facebook renders any KaTeX error messages in the html title attribute.

You can use $$ or \(+\) as delimeters. $$ renders the LaTeX in displayMode, \(+\) renders it inline.

Facebook wraps all inputs in a \color block, like this: \color{#fff}{inp}, where inp is the input

Known KaTeX options:

  • displayMode = true if $$ else false
  • colorIsTextColor: false
  • maxSize: 50
  • maxExpand = 25

Metadata

Release files for katex 0.0.4

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

Source distribution (sdist)

Source distribution for katex 0.0.4
File Size Uploaded
katex-0.0.4.tar.gz 5.3 kB Details

Release files / katex-0.0.4.tar.gz

Download URL katex-0.0.4.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cb5a21808163d6c80c95607cc20df217a4f4fa8d14e99cb6cfde020348b15d98
BLAKE2b-256 checksum
How to use checksums
2a35a6a790a8a37fa741851dfe4df92ec729153833cbb6d24be97581875c4dd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.14.0 CPython/3.4.3

Release history Release notifications | RSS feed

This release

0.0.4 This release

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

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