53

While this is not the way I wanted to announce this, it seems the cat is out of the bag. But for those who haven't noticed, as part of our Community Asks Sprint, I spent the week investigating how we might go about upgrading our MathJax version from 2.x to 3.x+, as had been requested in several places, notably:

Caveats

Right off the bat, I want to place some important caveats on this work:

  1. It's still experimental and early stages.
  2. There are several features that were removed in v3 that will likely come back in v4 that are probably worth including in a GA release.
  3. If there are too many insurmountable issues, we may have to stick with v2 for the foreseeable future until we can further dedicate / prioritize efforts.

For these reasons, v3+ right now is opt-in only at the individual account level for folks who would like to take part in early beta testing and report back any issues they find (on this post). On sites that have MathJax enabled, you'll see a preference toggle under /users/preferences/current that will enable MJv3 for your account.

MathJax v3 User Preference Toggle in profile settings

If this in any way impedes your work please feel free to toggle back off to V2. If we need to roll this back for any reason, we can disable the toggle and serve all users v2 until any Sev 0 issues are fixed. Also, if there are any syntax choices that work better in v2 than v3, please stick with v2 while drafting new posts to optimize for all viewers until we've rolled this out everywhere.

Known Issues / Deltas / Mitigations

  • Currently only the TeX font is available (HTML-CSS.availableFonts not implemented)
    • Note: we used to allow STIX & TeX, but preferred TeX, so only having that option should be acceptable.
  • The HTML-CSS.EqnChunk option is not yet implemented (but may be in a future release)
    • Note: Chunking allows for the site to process small batches of changes to optimize load times. On mobile we chunked 10 at a time, on desktop 50. The new version is more efficient and does all loading in a single pass, so chunking is not really a concept there and much less of a need.
  • Extension TeX/begingroup is not yet implemented (but may be in a future release)
    • Note: Grouping allowed expressions from one post to not impact another by sideloading resources. This is not implemented for v3 so it's possible to have side-effects from multiple different posts on the same page. This may be a blocker for GA.
  • The HTML-CSS.linebreaks option is not yet implemented (but may be in a future release)
  • MHChem is now included in the base package by default, so we may eventually be able to do away with enabling mhchem on a site-by-site basis as it will automatically lazy load if used.
  • Packages that are \require'd in many have been moved around, notably AMScd which seems to break spectacularly enough that JS throws for the entire page. I'll try to get a quick turnaround to patch that up, so we can focus on more edge case error reporting here.

Reporting / Future

A future consideration is how any content changes will work if we need to update syntax on posts between v2 and v3. For Example, in my testing AMScd seems to be case sensitive, which is gonna be a tricky migration if we need to fix during the upgrade, but maybe there's a programmatic solution we can unlock as well.

I wanna thank Davide Cervone for his helpful analysis here and ongoing project updates. Please feel free to report any issues you run into under this post, that'll be helpful for the full migration, but please be aware that there's not a team on this full time right now, so this is more to help line up and document remaining work than a full feature rollout at this point.

