Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The line break(\\) is not work #2312

Open
woody-li opened this issue Oct 2, 2019 · 35 comments
Open

The line break(\\) is not work #2312

woody-li opened this issue Oct 2, 2019 · 35 comments
Labels

Comments

@woody-li
Copy link

@woody-li woody-li commented Oct 2, 2019

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.

@dpvc
Copy link
Member

@dpvc dpvc commented Oct 2, 2019

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.

@woody-li
Copy link
Author

@woody-li woody-li commented Oct 3, 2019

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?

@dpvc
Copy link
Member

@dpvc dpvc commented Oct 4, 2019

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
Copy link
Member

@dpvc dpvc commented Oct 4, 2019

In the meantime, you can do something like

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

to get multiple lines

@woody-li
Copy link
Author

@woody-li woody-li commented Oct 4, 2019

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.

@SeanFlemingMathsPathway
Copy link

@SeanFlemingMathsPathway SeanFlemingMathsPathway commented Oct 9, 2019

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.

@T-Kuhn
Copy link

@T-Kuhn T-Kuhn commented Feb 4, 2020

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}

@dpvc
Copy link
Member

@dpvc dpvc commented Feb 4, 2020

@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
Copy link
Member

@dpvc dpvc commented Feb 4, 2020

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

@dpvc dpvc transferred this issue from mathjax/MathJax-src Feb 4, 2020
@T-Kuhn
Copy link

@T-Kuhn T-Kuhn commented Feb 5, 2020

@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.

@dpvc
Copy link
Member

@dpvc dpvc commented Feb 5, 2020

@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.

@woody-li
Copy link
Author

@woody-li woody-li commented Jun 22, 2020

Any update or schedule about it?

@dpvc
Copy link
Member

@dpvc dpvc commented Jun 22, 2020

@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.

@TheSil
Copy link

@TheSil TheSil commented Sep 12, 2020

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).

@q2apro
Copy link

@q2apro q2apro commented Sep 15, 2020

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).

@jasongrout
Copy link

@jasongrout jasongrout commented Jul 9, 2021

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: jupyterlab/jupyterlab#7218

@pkra
Copy link
Contributor

@pkra pkra commented Jul 9, 2021

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

@jasongrout
Copy link

@jasongrout jasongrout commented Jul 9, 2021

@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.

@abnerlee
Copy link

@abnerlee abnerlee commented Jul 20, 2021

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 😂 ...

@dpvc
Copy link
Member

@dpvc dpvc commented Jul 21, 2021

@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
Copy link
Member

@dpvc dpvc commented Jul 21, 2021

@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.

@ShadiestGoat
Copy link

@ShadiestGoat ShadiestGoat commented Sep 14, 2021

Is this going to be implemented any time soon?

@dpvc
Copy link
Member

@dpvc dpvc commented Sep 15, 2021

@ShadiestGoat, not until next year.

@averms
Copy link

@averms averms commented Oct 4, 2021

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.

@akhmerov
Copy link

@akhmerov akhmerov commented Oct 4, 2021

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.

@rawlins
Copy link

@rawlins rawlins commented Oct 4, 2021

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.

@akhmerov
Copy link

@akhmerov akhmerov commented Oct 4, 2021

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. 🤔 my bad, wrong configuration.

@rawlins
Copy link

@rawlins rawlins commented Oct 4, 2021

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...

seungukj added a commit to seungukj/seungukj.github.io that referenced this issue Oct 15, 2021
@SwaySZ
Copy link

@SwaySZ SwaySZ commented Oct 28, 2021

It works when using four slashes \\\\ instead of two \\ in markdown. see below:

\begin{align}
a_{11}& =b_{11}\\\\
  a_{22}& =b_{22}+c_{22}
\end{align}

@octo-kumo
Copy link

@octo-kumo octo-kumo commented Jan 2, 2022

bump, I think this should be relatively simple to fix?

@ShadiestGoat
Copy link

@ShadiestGoat ShadiestGoat commented Jan 2, 2022

@ShadiestGoat, not until next year.

Happy new years :)

@dpvc
Copy link
Member

@dpvc dpvc commented Jan 7, 2022

@octo-kumo

I think this should be relatively simple to fix?

It's not. It is part of the larger automatic line-breaking process, and that is quite complicated. It is planned for later this year, after the major font update that is currently in process.

@cdwilson
Copy link

@cdwilson cdwilson commented Feb 9, 2022

It works when using four slashes \\\\ instead of two \\ in markdown. see

Just an FYI for anybody else running across this for markdown documents: I found that using four slashes (\\\\) was necessary to get the correct output on my Hugo site, but caused Typora editor to produce duplicate newlines.

Switching to \newline instead of \\\\ produces the correct results in both places:

\begin{align}
a_{11}& =b_{11}\newline
a_{22}& =b_{22}+c_{22}
\end{align}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet