Skip to main content

Convert an image into KaTeX to use in Facebook Messenger

Project description

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

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

katex-0.0.4.tar.gz (5.3 kB view details)

Uploaded Source

File details

Details for the file katex-0.0.4.tar.gz.

File metadata

  • Download URL: katex-0.0.4.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for katex-0.0.4.tar.gz
Algorithm Hash digest
SHA256 cb5a21808163d6c80c95607cc20df217a4f4fa8d14e99cb6cfde020348b15d98
MD5 65d43fee194badce8826924a55377e78
BLAKE2b-256 2a35a6a790a8a37fa741851dfe4df92ec729153833cbb6d24be97581875c4dd4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page