MathJax icon indicating copy to clipboard operation
MathJax copied to clipboard

The line break(\\) is not work

Open woody-li opened this issue 5 years ago • 54 comments

The latex: x = a + b \\ y = b + c The line-break isn't effect and it renders as single line. However, it works fine and renders as two lines at verision 2.

woody-li avatar Oct 02 '19 08:10 woody-li

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.

dpvc avatar Oct 02 '19 09:10 dpvc

Is it possible to update the support information in the symbols table at http://docs.mathjax.org/en/v3.0-latest/input/tex/macros/index.html . Any schedule to implement the linebreak?

woody-li avatar Oct 03 '19 01:10 woody-li

I'm not sure what you want changed there. The macros are simply listed, and since \\ is used within multi-line environments, it needs to be listed there. There is a link to Carol Fisher's page about the macros (written for v2), but that is not something we maintain, so she would have to maintain it.

In any case, it is not a TeX issue, but an output issue, and the fact that line breaking isn't implemented is documented in several places.

Any schedule to implement the linebreak?

It will be next year, probably in the first half of the year, but there is no specific timetable at the moment.

dpvc avatar Oct 04 '19 00:10 dpvc

In the meantime, you can do something like

\displaylines{x = a + b \\ y = b + c}

to get multiple lines

dpvc avatar Oct 04 '19 01:10 dpvc

Thanks for your reply. The \displaylines solved my problem.

The information I said that adding a column in the macros table to show the support version.

woody-li avatar Oct 04 '19 02:10 woody-li

I'm not sure if it is helpful, but I also found the use of \display{align} honours the newline instruction as well.

\begin{align}2x+y&=5\\y&=-2x+5\end{align}

This also requires the addition of the '&' before the alignment point, and has the benefit of making the equations more readable in our use case.

SeanFlemingMathsPathway avatar Oct 09 '19 20:10 SeanFlemingMathsPathway

For some reason, I had to add a third / on my environment (Japanese WordPress blog.) This didn't work (everything was rendered on the same line):

\displaylines{x = a + b \\ y = b + c}

This worked (2 lines):

\displaylines{x = a + b \\\ y = b + c}

T-Kuhn avatar Feb 04 '20 03:02 T-Kuhn

@T-Kuhn, WordPress uses \ as a special character, and it is often stripped out of WordPress posts (depending on what editor you are using). As an escape character, it can prevent the normal action of the character that follows it, so to get an explicit backslash into your post, you need to double it. That is why you need an extra backslash (because the first two equal a single backslash in the output). You probably should double the second one as well, but apparently that is not required.

dpvc avatar Feb 04 '20 14:02 dpvc

I'm moving this issue to the main MathJax issue tracker so that it can be found more readily by others.

dpvc avatar Feb 04 '20 14:02 dpvc

@dpvc Thanks for your reply. In the meantime, I figured out that the third backslash is only required if the "Using Markdown" toggle on our specific WordPress blog is set to "on". So, at least in my case, this was a problem between different plugins interfering with each other. Seems like the backslash get's handled as an escape character in Markdown mode on our blog.

T-Kuhn avatar Feb 05 '20 10:02 T-Kuhn

@T-Kuhn, yes, Markdown uses the backslash as an escape character. You may also need to be concerned about underscores, as these are used to indicate italics. So you may need to do things like x\_1 rather than x_1 in some situations.

dpvc avatar Feb 05 '20 11:02 dpvc

Any update or schedule about it?

woody-li avatar Jun 22 '20 05:06 woody-li

@woody-li, there is a 3.1 update that is nearly ready to release (hope to have it out by the end of the month). The next release should be at the end of the summer, and will mainly be the long-awaited additional font support for v3 (including STIX2 support and tools for building the data needed for supporting other web fonts). So line breaking and other features will most likely have to wait until next year.

dpvc avatar Jun 22 '20 15:06 dpvc

Would it be bad of an idea to add referrence to this task to "Not Yet Ported to Version 3" section in the documenation, for those who go there and want to know status of those items, and possibly for other items on the list? (I assume this ticket is representative for the "Currently, automatic line breaking support is missing from version 3. This is a key feature to be included in a future release." bullet).

TheSil avatar Sep 12 '20 08:09 TheSil

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

That's the reason why nearly nobody is using MathJax 3. I would put it as highest priority if you want to distribute MathJax 3 and see it being successful. I nearly swapped to Katex because of this missing feature, and maybe will do so. However, Mathjax is still my favorite (bolder font, line break of Jax 2 and other features).

q2apro avatar Sep 15 '20 12:09 q2apro

Would it be bad of an idea to add referrence to this task to "Not Yet Ported to Version 3" section in the documenation, for those who go there and want to know status of those items, and possibly for other items on the list? (I assume this ticket is representative for the "Currently, automatic line breaking support is missing from version 3. This is a key feature to be included in a future release." bullet).

that could have saved me a few hours trying to figure out why line breaking doesn't work for me with v3.

Tony2 avatar Apr 30 '21 12:04 Tony2

that could have saved me a few hours trying to figure out why line breaking doesn't work for me with v3.

thankfully I didn't have to spend a few hours, but it was an annoying waste of time. Now I have to reset up everything so I can use 2.7. Seems silly to push back such a huge issue

Hilb3r7 avatar May 11 '21 18:05 Hilb3r7

For what it's worth, I think linebreaking is the last thing we are waiting for to move from mathjax 2 to mathjax 3 as the default math rendering in JupyterLab: https://github.com/jupyterlab/jupyterlab/issues/7218

jasongrout avatar Jul 09 '21 17:07 jasongrout

@jasongrout just a thought from a bystander: a group as well funded as the jupyter projects might consider actually supporting MathJax's development.

pkra avatar Jul 09 '21 17:07 pkra

@pkra, first, the tone of your comment indicates that I came across as entitled in some way to Davide's time. Both of us have been involved with open source and funding long enough to know that there is no entitlement here - I'm sorry if I came across that way. I only meant to flag another potential userbase's interest when and if the work happened.

On the deeper issue you raise: we both know how difficult it is to find funding for open source. A few of us in Jupyter had a great conversation just this morning on how to help fellow open-source projects connect with funding sources in a successful, sustainable way. In fact, @fperez's Scipy keynote next week will focus on the topic of funding open source (Friday morning next week: https://www.scipy2021.scipy.org/schedule).

@dpvc (and @pkra if you're interested too) - if you want to follow up, email me and let's set up a time to brainstorm some ideas about resources for funding (while most of Jupyter's funding is tied to specific initiatives or is controlled by specific PIs for specific projects, we have cultivated a network of contacts and have other ideas about funding). For example (which you may already be aware of), for things like a specific feature, NumFOCUS small development grants may help.

jasongrout avatar Jul 09 '21 20:07 jasongrout

The document says "Currently, automatic line breaking support is missing from version 3. This is a key feature to be included in a future release.", so "\\" means automatic line breaking 😂 ...

abnerlee avatar Jul 20 '21 14:07 abnerlee

@jasongrout, thanks for your information about line breaking. I know that it is important, and haven't forgotten about it. Things have taken somewhat longer than I had hoped, and I am still working on the font update. I have the toolchain for SVG in pretty good shape, but there is still some work needed for CommonHTML versions. There will be a release at the end of August that will at least include the SVG versions. Line breaking is then the next feature that I will work on. Because I go back to teaching in the fall, that will have to wait until next year. I wish I were able to work faster, but it is what it is.

We have received two small development grants from NumFOCUS already. Doing one for line breaking may be a good fit as well. I will consider it for next year. Thank you for the offer to discuss funding ideas. I would be happy to chat with you about that. We should make arrangements to do that before I go back to teaching.

dpvc avatar Jul 21 '21 19:07 dpvc

@abnerlee:

The document says "Currently, automatic line breaking support is missing from version 3. This is a key feature to be included in a future release.", so "\" means automatic line breaking

Yes, it should really say line breaking of any kind, as they both use the same mechanism.

dpvc avatar Jul 21 '21 19:07 dpvc

Is this going to be implemented any time soon?

ShadiestGoat avatar Sep 14 '21 16:09 ShadiestGoat

@ShadiestGoat, not until next year.

dpvc avatar Sep 15 '21 22:09 dpvc

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

That's the reason why nearly nobody is using MathJax 3. I would put it as highest priority if you want to distribute MathJax 3 and see it being successful. I nearly swapped to Katex because of this missing feature, and maybe will do so. However, Mathjax is still my favorite (bolder font, line break of Jax 2 and other features).

Am I the only person who doesn't see this as such a big deal? When working with LaTeX I always use the amsmath environments like gather and multline if my formula or equation is too long to fit in one line. In fact, LaTeX (like MathJax v3) doesn't even support line breaks in a regular equation environment. The same amsmath environments have been ported to MathJax so there should be no problem writing math just like you would in LaTeX.

averms avatar Oct 04 '21 00:10 averms

Wow, thanks for the comment @averms. From the issue description I incorrectly thought that \\ line breaks aren't supported anywhere. However it seems that on the contrary only the cases not supported by latex itself don't work. All the relevant amsmath environments actually work quite well.

akhmerov avatar Oct 04 '21 00:10 akhmerov

Am I the only person who doesn't see this as such a big deal?

A super common LaTeX paradigm, in my experience, is $stuff$\\$stuff$, which this would be the closest to. Though I'll admit that $stuff$<br>$stuff$ can work in some/most contexts (e.g. Jupyter) for something sort of equivalent.

In any case, I don't think the problem is really humans writing MathJax -- it's packages that generate MathJax code. From that perspective this is a major API break from previous MathJax versions, regardless of what is supposed be doable in LaTeX or not. I'm getting a bit of visceral horror after running across this issue at the thought of trying to figure out where my package is using \\ and what would come out equivalent to those cases.

rawlins avatar Oct 04 '21 13:10 rawlins

A super common LaTeX paradigm, in my experience, is $stuff$\\$stuff$, which this would be the closest to.

I don't quite follow. Under which conditions would mathjax see this input? Assuming that v2 MathJax hub is configured to respond to $ delimiters, \\ wouldn't be seen and rendered by MathJax in this example. Can you please elaborate?

~~EDIT: Additionally, already in MathJax2 a\\a results in a processing error in Jupyterlab. :thinking:~~ my bad, wrong configuration.

akhmerov avatar Oct 04 '21 14:10 akhmerov

A super common LaTeX paradigm, in my experience, is $stuff$\\$stuff$, which this would be the closest to.

I don't quite follow.

The theory seemed to be that this change would ok because humans writing LaTeX don't (or shouldn't) use \\ in math mode. I was providing something they very commonly do instead, which has no direct analogue in MathJax, and using \\ directly is the closest to.

Additionally, already in MathJax2 a\a results in a processing error in Jupyterlab. 🤔

$a\\a$ works fine in currentish jupyter lab (up to date condaforge versions at least), so 🤔 indeed...

rawlins avatar Oct 04 '21 14:10 rawlins