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

Bug in formatting mathjax/LaTeX inconsistently depending on chosen delimiters, markdown interaction #759

Closed
mpacer opened this issue Nov 26, 2015 · 2 comments

Comments

@mpacer
Copy link
Member

mpacer commented Nov 26, 2015

I just discovered that the notebook formats the same LaTeX input in different ways depending upon your choice of equation delimiter for LaTeX/mathjax which traditionally should not matter.

An example of this bug (plus a png of the correctly rendered incorrect rendering, since github apparently has its own bugs regarding displaying LaTeX/mathjax embedded in notebooks) can be found at https://gist.github.com/michaelpacer/2b627ffe8f10cde53926.

Put briefly, it's not supposed to matter whether you choose to delimit LaTeX formatted math with \(…\) and $…$ for inline equations or \[…\] or $$…$$ for displayed equations. Of course, because \ is used as an escape character we have to instead use\\(…\\) \\[…\\], which in theory is fine. However, because LaTeX formatted subscripts use the _ symbol, and that conflicts with markdown's interpretation of _…_ as an indicator of italics, it seems that notebook parses these two different ways of delimiting equations differently. If you use \\(…\\) \\[…\\] then you need to escape underscores \_ but that means that your LaTeX is now invalid outside of the notebook (as can be seen in the rendering of \_ when using $…$ and $$…$$ as the delimiters).

For now it seems safer to guide people to just use $…$ and $$…$$, since then at least it will interpret valid LaTeX properly (this has the unfortunate side-effect of conflicting with one of the LaTeX "deadly sins", but I think that's a less big issue than writing inaccurate LaTeX to get accurate formatting, imho).

I'm not sure if there is going to be an easy or even possible fix for this (since I know this kind of parsing is incredibly difficult to manage) but I was befuddled with why my properly formatted LaTeX was not being rendered at all, so I figured I'd bring it to people's attention.

@minrk minrk added this to the 5.0 milestone Dec 16, 2015
@minrk
Copy link
Member

minrk commented Dec 16, 2015

It might be in how we escape math to avoid markdown mucking it up. Markdown shouldn't be touching the latex inside these blocks.

@mpacer
Copy link
Member Author

mpacer commented Mar 9, 2017

Closed by #2220

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants