mathjax / MathJax-node

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

unicode symbol x2035 rendered too large in SVG #199

Closed corinnaSchultz closed 8 years ago

corinnaSchultz commented 8 years ago

x2035 is the reversed prime symbol. I would expect it to be the same size as an apostrophe, but it gets rendered too large.

reversed_prime

Example mathML:

Reversed prime:

 <math xmlns="http://www.w3.org/2010/Math/MathML"><semantics><mstyle scriptsizemultiplier="0.715"><mi>x</mi><mo>&#x2035;</mo></mstyle><annotation encoding="text/plain"/></semantics></math>

SVG:

 <svg xmlns:xlink="http://www.w3.org/1999/xlink" style="vertical-align: -0.338ex;" width="1.97ex" height="1.843ex" viewBox="0 -647.8 848 793.3" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg">\n<g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)">\n<path stroke-width="1" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path>\n<g transform="translate(572,0)">\n<path stroke-width="1" d="M12 501Q12 527 31 542T63 558Q73 560 77 560Q114 560 128 528Q133 518 188 293T244 61Q244 56 223 50T195 43Q192 43 190 45T102 263T14 486Q12 496 12 501Z"></path>\n</g>\n</g>\n</svg>

Apostrophe:

 <math xmlns="http://www.w3.org/2010/Math/MathML"><semantics><mstyle scriptsizemultiplier="0.715"><mi>x</mi><mo>&apos;</mo></mstyle><annotation encoding="text/plain"/></semantics></math>

Resulting SVG:

 <svg xmlns:xlink="http://www.w3.org/1999/xlink" style="vertical-align: -0.338ex;" width="1.977ex" height="2.176ex" viewBox="0 -791.3 851 936.9" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg">\n<g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)">\n<path stroke-width="1" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path>\n<g transform="translate(572,0)">\n<path stroke-width="1" d="M78 634Q78 659 95 676T138 694Q166 694 189 668T212 579Q212 525 190 476T146 403T118 379Q114 379 105 388T95 401Q95 404 107 417T133 448T161 500T176 572Q176 584 175 584T170 581T157 576T139 573Q114 573 96 590T78 634Z"></path>\n</g>\n</g>\n</svg>
dpvc commented 8 years ago

This is correct behavior. According to the MathML spec, pseudo-scripts like prime and back-prime should be marked up using <msup>, like all other scripts. Note that an apostrophe is not the same as a prime, so your second example is not relevant. MathJax does have some logic to try to make the incorrect <mi>x</mi><mo>&#x2032;</mo> render more appropriately, but the result is not as good as <msup><mi>x</mi><mo>&#x2032;</mo></msup>, and it just a hack. There is no corresponding hack for &#x2035;, as its use is much rarer.