PreTeXtBook / pretext

PreTeXt: an authoring and publishing system for scholarly documents
https://pretextbook.org
Other
254 stars 203 forks source link

Migrate to MathJax 3 #1039

Closed rbeezer closed 3 years ago

rbeezer commented 5 years ago

This is a meta-issue for notes, or related issues involved with an upgrade to MathJax 3, which at this writing is still in beta.

rbeezer commented 5 years ago

Using the https://cdn.rawgit.com/mathjax/mj3-demos/3.0.0-beta.3/mj3-tex2html-beta.dist.js variant in a very quick-and-dirty way, seems to resolve the bold math problem at #1040.

rbeezer commented 5 years ago

Knowls in display math seem to act better with same variant as above.

rbeezer commented 4 years ago

Seems to be some changes in font sizes, noticed in #930.

rbeezer commented 4 years ago

Just upgraded my testing branch to beta 4, the final one. So using

https://cdn.rawgit.com/mathjax/mathjax3/tex-chtml.js

Nothing startling to report.

Alex-Jordan commented 4 years ago

Just a note to look into the color.js extension with the migration to MJ3.

rbeezer commented 4 years ago

I have no reason to believe that MJ will do a better job of keeping text after math for not line-breaking. But worth testing.

697

rbeezer commented 4 years ago

Looks like MJ3 is not really mature just yet. We'll want to watch this:

http://docs.mathjax.org/en/v3.0-latest/upgrading/v2.html

sean-fitzpatrick commented 4 years ago

With MathJax 2.7.5, superscripts on the | (\vert) character don't render correctly when accessibility is turned on. This can be worked around by using braces: |^2 doesn't work right, but {|}^2 does. Maybe using \vert instead of the keyboard character would fix things, too. (Also, \right| seems OK, but \Big| is not.)

sean-fitzpatrick commented 4 years ago

Testing using the utility on the MathJax site suggests this is fixed in 3.0

Alex-Jordan commented 4 years ago

When moving to MathJax 3, or after the move, monitor these two issues we currently have and see if they go away:

  1. Set MathJax to SVG rendering. Then load this page. Open the example knowl and see if the second equation column is aligned well.

  2. Set MathJax to SVG rendering. Go to here and see if the knowls that are inside the math function as they should. Current behavior is that you click them, they open, and then instantly close.

rbeezer commented 3 years ago

Inline math, followed by punctuation (period, comma) sometimes gets a bad line-break due to MathJax.

In xsl/pretext-html.xsl find the new math.punctuation.include variable and try changing it from 'all' to 'display' and see if this behavior persists.

rbeezer commented 3 years ago

Commit 38e98001b39c54d7bf7b7888f17fde8c76518f56 adds some MathJax configuration to the Reveal.js slideshow conversion. It'll need a look once we upgrade.

rbeezer commented 3 years ago

1354 might wait for MJ3. Or not.

davidfarmer commented 3 years ago

The knowls Javascript calls MathJax, but the way you call MathJax3 is different than MathJax2. So, at the same time as we upgrade to MathJax3, we also need to move to a new version of the PTX Javascript (unless it is possible to keep the knowls code backward compatible).

rbeezer commented 3 years ago

MJ 3.1.2 has some change in behavior with the super-popular \text{} via an extension. We should follow MJ, but also warn authors when we switch. Details at:

https://groups.google.com/g/mathjax-users/c/0cibiiq3jxw/m/_aqYBQfWAQAJ

davidfarmer commented 3 years ago

Apparently MathJax 3 now looks in the text by default:

https://groups.google.com/g/mathjax-users/c/0cibiiq3jxw

So we probably don't want the textmacros extension.

sean-fitzpatrick commented 3 years ago

I notice that the complaint here is about the use of \text{N^*} which seems like something a reasonable person just shouldn't do, no? Is the point of textmacros to allow this over the slightly more annoying to type \text{N}^* (or perhaps \mathrm{N}^*)?

davidfarmer commented 3 years ago

I think my point was that PreTeXt expects only text where only text should be. So it is asking for trouble if MathJax supports other behavior.

On Tue, 8 Dec 2020, Sean Fitzpatrick wrote:

I notice that the complaint here is about the use of \text{N^} which seems like something a reasonable person just shouldn't do, no? Is the point of textmacros to allow this over the slightly more annoying to type \text{N}^ (or perhaps \mathrm{N}^*)?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, orunsubscribe.[AABTULHRR2KGK7DWQPLNAITST2KMHA5CNFSM4HE7UGDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMV XHJKTDN5WW2ZLOORPWSZGOFQVZMLA.gif]

rbeezer commented 3 years ago

Peter K (@pkra) plans to move AMS production to MJ 3 in the start of 2021, so maybe the end of the academic year (May/June) would be a good time to make the move.

pkra commented 3 years ago

Following up on @rbeezer's question during the last drop-in meeting: here's the jupyter plugin for mathjax 3 https://github.com/jupyterlab/jupyter-renderers/tree/master/packages/mathjax3-extension

rbeezer commented 3 years ago

Upgrade in place via several commits, starting from 9c91af4e107ea75c8f255624aba2d4742ab6b3fb

I'll follow-up on all the pointers here before closing.

rbeezer commented 3 years ago