mathjax / MathJax-node

MathJax for Node
Apache License 2.0
615 stars 97 forks source link

Overlapping of \left and \sum for input \left(\left(\sum_A\right)B\right) #235

Closed physikerwelt closed 8 years ago

physikerwelt commented 8 years ago

On https://en.wikibooks.org/w/index.php?title=User:Physikerwelt&oldid=3084106 the SVG image looks not good for the input \left(\left(\sum_A\right)B\right) I guess that's a problem within MathJax, or can this be related to the latest jsdom patch? 2016-05-22

physikerwelt commented 8 years ago

CC @d00rman

dpvc commented 8 years ago

I am not able to reproduce your result using mathjax-node directly. The main content of the SVG from mathjax-node is

<g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)">
  <use xlink:href="#E1-MJSZ4-28"></use>
  <g transform="translate(792,0)">
    <use xlink:href="#E1-MJSZ4-28"></use>
    <g transform="translate(792,0)">
      <use xlink:href="#E1-MJSZ2-2211" x="0" y="0"></use>
      <use transform="scale(0.707)" xlink:href="#E1-MJMATHI-41" x="646" y="-1591"></use>
    </g>
    <use xlink:href="#E1-MJSZ4-29" x="2237" y="0"></use>
  </g>
  <use xlink:href="#E1-MJMATHI-42" x="3988" y="0"></use>
  <use xlink:href="#E1-MJSZ4-29" x="4748" y="0"></use>
</g>

But the SVG attached to your background image is

<g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)">
  <use xlink:href="#a" />
  <g transform="translate(797,0)">
    <use xlink:href="#a" />
    <use xlink:href="#b" />
    <use transform="scale(0.707)" xlink:href="#c" x="647" y="-1613" />
    <use xlink:href="#d" x="2246" />
  </g>
  <use xlink:href="#e" x="4006" />
  <use xlink:href="#d" x="4770" />
</g>

Note that the innermost <g> element is missing in your svg file. It is the one that moves the summation over, so the fact that it is missing is the cause of your problem.

I see that you must be doing some post-processing (to change the names of the links for one thing), and I'm wondering if you haven't removed the <g> element accidentally?

In any case, actual mathjax-node produces the correct result (as does MathJax SVG output in the browser), so I think it must be in your modifications somewhere. Note that it is not related to the jsdom patch.

physikerwelt commented 8 years ago

@dpvc sorry for my (un)educated guess that it's a mathjax problem. It turns to be a svgo problem. Trusting that this open source library would do the job was naive.