kisonecat / tikzjax

TikZJax is TikZ running under WebAssembly in the browser
LaTeX Project Public License v1.3c
437 stars 36 forks source link

Add math into node #7

Open tobiasBora opened 4 years ago

tobiasBora commented 4 years ago

Hello,

First, thanks a lot for this great software, it looks awesome! I just would like to report some bugs making me unable to display proper math in a node:

<script type="text/tikz">
  \begin{tikzpicture}
  \node at (0,0) {Coucou $\sqrt{2}$};
  \end{tikzpicture}
</script>

Gives: Screenshot_20200218_194101

pieffebi commented 3 years ago

Hi, I'm experiencing similar problems as tobiasBora.

I think there might be a problem in the "mapping of symbols" (I'm not even sure I'm using the correct terms, though).

Basically, what I observe is that the svg code uses a "£" symbol for the minus sign in the cmsy10 font family, but this is rendered as a "times" sign instead, as demonstrated in this MWE. From what I can understand, the minus sign should correspond to an inverted exclamation mark: "¡". This actually produces the expected minus sign. Here's another MWE based on the first one, where all the "£" symbol have been replaced by "¡" symbols.

More detail on how I came up with the inverted exclamation marks in this stackOverflow post.

tobiasBora's problem seems slightly different. I inserted the same node as in his MWE in my first MWE, and the result is garbled in a different way. In that case the sqrt symbol is the correct one, I think. The problem seems to be the positioning of the radicand ad the bar over it that is part of the sqrt symbol.

I hope this information helps solving the problem. This is a really great project, and I think it is going to be very useful to me.

Thank you very much for this work

% ---------- EDIT: I think that this problem traces back to the dvi2html component. The live demo page looks ok with the default sample document, but has exactly the same issues as above. Try e.g. changing \[ \int_a^b f(x) \, dx = x^2 + C. \]

into \[ \int_a^b f(x) \, dx = -x^2 + \sqrt{2}. \] Neither the minus sign nor the square root render correctly.