Render Katex on SVG #3288
-
Is it possible to render katex on top of a svg file? I am trying to do something similar to whats been done for KA link I have shared below. How can I render Katex the same way? Please refer the first diagram in the link below. If you inspect the first diagram, its a SVG and katex is used for writing all numbers on top of the number line SVG. To Reproduce:
Expected behavior: Screenshots: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If you look at the subsequent It's hard but possible to do this type of placement by hand, but much easier to do with a tool. In this case, Khan Academy exercise figures seem to be built with a tool called Graphie that does it, though I can't find that project so it may not be open source. (Others, feel free to give a pointer if you know one.) |
Beta Was this translation helpful? Give feedback.
If you look at the subsequent
<span>
s after the<svg>
, you'll see that the KaTeX is not inside the SVG, it's just overlapping in terms of layout. This is accomplished viaposition: absolute
to place the KaTeX labels where wanted within the containing<div>
(which isposition: relative
).It's hard but possible to do this type of placement by hand, but much easier to do with a tool. In this case, Khan Academy exercise figures seem to be built with a tool called Graphie that does it, though I can't find that project so it may not be open source. (Others, feel free to give a pointer if you know one.)