Giter Club home page Giter Club logo

Comments (30)

pkra avatar pkra commented on June 12, 2024

Thanks for reporting. I suspect this is an upstream bug (hopefully mathjax/MathJax#1000). I'll look into it.

from mathjax-node.

pkra avatar pkra commented on June 12, 2024

Unfortunately, the problem persists with v2.5-final. We'll have to take a look closer look.

from mathjax-node.

pkra avatar pkra commented on June 12, 2024

In addition, the viewBox now seems wrong. It looks like the top line is aligned to the left and the bottom one shifted out of view to the left.

from mathjax-node.

dpvc avatar dpvc commented on June 12, 2024

It turns out that the line width was not being passed to the SVG output jax properly, and it was being set essentially to 0. So the left-aligned top line would be left-aligned (in the v2.5 version), the centered middle lines would be centered on the left edge, and the right-aligned bottom line would be right aligned against the 0 width, so would be pushed off to the left.

The issue62 branch of MathJax-node should resolve the problem (with the v2.5 MathJax). It also fixes issue 62, which is why it is named that.

from mathjax-node.

SamyPesse avatar SamyPesse commented on June 12, 2024

I just test with the branch "issue62" and it's worst, there is nothing visible in the svg generated. SVGs are not empty but in the viewport specified in it, there is nothing.

It occurs for all formulas (the one that has bugging before and even for the ones who worked fine before)

from mathjax-node.

pkra avatar pkra commented on June 12, 2024

Just to double-check: did you update MathJax to 2.5? (This is has to be done manually right now as neither the mathjax-node branch nor the package is updated.) See #64

from mathjax-node.

SamyPesse avatar SamyPesse commented on June 12, 2024

I just set "mathjax": "git+https://github.com/mathjax/MathJax-node.git#aa15fbebe0f50b87a01121755ef3c96db22baf70" as a dependency.

The version of MathJAX in the node_modules of MathJax-node is "2.5.0-alpha-mjnode"

What do I need to manually do ?

from mathjax-node.

pkra avatar pkra commented on June 12, 2024

MathJax-node depends on MathJax's mathjax-node branch. You have to replace that copy of MathJax. Right now you could try https://github.com/mathjax/MathJax/tree/mj25-node (which will dissapear once the mathjax-node is updated).

from mathjax-node.

pkra avatar pkra commented on June 12, 2024

I.e., change https://github.com/mathjax/MathJax-node/blob/master/package.json#L25 to end with mj25-node and update the package.

from mathjax-node.

SamyPesse avatar SamyPesse commented on June 12, 2024

Hum ok.

So I'm now using https://github.com/mathjax/MathJax/tarball/mj25-node as MathJax in MathJAx-node (I checked that the _resolved in the package.json equals https://github.com/mathjax/MathJax/tarball/mj25-node").

But the error is still happening, my SVGs converted to PNG are empty (If I open the SVGs in the browser, it's the same result).

Here is my test:

Source

When $$a \ne 0$$, there are two solutions to $$(ax^2 + bx + c = 0)$$ and they are $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$

HTML generated after (math -> svg -> png)

<p>When <img src="svg5.png">, there are two solutions to <img src="svg6.png"> and they are <img src="svg7.png"></p>

Images

svg5.png

svg5

svg6.png

svg6

svg7.png

svg7

SVG for svg5.png

<svg xmlns:xlink="http://www.w3.org/1999/xlink" style="vertical-align: -0.667ex; margin-left: 0ex; margin-right: 0ex; margin-bottom: 1px; margin-top: 1px;" width="5.5ex" height="2.333ex" viewbox="0 -739.9 2377.6 978.9" xmlns="http://www.w3.org/2000/svg" role="math" aria-labelledby="MathJax-SVG-1-Title MathJax-SVG-1-Desc">
<title id="MathJax-SVG-1-Title">Equation</title>
<desc id="MathJax-SVG-1-Desc">a not-equals 0</desc>
<defs aria-hidden="true">
<path stroke-width="10" id="E1-MJMATHI-61" d="M33 157Q33 258 109 349T280 441Q331 441 370 392Q386 422 416 422Q429 422 439 414T449 394Q449 381 412 234T374 68Q374 43 381 35T402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487Q506 153 506 144Q506 138 501 117T481 63T449 13Q436 0 417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157ZM351 328Q351 334 346 350T323 385T277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q217 26 254 59T298 110Q300 114 325 217T351 328Z"/>
<path stroke-width="10" id="E1-MJMAIN-2260" d="M166 -215T159 -215T147 -212T141 -204T139 -197Q139 -190 144 -183L306 133H70Q56 140 56 153Q56 168 72 173H327L406 327H72Q56 332 56 347Q56 360 70 367H426Q597 702 602 707Q605 716 618 716Q625 716 630 712T636 703T638 696Q638 692 471 367H707Q722 359 722 347Q722 336 708 328L451 327L371 173H708Q722 163 722 153Q722 140 707 133H351Q175 -210 170 -212Q166 -215 159 -215Z"/>
<path stroke-width="10" id="E1-MJMAIN-30" d="M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z"/>
</defs>
<g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)" aria-hidden="true">
 <use xlink:href="#E1-MJMATHI-61" x="0" y="0"/>
 <use xlink:href="#E1-MJMAIN-2260" x="811" y="0"/>
 <use xlink:href="#E1-MJMAIN-30" x="1872" y="0"/>
</g>
</svg>

from mathjax-node.

pkra avatar pkra commented on June 12, 2024

Hm... I get the following (inlined as base64).

<!DOCTYPE html>
<html><head>When </head><body><div class="MathJax_SVG_Display" role="math" aria-readonly="true" style="text-align: center;"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAOCAYAAAChHnWMAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAZNJREFUeNrF1EsoRFEYwPHJjJJXIkqDaCSysCHyWFgJCyuPJhZSVrKxsRRLC1MjjyTNRopIiTwmqSlCURZYiDIWktgQGuV/6pu63a7bnXHLqV93zp3vzP3mfN89Toe9Yxo12I9lkcvGBPLgRYVJTAkWkINHdCGcYGMSPizjziTmEG+oQqLEO+xKIgl1GDCJUd+loQWvuEYl3NFyZGAC1QgiBZcYt5jEjKz/MIlplV2IyHwJPeh1SV+sSL0asY4y2V6jsYhczTwTHpygWe75sapbl6ybb8rVoxIYRAMCuMEFsjD3SxJezedieSPWMBJjCd1ydaqeaMMzpuRmIR5wZeGHOpGNSQuxEd28PXpf7UQ6nnCOVNnqY+xgFCHd4m15xdQokD7Y1cWMGZTjDLWaeTm+VZxK4lbebZXAAfJxL7UOGfyjJrmq/plHB04t7IQqV7+UvQ9F0vwbTnlwt/TGEV7k4AlqmsdoBOThsxZ74AulqMeQ6gVsYS/ec0E11bsk++cR72Hll0YO/1cSqo8+MWzXef8Dov5N28NIlRAAAAAASUVORK5CYII=" style="vertical-align: -0.667ex; margin-left: 0ex; margin-right: 0ex; margin-bottom: 1px; margin-top: 1px; width: 5.5ex; height: 2.333ex;" class="MathJax_PNG_IMG"></div>, there are two solutions to <div class="MathJax_SVG_Display" role="math" aria-readonly="true" style="text-align: center;"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHEAAAAQCAYAAAAh1pAvAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAABBJJREFUeNrtmAdIVlEUxz/TMMtokmaJDRsQ7W1SUgaVlURZUZGahdCQIFpQSEKJikUR2R6iDcpR2abSCMuMEBpohZmjjCi1cmbW/8L/wfX2/PzQ56A88OP73nv33XHOueec+6xMTSeRYBaoBOkg0NQmTSLtmrDveaAQPAcLQECbupvPiGHgKXBvZN9vwEewDnQAow2ctysIBRH8tfkPbLUE3Kcua4m6eEewENwEDxs5qBcHPA7KQZGBC9oJpoOeYByo/oeMJWwQA5zAd3AInAEXaK8UMNHcTowCJWCbQRPaC6aABFBm4TsbLWjjCzJAAXhp0FyjwdYWNqBw+iTQA7iBr4xkwXwe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ex; margin-left: 0ex; margin-right: 0ex; margin-bottom: 1px; margin-top: 1px; width: 18.833ex; height: 2.667ex;" class="MathJax_PNG_IMG"></div> and they are <div class="MathJax_SVG_Display" role="math" aria-readonly="true" style="text-align: center;"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAAAhCAYAAAAYlQP6AAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAABZ9JREFUeNrtWwlsFVUUfdCCVRZFK/0KggSpa+K+AGpQY1zQVtEoKmoFF0RQP0YIRA3uIlQhIIpaadW6RBEN4JKo1F2jYDFqVEyEooBikBrXUtFzMmfCY5y/UDu28/87ycn/M31/Zt57d+49975XYxwcLHRwQ5A1ZoJl4O850JdR4HtuSluOncCV4LA0bfYB54AXxLmjBTF5zmvAEeBAcEkb3H8KmACvB8eD54GHgm/q74eAC8HNYAXYG3w54vH4IIoLd4yJQZykN++UbfjNE+BNrXT/M8GnwGbwLPBycLD199vAv/WcK8AjIhyL0lbsV2wNYjL4M9iwDb/ZHuzRCve+VuP0sI7HSnutttpMAuv0vQv4W0TjUAi+BXbKd4M4HewLft8GfbsEfBbcqOORCg3jrTbL1W4G2A+8OKJxmC1R+5eJ0OLigIPAX8GTwU/AVTKSdNjcAuVdFTg3GtwE1lrnDgA3gEsVQl5VTH9Qzzdb17o5glDBkPlGSN+LFSL3Bz8G18tA/TkerTD3k/pDPbYuzgaxu9zwC+Dt4Hfq1ONWm2pwR+u4D7gDuMA6x/g+IXDtrprMo8D5lifwDYLC8VMdUyzuLINYDO4lLcHnOkbXHwR2i8AgngGHa2JtFMlDrQGPBBeBB1vzS2M+DHxF4Yxa7DoJ5HZlEPcqnUunAWjtU8E9FTuT4IVgZ3XeNohf9Ab4oDF8K+3hI6yGwAHrJVd/tzX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0VJ9rle48HXFN8ar2yTj3OECN+cpwa12s/T9cONtD9jPeHs5WdLn/2dwRXiCPMQyaY4rTeaVYBcyYghuv9tgHbMgxd1Uc5R59JHX4D/dPi+jeVttYot/AGpnLjHMEZf5AAAAAElFTkSuQmCC" style="vertical-align: -1.667ex; margin-left: 0ex; margin-right: 0ex; margin-bottom: 1px; margin-top: 1px; width: 22ex; height: 5.5ex;" class="MathJax_PNG_IMG"></div>
</body></html>

from mathjax-node.

SamyPesse avatar SamyPesse commented on June 12, 2024

Ok I don't really know the source of the problem:

The process in GitBook is:

  1. MathJAX convert TeX to inline svg
  2. GitBook extract svg from html using cheerio
  3. GitBook convert svg to png

I logged the svg outputted by MathJax-node (step 1), they are identical to the ones written on the disk (step 2).
When I open one of the svg files in the browser, it's empty but when I copy the code at http://mrdoob.com/projects/htmleditor/ then it's working fine.

You can try with this svg, try copying it to the htmleditor and tr opening it as a .svg file:

<svg xmlns:xlink="http://www.w3.org/1999/xlink" style="vertical-align: -0.667ex; margin-left: 0ex; margin-right: 0ex; margin-bottom: 1px; margin-top: 1px;" width="5.5ex" height="2.333ex" viewbox="0 -739.9 2377.6 978.9" xmlns="http://www.w3.org/2000/svg" role="math" aria-labelledby="MathJax-SVG-1-Title MathJax-SVG-1-Desc">
<title id="MathJax-SVG-1-Title">Equation</title>
<desc id="MathJax-SVG-1-Desc">a not-equals 0</desc>
<defs aria-hidden="true">
<path stroke-width="10" id="E1-MJMATHI-61" d="M33 157Q33 258 109 349T280 441Q331 441 370 392Q386 422 416 422Q429 422 439 414T449 394Q449 381 412 234T374 68Q374 43 381 35T402 26Q411 27 422 35Q443 55 463 131Q469 151 473 152Q475 153 483 153H487Q506 153 506 144Q506 138 501 117T481 63T449 13Q436 0 417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300 51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33 157ZM351 328Q351 334 346 350T323 385T277 405Q242 405 210 374T160 293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q217 26 254 59T298 110Q300 114 325 217T351 328Z"/>
<path stroke-width="10" id="E1-MJMAIN-2260" d="M166 -215T159 -215T147 -212T141 -204T139 -197Q139 -190 144 -183L306 133H70Q56 140 56 153Q56 168 72 173H327L406 327H72Q56 332 56 347Q56 360 70 367H426Q597 702 602 707Q605 716 618 716Q625 716 630 712T636 703T638 696Q638 692 471 367H707Q722 359 722 347Q722 336 708 328L451 327L371 173H708Q722 163 722 153Q722 140 707 133H351Q175 -210 170 -212Q166 -215 159 -215Z"/>
<path stroke-width="10" id="E1-MJMAIN-30" d="M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z"/>
</defs>
<g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)" aria-hidden="true">
 <use xlink:href="#E1-MJMATHI-61" x="0" y="0"/>
 <use xlink:href="#E1-MJMAIN-2260" x="811" y="0"/>
 <use xlink:href="#E1-MJMAIN-30" x="1872" y="0"/>
</g>
</svg>

The SVG file is working neither on Safari and Chrome for me. But inlined in the htmleditor, it is working.

from mathjax-node.

dpvc avatar dpvc commented on June 12, 2024

Try changing viewbox to viewBox in the <svg> element. That makes the SVG file work for me. The results of bin/page2svg produce the proper capitalization for me, so it may be that cheerio (or jsdom) is messing that up. We saw this in issue #2, but it seemed to be fixed upstream in jsdom v1.0, so you might check to see if you need to update jsdom.

Also, I had only changed the mj-single.js file, and needed to make the same changes to mj-page.js for the bin/page2* commands. I've pushed a commit that does that, so I think you should have better results now.

Finally, note that there is now a bin/page2png that does the SVG-to-png conversion for you, so unless you need both formats, you could try using that instead.

from mathjax-node.

SamyPesse avatar SamyPesse commented on June 12, 2024

Thanks 🍻

I'm going to fix this in cheerio: cheeriojs/dom-serializer#17

I can't use bin/page2png because it use a dependency that it's not "easy" to install for our users. We use svgexport instead (based on phamtomjs) that can be installed more easily. The results were going for now.

from mathjax-node.

dpvc avatar dpvc commented on June 12, 2024

Thanks for the upstream fix!

from mathjax-node.

SamyPesse avatar SamyPesse commented on June 12, 2024

I fixed it in GitBook, but I can't publish the mathjax plugin since it some manual operation before the branch issue62 works, right?

from mathjax-node.

dpvc avatar dpvc commented on June 12, 2024

The thing that is needed is the version of MathJax needs to be v2.5. We are in the process of updating the branch that is used by MathJax-node (a slimmed down version of MathJax to save space and download time), but that hasn't been merged yet. Once that (and the issue62 branch) are merged, there should be no addition manual operations needed.

from mathjax-node.

SamyPesse avatar SamyPesse commented on June 12, 2024

Hi guys, when can we expected to see the release with MathJax 2.5?

from mathjax-node.

dpvc avatar dpvc commented on June 12, 2024

I'm putting some finishing touches on the next release. I'm hoping to have it done in a couple of days. In the meantime, you could use

npm install https://github.com/mathjax/MathJax-node/tarball/develop

if you need to.

from mathjax-node.

SamyPesse avatar SamyPesse commented on June 12, 2024

Thanks πŸ’₯ 🎁 It's now almost as pretty on website and pdf πŸ˜„

PDF:

screen shot 2015-02-12 at 08 21 44

Website:

screen shot 2015-02-12 at 08 21 54

from mathjax-node.

pkra avatar pkra commented on June 12, 2024

Hm... I'm curious how the PDF is genearted (to me, it looks horrible due to the baseline alignment).

For the website, keep an eye on mathjax/MathJax#994 regaring the blacker setting.

from mathjax-node.

pkra avatar pkra commented on June 12, 2024

(Which browser did you take that screenshot with btw? The baseline seems off there, too.)

from mathjax-node.

SamyPesse avatar SamyPesse commented on June 12, 2024

I'm using Safari (8.0.3).

from mathjax-node.

pkra avatar pkra commented on June 12, 2024

@SamyPesse thx. That's mathjax/MathJax#995 then :-(

(If you can let me know about the PDF pipeline, that'd be great.)

from mathjax-node.

SamyPesse avatar SamyPesse commented on June 12, 2024

The pipeline for pdf is:

math -> svg -> (svgexport) -> png -> (ebook_convert) -> pdf

The problem doesn't looks like the quality of the pngs but more the sizes of the pngs in the pdf.

Here are the pngs generated before conversion to pdf:

svg5
svg6
svg7
svg8

from mathjax-node.

SamyPesse avatar SamyPesse commented on June 12, 2024

Here is the small code for the mathjax integration: https://github.com/GitbookIO/plugin-mathjax/blob/master/index.js

from mathjax-node.

pkra avatar pkra commented on June 12, 2024

Thanks. I was more concerned with the baseline alignment being completely off (the ex height doesn't look too bad but the text and math fonts do not match well, I think).

Anyway, I'm guessing the baseline alignment information is lost during svg-export (as the alignment is done via CSS in the SVG). Not much we can do except find the time (or a pull request) to modularize the PNG conversion.

from mathjax-node.

netw0rkf10w avatar netw0rkf10w commented on June 12, 2024

@dpvc Where can I find page2png please? Thank you!!

from mathjax-node.

dpvc avatar dpvc commented on June 12, 2024

@netw0rkf10w, mathjax-node was reconfigured when v1.0 came out, and the bin directory was removed. The last version that had bin/page2png was v0.5.2, so if you clone the mathjax-node repository and checkout the 0.5.2 tag, you should be able to get it. But that is pretty old, so it may have bugs that have been fixed since then.

Alternatively, you might look at pkra's mathjax-node-svg2png repository, or mathjax-node-page for possible ideas.

from mathjax-node.

netw0rkf10w avatar netw0rkf10w commented on June 12, 2024

@dpvc Thanks a lot! I managed to make page2png work.

from mathjax-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.