Yesterday @M42, a good friend of mine told me there was a partial solution to render $\LaTeX$ equations in Telegram Desktop, ChatJax, a code line that inserts a <script> html tag in the current page’s <head>, allowing sent $\LaTeX$ code in a Telegram Desktop Window to render. This could be saved as a handy boomark and be executed every time we’d like to render sent equations.

However, this had a big problem, appart from the obvious necessity of clicking the boomark every time we’d like to use it. If we started to use it in an open conversation, it would render the sent equations properly, but from now on, it would also try to render all non sent equations, producing a (curious) unwanted result.

Unsent $\LaTeX$ already rendered

Sent $\LaTeX$ as a rare encoding

So I started finding a solution, and after one hour of trying to make this code work automatically (with GreaseMonkey), once started the browser, and realizing that I have to target only a part of the Telegram Desktop Window to be rendered, I arrived to an useful MathJax Documentation about doing so with MathJax.Hub.Queue and it worked out!.

I’ve written a public gist here with a GreaseMonkey extension to render equations properly in Telegram Desktop. I’ve only given it a try in Firefox, and it works well!.

To download it, GreaseMonkey extension must be installed in the current browser, and it suffices to click Raw from the gist page, and it will pop up a confirmation to install it as an user script. To write inline $\LaTeX$, use a simple $. To write centered $\LaTeX$, use $\$.

The script is also available from GreasyFork here.