Skip to content

brbavar/katex-for-messenger-web

Repository files navigation

icon

LaTeX for Messenger

Once upon a time we had Chrome extensions (1, 2) that made TeX math rendering possible on Facebook/in Messenger. Facebook then added native support for LaTeX to Messenger, making the second of the listed extensions obsolete, if not the first. Sadly, Messenger no longer supports LaTeX. Both of the extensions listed above are now defunct as they were not maintained after LaTeX support was implemented natively in Messenger.

Rather than trying to salvage those old extensions whose development I had no part in and whose inner workings were a mystery to me, I wrote an extension of my own: LaTeX for Messenger. As this repository's name suggests, LaTeX for Messenger uses KaTeX for rendering, which, when I began development, was a better-documented library than the latest version (3) of MathJax (whose docs were still under construction).

Installation

If you use Chrome, Firefox, or Edge, the easiest option is to install via the Chrome Web Store, Firefox Add-ons, or Edge Add-ons. Alternatively, you can click here to download the ZIP from GitHub, if you know what to do with it (see Build Instructions). This latter approach guarantees you get the latest version of the extension, even if that version has yet to be published in the aforementioned stores.

Build Instructions

Install the latest (LTS or current) version of Node for your operating system and architecture.

Navigate to the root of the project. Run npm install to install all dependencies the build process requires. Then, if the project contains no dist folder, use the command npm run build. Otherwise, use rm -r dist && npm run build to replace the existing build.

Usage

While composing a message on Facebook, write your TeX code between $$ and $$, or \[ and \], to display mathematical notation centered on its own line. Enclose your code in $ ... $ or \( ... \) if you want your mathematical notation on the same line as ordinary text or a separate mathematical expression. The math is rendered only after you hit send (no live preview).

Bear in mind that your math will only be rendered on the screens of those using this extension. Send a message containing TeX code to anyone else, and all they'll see is the code.

Here are a couple examples of what the extension can do:

Screenshot 2025-05-09 at 11 04 05 AM

Screenshot 2025-05-09 at 10 58 52 AM

Limitations

  • If a message is edited in one of your chats while you're using this extension, you'll have to refresh to view the latest version of the message.
  • Typesetting only occurs in chat bubbles.
  • You must place environments between math delimiters to render them.
  • Though KaTeX officially supports the subarray environment, this extension can't seem to render it properly. You'll have to use the \substack command instead, which I have confirmed works perfectly and produces the same results subarray is supposed to (only the lines of the substack are center aligned, and you can't change that like you can with subarray).

About

An extension that uses KaTeX to render TeX in Messenger on the Facebook website.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors