Open vincerubinetti opened 5 years ago
However, using config option examples from their site, it still doesn't seem to work:
Does it work in 2.7.5 (the latest release)?
just say that users must manage their own line breaks to make sure their equations aren't too long for printing on standard 8.5" x 11".
I think this makes sense. Especially if we do it in tandem with requesting any upstream bug reports / feature requests. In general, it's ideal if we can get the upstream tools to implement and maintain these features.
Just tested 2.7.5, still doesn't work for me. In fact, I took out all the css in the document (mine, pandoc's, etc) except for the <body>
margin and max-width, and both this issue and #164 still happen.
Since both of these issues seem to be purported capabilities of MathJax, and appear to be tackled in their code, I'm wondering if we're doing something wrong (or pandoc's doing something wrong).
This works in weasyprint for some reason. Auto-wrapping takes place of long/wide equations.
Regardless of whether the code in the first post in this thread works or not, we can't even get it in that form in a clean way: Pandoc needs the --mathjax
flag so it outputs the proper HTML to be picked up by MathJax. Without the flag, it outputs as just plain HTML. With the flag, the MathJax script hot-link is placed near the very top of the document. The --include-in-header
flag will insert scripts after the MathJax script. MathJax needs the configuration script (the MathJax.Hub.Config
above) to come before it's loaded. To specify where the MathJax script goes in the document, we'd have to create a custom template.
If it were possible to have pandoc output the proper MathJax HTML without inserting the MathJax script (leaving it to us to insert it manually, probably as a plugin), then that would fix the issue and also allow us a lot of flexibility. Perhaps we could request this as a pandoc issue? (Edit: https://github.com/jgm/pandoc/issues/5301)
Otherwise, this wont be possible to solve in a good way. Users will just have to make sure to put line breaks in their long equations at sensible places.
Working now, thanks to closing comments in https://github.com/jgm/pandoc/issues/5301. Will be incorporated into plugin suite pr.
Added configuration to the MathJax plugin in #179 that is supposed to make sure it wraps. It usually works, but sometimes it doesn't, especially on mobile. I added css to the default theme such that when it doesn't wrap properly, it just scrolls with a scroll bar.
I think it's some sort of race condition where the page or CSS isn't fully loaded yet when it tries to do the wrapping. I'm not sure there's anything I can do about it.
MathJax has released v3.0 which claims to be rewritten from the ground up.
So probably worth upgrading and perhaps it will resolve this issue. Not sure if the following change is related:
The SVG output for equations with labels has been improved so that the positions of the labels now react to changes in the container width (just like they do in the HTML output formats).
MathJax supposedly has the ability to auto-wrap long equations like regular text/html, when the width exceeds the width of the container. However, using config option examples from their site, it still doesn't seem to work:
In html export, I'm putting a scrollbar when it's too long. As such, this only affects pdf or html print exports (not sure about docx). We can either try to investigate what I'm doing wrong to configuration MathJax, or just say that users must manage their own line breaks to make sure their equations aren't too long for printing on standard 8.5" x 11".