# has anyone tried using LaTeX for SVG labels?

**URL:** <https://talk.observablehq.com/t/has-anyone-tried-using-latex-for-svg-labels/1837>\
**Category:** Help\
**Created:** [March 31, 2019, 9:43pm UTC](https://talk.observablehq.com/t/has-anyone-tried-using-latex-for-svg-labels/1837 "2019-03-31T21:43:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrus](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/jrus/32/586_2.png) [@jrus](https://talk.observablehq.com/u/jrus)\
**Post date:** [March 31, 2019, 9:43pm UTC](https://talk.observablehq.com/t/has-anyone-tried-using-latex-for-svg-labels/1837/1 "2019-03-31T21:43:15Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![mcmcclur](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mcmcclur/32/2364_2.png) [@mcmcclur](https://talk.observablehq.com/u/mcmcclur)\
**Post date:** [November 19, 2019, 6:08am UTC](https://talk.observablehq.com/t/has-anyone-tried-using-latex-for-svg-labels/1837/2 "2019-11-19T06:08:17Z")

</div>

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

[David Cervone says](https://stackoverflow.com/questions/15962325/mathjax-inside-svg/15973585#15973585) 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](https://observablehq.com/@mcmcclur/cycloid-start).

There are probably issues.