11
  • 5
    Thanks for you and the team's work on this, @KyleMit! :) Commented Oct 1, 2024 at 17:57
  • 3
    \sin looks uneven in v3 Commented Oct 1, 2024 at 18:18
  • 1
    @ТymaGaidash It looks correct to me. Thus, this may likely depend on your browser, OS, fonts, and such things; you need to supply more details. Commented Oct 4, 2024 at 9:45
  • 2
    The title mentions "v4" but the screenshot shows "Enable MathJax v3". Is the upgrade to v4 another step that is scheduled after the upgrade to v3? Commented Oct 4, 2024 at 12:27
  • Given that MathJax v4 seems to be around the corner (see the releases page and the milestones), wouldn't the testing for v3 be invalidated soon? Commented Oct 6, 2024 at 7:41
  • 4
    As per math.meta.stackexchange.com/a/35383 , the API of v3 and v4 is substantially the same, thus once the upgrade to v3 is working, switching to v4 should be relatively easy. Commented Oct 6, 2024 at 9:57
  • 1
    @Kyle Said non-backward incompatibility of the \color command is a serious problem that needs to be fixed before making the upgrade, e.g. I have almost 2800 answers that use color to convey essential information. Destroying that info would make many of these answers much harder to icomprehend (possibly incomprehensible in many cases). Are you able to write a script to fix these on your end? (it's too much work and disruption for users to do so) Commented Oct 16, 2024 at 23:49
  • Hi, I just submitted an edit (pending for review) to help people finding the mathjax toggle more quickly. My intention was to do so by adding a picture only, but I didn't notice that some numbering of the existing links were changed automately. If that's an issue, please forgive me. (I've checked that it works the same in the side-by-side mode). Commented May 6 at 9:39
  • 3
    @Niing, all good thanks! That happens whenever the editor inserts a photo, it'll pick a new footnote link id and then re-order all the existing ones from top down. Little noisy, but totally fine. Thanks for the edit - approved. Commented May 6 at 11:40
  • Any news on the AMScd front? The beta is unusable right now, too many broken posts on mathoverflow. Commented Jul 16 at 0:57
  • 3
    @N.I., it is easy to map AMScd to amscd in the MathJax configuration object, and one can also configure \color to use the v2 version of the command. These are things that SE would have to do, but they are straight-forward. The v4 release is planned for next week, and it has font selection support, line breaking (for both display equations and new support for in-line expressions), and the begingroup extension (with new macros specially for sites like SE). The lazy-typeset extension is a good replacement for the chunking options. Commented Jul 25 at 19:09

11 Answers 11

13

In preview, display math $$ ... $$ is incorrectly rendered as ordinary in-line math $ ... $.

E.g., when editing this answer, the preview looks like this:

Screenshot of an editing window with preview rendering two displays inline

It shows up correctly in the final post.

Strangely enough, editing this post shows an opposite behaviour: $$ ... $$ displays properly, but normal paragraph breaks are not rendered. Also, Markdown formatting including *...* and **...** is not rendered:

Screenshot showing paragraph breaks and Markdown markup not rendered in preview

Again, it shows up correctly in the final post, and in v2.

3
  • 2
    And even if $$ ... $$ is surrounded by blank lines the equation is left-aligned instead of centered in preview mode. Commented Oct 5, 2024 at 9:58
  • 2
    Oh, I didn’t notice that. On second thoughts, blank lines are completely irrelevant: display math shows up in preview as inline math, period. When surrounded by blank lines, it simply creates a paragraph consisting solely of the equation (hence, naturally, left-aligned). However, the equation is still in inline math: this can be easily seen when you try things like $$\frac{a+b}{c+d}$$ versus $$\displaystyle\frac{a+b}{c+d}$$. Commented Oct 5, 2024 at 11:10
  • Yes, that makes sense. Commented Oct 5, 2024 at 11:25
10

MathJax v4 was released yesterday. It includes line breaking, a default font with much greater character coverage, and a choice from among 11 different fonts, the begingroup extension that was missing from v3 (with extra features for isolating posts specifically for sites like SE), and a number of other important new features and improvements. See the release notes for details, and the updated documentation, particularly the What's New in MathJax v4.

I believe the nearly all the issues mentioned here are either addressed in v4, or can be addressed by using the proper configuration.

2
  • I believe you're likely correct. As you can see, I've posted 5 of the 9 non-deleted answers here myself. I also encountered a few of the issues raised in the other answers. There was also twice when the MathJax creating/editing handling code crashed, meaning I lost everything since the last automatic save (this was, fortunately, only a significant issue once). Note this occurred during a period when I posted only at the most about 20 answers, but this crashing issue never happened with over 1500 posts using MathJax v2. I haven't posted anything here about this yet because I wanted to ... Commented Aug 6 at 0:53
  • (cont.) wait for it possibly happen again, so I could get more details to include in my answer (in both earlier cases, I was too frustrated then, so I just exited). After a while with no more new issues being encountered, since I found using MathJax v3 beta to be too annoying, I just switched back to using MathJax v2. Although MathJax v4 may also have some of the same issues, and perhaps even new ones, from my earlier cursory reading about its beta phase, I believe it would be a significant improvement and, thus, I hope that SE would consider skipping v3 and, instead, going directly to v4. Commented Aug 6 at 0:54
7

In many of my answers on Math SE and MathOverflow, I use the \label MathJax command with equations, e.g., \label{eq1A}, so I can later reference them using the \eqref command, e.g., \eqref{eq1A}. This, however, doesn't work properly with the new version's editor, with it complaining about each of the labels being duplicated, even though one of them are actually being used.

For example, with my answer on Math SE, when the option is turned off and I edit the answer, the top part of what I see is:

Math answer edit using MathJax v2

However, when I turn on the MathJax v3 beta option, the top part of this is now:

Math answer edit using MathJax v3 beta

These yellow multiple definition error messages continue further for every equation where I used \label. Note this problem also occurs while I'm initially creating a new answer. Nonetheless, apart from requiring a refresh if I save my edits, the final display does otherwise work properly (including if I'm only just displaying these answers).

5
  • 2
    The old preview would often get confused with labels, too—I don't remember what circumstances tripped it, but I think that, for example, a reference to a label defined in another post (but on the same page) would confuse it, and I'm pretty sure that even some inter-post labels wouldn't work. It just gave the old classic (???) instead of this "multiply defined" stuff. (I've kind of got the impression that the mantra for the post preview is "it's great if it works, but you should expect it to break, or at least display different results from the final, regularly.") Commented Oct 1, 2024 at 13:59
  • 1
    @LSpice I've encountered similar type issues. For example, using the same label as one used in another post on the same page doesn't work properly (e.g., I asked about this issue on Math meta in Display issue with first 2 equations in an answer, although they appear fine in Edit mode). Regarding giving "???", I get that if I use \eqref with a label that doesn't exist, while I also do get the "multiply defined" stuff if the same label was used more than once, including in other posts on the same page. Finally, the preview does sometimes get ... Commented Oct 1, 2024 at 14:15
  • 1
    @LSpice (cont.) quite confused when I use labels, such as it not converting the MathJax commands in the equations, with it just showing this inside a square box, similar to the image in that Math meta question I referenced above. Finally, I don't recall ever getting the "multiply defined" error in any cases other than when that was true, with it obscuring the later defined equations only, so this is now a new issue since I now can't even at least see the MathJax commands in the preview window. Commented Oct 1, 2024 at 14:19
  • 1
    There are MathJax command for resetting the labels that could be used before the preview is typeset to avoid the "multiply defined label" issue caused but pre-rendering the same formulas during preview. But this would also undefine the labels from other posts that you might be trying to reference, so you would get ??? for those. It would be possible to record the labels generated by the preview processing and remove only those before the next time preview, but that requires knowledge of MathJax's internals. (Perhaps there needs to be API for that). ... Commented Aug 6 at 10:21
  • (cont.) I don't remember if I did that in the old preview code or not. In any case, it is possible, and I'd be happy to advise on that, as I have said. But I no longer have contacts in the SE development team, so I'm not sure how to help. Commented Aug 6 at 10:22
6

It seems v3 has some issues with bounding box of some expressions with exponents. Here are two examples I found now - notice the exponents being cut out:

source: 0\leq(x(x-a)(x-b))^{2^n}=-1.

(from https://math.stackexchange.com/a/2647669/290240 )

v3: enter image description here

v2: enter image description here

source: x^2+x-\zeta_{2^{n+1}} \equiv x^2+x-1 \in O_K/(\pi)[x]\cong \Bbb{Z/2Z}[x]

(from https://math.stackexchange.com/a/3340575/290240 )

v3: enter image description here

v2: enter image description here

I'm sure there are better examples around. I think I saw v2 doing this too but it was very rare, in current v3 beta I see it much more often.

Edit: I just noticed that the second example shows how v2 and v3 render the number two at the end differently. But I guess v3 is correct in this case, since \Bbb{} applies to the whole Z/2Z.

6
  • 1
    FWIW, I've noticed the same issue myself, with it always appearing (at least as far as I've noticed so far) to be having only the top being cut off (as opposed to mostly the bottom, as I've seen in several posts with v2). Also, as you suggested, I don't recall which ones, but I've seen several examples where I believe the top cut-off amount is even somewhat more than in your 2 examples. If I see any more such cases, I might leave another comment here with a link to the post, as well as links to screenshots of how it looks in v2 and v3. Commented Oct 4, 2024 at 20:24
  • 1
    @JohnOmielan Yes, please - the link is fine, I can update the post. I saw some examples yesterday, but I didn't save them... Commented Oct 4, 2024 at 20:28
  • 1
    In the MathJax context menu, you can choose a different renderer in Math Settings / Math Renderer. I generally prefer the SVG renderer on my phone browser (Samsung Internet). The exponents in your examples don't get cut off in v3 with the SVG renderer. Commented Oct 4, 2024 at 22:38
  • 4
    This seems to be caused by some CSS in primary.css that sets overflow: auto hidden for mjx-container. I presume this is to allow wide expressions to be scrolled. Unfortunately, you can't use auto with visible. But you could include padding: 2px 0, say, in order to get a little leeway on the top and bottom. I would recommend using mjx-container[display="true"] for this rather than just mjx-container, so as not to have it applied to in-line expressions. Commented Oct 6, 2024 at 18:01
  • 1
    Another nasty example: at least in my browser, the bottom parts of the displayed equations in mathoverflow.net/a/491884 are cut off, and as a result, the \le signs look as < (while everything else looks normal, so it is not apparent on the first sight that anything is missing). Commented Apr 30 at 12:11
  • 1
    Version 4 includes the padding I mentioned, and also allows you to configure how long expressions are handled. Since SE will likely turn on line-breaking if they use v4, there will be be no need for their CSS that is causing this problem, and I hope it is removed when they switch to v4. Commented Aug 6 at 10:16
5

I added a comment using the MathJax \color command to make several parts of a couple of equations be red. To better show the text that I used and the results, I repeated this using an answer on Math meta's "Formatting Sandbox" post. Here's what it looks like with the option turned off while editing:

MathJax v2 color for part of an equation

After saving this, both the post, as well as the comment, appear correctly. However, when editing that post with the MathJax v3 beta option turned on, it instead appears as:

MathJax v3 beta color for part of an equation

Notice how the first equation now has all of it being red (as shown in the first blue oval) after the first usage of \color, as opposed to just the intended 3 separate smaller parts. Also, in the second equation on the next line, the last 3 terms (in the second blue oval) are red, instead of just the the last term of the LHS of the equation.

Unfortunately, this problem persists when I view this post, as well as the original comment.


Note that wizzwizz's comment below states:

This behaviour is documented; there's a fix available, but I think this should only be applied to old posts, if possible.

Fortunately, one quite simple way to have the color handling work properly in both MathJax v2 and v3, as it's now without any potential fixes or other changes being implemented, is to use brace brackets around each of the color commands and text, so they form their own groups. For example, we can change \color{red}{2abc} in the first equation above to {\color{red}{2abc}}. More details, including the updated MathJax text, is in the Math meta answer I mentioned earlier.


This issue may potentially cause a syntax error to be displayed instead of the equation. Using MathJax v2, the last part of this answer is:

MathJax v2 for an equation in the last part of an answer

The issue is with the red '+' superscript being used. In MathJax v3 beta, this causes the equation display to become:

MathJax v3 beta for an equation in the last part of an answer

Note that the edit preview shows the same behaviors as in both the corresponding v2 and v3 beta displays. Fortunately, my earlier suggestion of using brace brackets around the entire part also solves the problem here for both v2 and v3 beta, i.e., in the MathJax for the equation of

$$\lim_{x\to0}\sqrt{|x|}\ln|x|=
\lim_{x\to0^\color{red}{+}}x^{\frac12}\ln x=0.$$

I changed in the middle part of the second line the \color{red}{+} text to {\color{red}{+}}.

4
  • 3
    This behaviour is documented; there's a fix available, but I think this should only be applied to old posts, if possible. Commented Oct 1, 2024 at 17:38
  • 1
    @wizzwizz4 Thanks for those details. I've added a link to your comment, as well as what it states, to the end of my answer. I'm unsure about how the SE staff working on this will deal with the problem, but I think that we should ideally all be using the new method once the update is complete. If so, then perhaps the old posts can be updated automatically at that time. Commented Oct 1, 2024 at 17:50
  • 1
    @wizzwizz4 The fix would need to be done by SE since there are far too many occurrences, e.g. I use color in almost 2800 answers (many of which would be much harder to comprehend if that info was destroyed). Commented Oct 16, 2024 at 23:52
  • 1
    An easier solution is to just configure MathJax to use the colorv2 extension for the \color command. That is easy to do and described in the documentation for the color extension. Commented Aug 6 at 9:16
4

With MathJax v2 it was possible to copy/paste a line containing MathJax into a plain Text editor. Of course this gives only a simplified representation.

For example, this is what I get when copying the title of this Math SE question on a Mac into a TextEdit window (raw format), or into BBEdit:

Determine a unit vector which is perpendicular to 2𝑖+𝑚𝑗−3𝑘 and parallel to 2𝑖+𝑗−𝑘.

With MathJax v3 I get only

Determine a unit vector which is perpendicular to and parallel to .

so apparently all math content is omitted from the copy.

2
  • Well, this is inconvenient, but it does not actually break any posts, old or new. It might even be a good thing, as it prevents clueless people from blindly copy-pasting the rendered form of a post, destroying the proper MathJax markup (I’ve seen this happen many times). Commented Oct 23, 2024 at 12:43
  • 2
    Version 4 will allow copying the output as in v2. Commented Dec 30, 2024 at 2:41
3

Certain special characters are not currently being handled appropriately with MathJax v3 beta. For example, the top part of Sea ships and their space-time equations, in MathJax v2, appears as:

MathJax v2 display

However, with MathJax v3 beta, it now shows as:

MathJax v3 beta display

i.e., "Math input error" is displayed instead for both equations. The editor display of that part of the question is:

Editor display

What's interesting is that the problematic character displays as a space followed by a question mark enclosed in a square. However, this display isn't the same here, e.g., with

x ⃗

Instead, as you can see, it appears to be a small square (at least for me, with this being similar to how unsupported characters with the current font are displayed), and a small arrow when shown by itself. However, on MathJax supported sites like the Math meta one, the square box is displayed as an arrow as well! This is a Unicode character that causes a backspace and overlay, which is how the "x" with an arrow overtop of it is shown in the top MathJax v2 output. Note that one may get a very similar result using MathJax with $\vec x$ instead.


There are also other special characters that work in MathJax v2 but result in the yellow "Math input error" message with MathJax v3 beta. For example, in Revision 4 of Find the smallest constant $C$ with given condition., the OP used the Euro symbol character. Unlike the other character mentioned above, this one appears to always be displayed properly, e.g.,

$€$

I'm unsure about why this problem is occurring with certain characters in MathJax v3 beta. I checked, but didn't find, this issue in the Upgrading from v2 to v3 - MathJax 3.2 documentation Web page. My suspicion is that MathJax v3 may be trying to interpret them as being some sort of unrecognized special MathJax characters.

1
  • 1
    There was a bug in v3 when dealing with some characters that are not in MathJax's fonts. There is a table MathJax uses to determine the type of MathML element to use internally for such unknown characters based on the Unicode block they reside in, but for some blocks, the data was malformed, and could cause these problems. That has been resolved in v4. Commented Aug 6 at 10:14
3

In v2, the quote characters “...” (U+201C and U+201D) display as themselves just like most other Unicode characters:

Screenshot of a question using quote characters as rendered in v2

In v3, they are engorged into huge double stroke characters:

Screenshot of the same question as rendered in v3

(The screenshots are from this MathOverflow question.)

2
  • 1
    The reasoning behind this is a bit complicated. Since may editors use "smart quotes" that turn things like ' into and " into , this makes it hard to use ' for primes in those editors. So MathJax turns these back into their original form. Unfortunately, that is not always what is desired, as in your case. You can use \text{“}P\text{”} or perhaps better \text{“}\!P\text{”} to get the result you are looking for. It is also possible to configure MathJax not to do those substitutions, but that would be up to SE to decide. Commented Aug 6 at 10:08
  • 1
    In version 4, these characters will be treated as "pseudo-scripts" by the underlying MathML that the TeX is converted into, and will appear smaller and higher up.. Commented Aug 6 at 10:10
3

Another preview bug: < followed by a letter inside a MathJax expression renders the rest of the paragraph invisible (as it is presumably misparsed as a start of an invalid HTML tag).

Screenshot of preview window

It works correctly in the final post, and it worked even in preview in v2.

1
  • 1
    You are correct about what is happening (the browser is seeing the <y as the start of a tag and the rest of the line as representing attributes for that tag). This is something that happens in the browser before MathJax runs, so not something MathJax can do anything about. The preview code might be able to do something about this since it processes the input before sending it to the browser, but I don't recall doing that in the old preview code. Commented Aug 6 at 9:27
2

With MathJax V3 enabled, How can i Find the Area of a Traingle Formed inside a Triangle? has 5 initial comments, each with their date/time display being a link. However, clicking on "Show 5 more comments" then causes the original 5 comments, as well as the next 5 comments which are shown, to not have any of those date/time values being links any more. With Microsoft Edge, version 134.0.3124.51, on Windows 10, the Developer Tools display shows:

Developer tools showing the error

The final part, i.e., "Uncaught Error: MathJax retry", appears just after I click to show more comments. Thus, this seems to be what's causing the problem, or at least it's closely related. However, using MathJax V2 instead (e.g., while logged in, with an Edge private window, or logged out in Google Chrome), does always work properly.

Note that this problem doesn't occur every time more comments are shown, e.g., it works properly in Can $i^a$, for real $a$, be expressed in terms of $\cos$ and $\sin$ functions$?$. Instead, I believe that it's due to the sixth comment, i.e., the first new one shown. With V2, this appears to display properly as

Comment in V2

but with V3 it instead appears as

Comment in V3

In this case, none of the comment's MathJax is rendered. In particular, I suspect the problem is caused by the use of the \verb command. Nonetheless, as suggested in Emil's comment, just like with Are there any problems in mathematics where it is important to know if an entire function has infinitely many zeros? on MathOverflow, they are rendered correctly after copying and pasting those comments into an answer box. Also, most interestingly, all of the earlier comments now also appear properly! My suspicion is that the comments don't normally properly handle certain special functionality, with it being the use of \color with the MO question, as I indicate in my other answer, but that having them being in an answer box causes something to be loaded and/or updated so that it's then also handled properly in the comments.

3
  • 1
    I’m not sure whether this is a manifestation of the same bug, but in mathoverflow.net/q/492459 , if one clicks on “Show 4 more comments”, then MathJax is not rendered in any of the comments (including those above the fold where it is rendered before clicking). I see nothing suspicions in any of the comments; they render properly when copied into an answer box. It all works correctly in v2. Commented May 13 at 7:41
  • 1
    @EmilJeřábek Thank you for noticing this and letting me know. I'm able to reproduce the problem. Interestingly, when I do that and go back to those comments, they now render properly! Nonetheless, the Developer Tools shows the same error as I indicate in my answer above. When I do the same thing with the question I had a problem with in my answer, the same type of behavior occurs, i.e., the comments now also render properly. I suspect this is due to some special functionality, e.g., color in your case, not working by default in the comments. I've updated my answer accordingly. Commented May 13 at 8:42
  • 1
    The "MathJax Retry" error is part of MathJax's internal plumbing for handing asynchronous loading of extensions, like the color extension. If you are seeing it in the browser, that means that SE is calling one of the synchronous commands rather than the promise-based commands at some point where the math it is converting requires external files to be loaded (see the documentation on this). That means that SE needs to change to using the promise-based calls. That will be more important in v4, as the fonts now may cause ranges to load. Commented Aug 6 at 9:33
1

This Math SE answer has the MathJax code of


$$y=x^2-(x-2)^2=4x-4\\
y=x^2-(x-8)^2=16x-64$$

With MathJax v2, this appears as expected, i.e., in 2 lines,

MathJax v2 showing equations appearing as 2 lines

However, with MathJax v3, the equations appear together instead, one immediately after the other, all in 1 line,

MathJax v3 showing equations appearing together in 1 line


As indicated in Martin R's comment, the page The line break(\) is not work · Issue #2312 · mathjax/MathJax · GitHub has an Oct. 2, 2019 comment by dpvc of

Linebreaks are not yet implemented in version 3. This is one of the significant features from version 2 that has not yet been ported to version 3.

That same user stated on June 22, 2020

... So line breaking and other features will most likely have to wait until next year.

There doesn't appear to be anything more about support for this in v3, but dpvc wrote on July 25, 2023 that

... line breaking support is in v4.0-alpha released last year, and in the 4.0-beta released last week. The official v4.0 is planned for the end of August.

but then on Oct. 27, 2024

... We are dealing with some issues with the changes made in the assistive technology support that still need to be worked out, and it is taking longer than anticipated. there will need to be one more beta release before the official v4. The betas are in use in production sites, so if the need is urgent, you could consider that. The current beta.7 is pretty close to the final version, and the beta.4 release predates the problems that we are working on, if you want to try those out.

Rather than waiting until v4, note there are several workarounds mentioned in that page.

8
  • Why should \\ give a new line inside plain $$? This looks like a bug in v2 that is fixed in v3. Commented Dec 23, 2024 at 22:38
  • @EmilJeřábek I'm having trouble finding this in the official MathJax documentation, but in LaTeX, as I recall, a \\ always created a line break. Also, in the Math SE's MathJax basic tutorial and quick reference, it's current last point, i.e., #14, states "..., because \\ is for a new line". In addition, in various things like multi-line equations and arrays, a \\ is always required to indicate when moving to the next line. Finally, there's this StackOverflow answer, although it references a ... Commented Dec 23, 2024 at 22:58
  • @EmilJeřábek (cont.) Math meta SE question. Regardless of what, if anything, the MathJax documentation states, I don't see any particular reason why a \\ should not work within just plain $$. Even if it is the case that it shouldn't, i.e., it's a "... v2 bug that is fixed in v3" as you wrote, note there will be quite a few places where this breaks the display, so some sort of appropriate automated updates should then be implemented. Thus, in either case, i.e., a bug in v2 or one in v3, IMHO this should be documented, such as in my answer, and also then dealt with appropriately. Commented Dec 23, 2024 at 23:04
  • 2
    No, in LaTeX, \\ inside $$ does not do anything. Commented Dec 23, 2024 at 23:10
  • @EmilJeřábek It's been many years (about 30) since I last used LaTeX, so you definitely may be correct. I just checked, with all search results I found stating to use various packages, such as AMS ones, for \\ to make line breaks. However, my answer never stated which behavior is correct but, instead, there's a change which breaks existing posts. I've now also rechecked the Upgrading from v2 to v3 page, but can't find anything there. It's possible this could be resolved by just simply adding or changing some configuration option. Commented Dec 23, 2024 at 23:32
  • 1
    @EmilJeřábek: According to github.com/mathjax/MathJax/issues/2312, this is a bug in MathJax v3: “Linebreaks are not yet implemented in version 3. This is one of the significant features from version 2 that has not yet been ported to version 3.” Commented Dec 24, 2024 at 7:42
  • 1
    @MartinR Thanks for finding that Web page and mentioning it here. I've updated my answer to include that, your quoted text, and several other parts I thought were pertinent. Commented Dec 24, 2024 at 20:20
  • 1
    @MartinR, if it's documented, it's not a bug, it's a feature. :-) in any case, it is implemented in v4. Commented Aug 6 at 9:35

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.