This fails to produce working file with htlatex:




\tikz \node (foobar) {$\cong$};


Changing \node to \node[tex4ht node/escape=true] does not help. Is there easy way to correct this, or should I forget this and try with \usetikzlibrary{external}?

(Putting, for example, \subset instead of \cong to tikz picture works.)

  • I suspect it could be because \cong is a macro construction, and subset maps directly to a single character. Congruence can be found from Unicode slot U+02245, so maybe using the unicode-math-package could help here?
    – morbusg
    Jul 1, 2013 at 12:47
  • After adding unicode-math (and changing to htxelatex) I got empty page --- even with \subset that worked before it. Jul 1, 2013 at 13:30

1 Answer 1


The problem is that the mathematical content is converted to bitmap images by default with tex4ht. But as tex4ht doesn't know it is inside svg, it outputs <img src=..." element, which is unsupported in svg. If math in the tikz nodes is simple, just characters, you can call htlatex with

htlatex filename "xhtml, mathml"

this will output all math in mathml, and simple math elements like \cong will output as html entities. But if you have fractions or something similar in your nodes, this will fail, because svg file doesn't know about mathml elements and it will not to render.

  • ah, I can think of two ways with <img> inside SVG: 1) To put it inside a <foreignObject> (with XML namespace defined on it), or 2) change <img src=...> to <image xlink:href=...> (needs XML namespace defined in the SVG; xmlns:xlink="http://www.w3.org/1999/xlink"). Both MathML and SVG (and XHTML) are all XML, so mixing and matching should be possible, I think.
    – morbusg
    Jul 1, 2013 at 21:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .