On my website (school/math) my users need 24 images for a game. The content of every image is a LaTeX expression, client-side rendered to an image with this code: src = "https://latex.codecogs.com/svg.latex?" But I am not happy with so many calls per game, sometimes 30 of my students are playing at the same time. I prefer rendering in PHP serverside, or javascript clientside. I don't have Node.js (think I cannot run this on my hosted server). I like to be 'self supporting' and not depending on codecogs.

Can anybody help me with a snippet, link or suggestion? Thnx!

  • 1
    Is there any reason why you cannot just replace the images with MathJax or KaTeX? (These would be the javascript solutions. For self-hosting, the full default MathJax installation is huge and can be a burden; depending on your needs you can trim a lot from the installation. For example, for this person only 1.7mb is required; when I hosted MathJax on my own website before, my trimmed installation is 20mb. Nov 22, 2019 at 14:37
  • For MathJax at least, you also have the option of counting on a CDN to host the javascript files. Nov 22, 2019 at 14:40
  • Hi Willie Wong thnx for this comment. I am using KonvaJS (based on HTML5 Canvas), and I don't know how to combine the by MathJax formatted HTML with Canvas/KonvaJS. Indeed, on my website I am using Mathjax on all HTML-pages. Want have a look? wiskunjetrainen.nl//letteroefeningP.php for the MathJax and wiskunjetrainen.nl//letteroefeningL.php for the (Canvas) games
    – Bert Jan
    Nov 23, 2019 at 22:41
  • Sorry, that's beyond my expertise. But if the issue is dynamically generated content, then you can manually invoke MathJax rendering after the content is written. See the documentation for more details. In principle you can also use MathJax to convert LaTeX-style input strings to alternative formats (MathML, SVG, etc) to combine with your other code; the documentation at the above link also tells you how to do that. Nov 25, 2019 at 14:02


You must log in to answer this question.

Browse other questions tagged .