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

How to get a new line? #34

Closed
nioclass opened this issue Nov 13, 2022 · 1 comment
Closed

How to get a new line? #34

nioclass opened this issue Nov 13, 2022 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@nioclass
Copy link

I am trying to write some math in two separate lines using "//" as the new line. But this is not working and the elements are rendering on the same line. For example:

    <MathJaxContext>
        <MathJax>{" a // b "}</MathJax>
    </MathJaxContext>

This renders:
ab
instead of:
a
b

The same happens when I replace "//" with "////".

How do I get a new line?

@fast-reflexes
Copy link
Owner

fast-reflexes commented Nov 13, 2022

Hi there!

Looks like that line break is only working with MathJax 2 and not in MathJax 3 (mathjax/MathJax#2312). So use version={2} in your MathJaxContext and it should work. I also suggest you use delimiters in your MathJax code since even if line breaks WOULD work, it wouldn't work if you didn't delimit your MathJax content with appropriate delimiters, much like how it is done in pure MathJax. Please check examples.

If you want to use MathJax 3, you can check the suggestions given in this thread: https://stackoverflow.com/questions/62583406/why-doesnt-display-a-newline-in-mathjax

You can also always enforce line breaks in the HTML instead:

<MathJaxContext>
    <MathJax>
        <span>{"\\(a\\)"}</span>
        <br />
        <span>{"\\(b\\)"}</span>
    </MathJax>
</MathJaxContext>

@fast-reflexes fast-reflexes added the help wanted Extra attention is needed label Nov 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants