Tusky icon indicating copy to clipboard operation
Tusky copied to clipboard

Add optional Mathjax to Tusky

Open abdullahkhalids opened this issue 3 years ago • 6 comments

Latex style mathematics on the web requires loading Mathjax or Katex javascript libraries. An example of this is this toot, which looks like this in a web browser

image

In Tusky, these libraries are not loaded, so the latex syntax is shown as is. This is what the toot looks like in Tusky

image

Please add an option to loads mathjax or katex libraries inside Tusky.


  • Tusky Version: 20.0

  • Android Version: Any

  • Android Device: Any

  • Mastodon instance (if applicable): N/A

  • [ x] I searched or browsed the repo’s other issues to ensure this is not a duplicate.

abdullahkhalids avatar Dec 29 '22 22:12 abdullahkhalids

I would really like this actually

mcclure avatar Dec 30 '22 06:12 mcclure

Yes, this would be nice to have.

  1. We need Android Java or Kotlin libraries for this though, can't have JavaScript in Tusky
  2. It would be nice if there where some kind of flag in the Api that lets us know that a post contains LaTeX so we render it as the user intended

connyduck avatar Dec 30 '22 09:12 connyduck

There seem to be a couple existing Android libraries

@[email protected] sent me this helpful link that might help us understand exactly what subset is in use on Mathstodon "links at the bottom to lists of supported TeX commands and stuff" https://docs.mathjax.org/en/latest/input/tex/index.html#tex-support

mcclure avatar Dec 30 '22 23:12 mcclure

1. We need Android Java or Kotlin libraries for this though, can't have JavaScript in Tusky

Hmmm. This certainly complicates things.

Usually Mathjax converts the latex mathematics into styled html that is rendered by the browser as usual. This has the advantage that zooming keeps the relative size of the text and math constant.

There are android-friendly libraries for latex, but they convert each latex expression to its own svg image.

abdullahkhalids avatar Dec 31 '22 06:12 abdullahkhalids

How about this one? https://github.com/tech-pw/RenderX

(I'm not a software dev so no idea how suitable it is, just came across this issue while looking for a way to display latex in tusky.)

kilipan avatar Mar 12 '25 07:03 kilipan

For what it's worth, if MathML rendering is significantly easier to implement/fix that might be good enough. There are some patches to support rendering MathML (slowly) making it through the pipeline. I believe Mathstodon already supports it.

omentic avatar Mar 13 '25 10:03 omentic