🏠 back to Observable

has anyone tried using LaTeX for SVG labels?

Is there any established best practice for putting LaTeX inside diagrams on the web?

It seems that MathJax can render to SVG outlines. It’s probably also possible to get HTML elements (rendered by KaTeX) positioned over/inside an SVG file, but I’m not sure how friendly it plays with resizing etc.

Does anyone know of good examples around the web?

2 Likes

I had this same question and found this post while searching the forum for an answer.

David Cervone says that the only way to get typeset math into SVG with MathJaX is to use the SVG foreignObject element. This same technique seems to work with KaTeX. I used exactly this technique to place the labels on the axis for this dynamic cycloid.

There are probably issues.

1 Like