HighlighTeX

By: Sam Kimak

04/16/2024

Categories: Project Tags: Extension

HighlighTeX is a Firefox extension I wrote to save myself a few steps when sharing math. Plenty of places I type in, like chat apps and some note tools, don’t render LaTeX, so I kept copying equations into an online renderer, saving the image, and pasting it back. This cuts that down to a right-click.

Using it

  1. Highlight some LaTeX on any webpage, for example \frac{a}{b} + \sqrt{x}.
  2. Right-click the selection and choose Create Latex Image.
  3. Paste. The rendered equation is now on your clipboard as a PNG.

How it works

The whole extension is one background script. It adds an entry to the right-click menu that only shows up when text is selected. When you click it, the selected text is sent to the CodeCogs LaTeX renderer at 200 DPI, and the PNG that comes back is written straight to the clipboard with Firefox’s clipboard.setImageData API. Nothing is saved to disk, and there’s no settings page to configure.

Since rendering happens on CodeCogs’ servers, you need a network connection, and whatever you highlight is sent to them.

Source

The code is on GitHub: Skimak/highlightex

>> Home