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 16 pixels
    $ image_to_katex image.png 16
    $ # 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.1.tar.gz (5.1 kB view hashes)

Uploaded Source

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