susam / mathb

Share mathematics on the web with LaTeX and Markdown

Home Page:https://mathb.in/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refuses to render sometimes with valid LaTeX

dbanet opened this issue · comments

Looks like it's an issue with subscripts after parentheses? Came across the exact same issue. Only works with the first one in a section, any subsequent breaks it.

http://mathb.in/50948

Seems to be caused by Markdown converting the underscores into <em> tags, since the closing parenthesis is seen as a word boundary.

Not sure of an easy way to fix this.

commented

The underscores should be escaped with a backslash so that Markdown does not convert them to <em> tags.

Example: http://mathb.in/51078

$$
(Foo)\_{a} \\
(Foo)\_{a}
$$

But then they're literally underscores instead of being rendered as
subscripts
On Jan 28, 2016 12:36 PM, "Susam Pal" notifications@github.com wrote:

The underscores should be escaped with a backslash so that Markdown does
not convert them to tags.

Example: http://mathb.in/51078

$$
(Foo){a}
(Foo)
{a}
$$


Reply to this email directly or view it on GitHub
#8 (comment).

commented

I overlooked the fact that the subscripts were not rendered. My bad. Thanks for explaining the issue.

Part of the problem is caused by this line in the JavaScript code (

s = s.replace(/\\/g, '\\\\')
) that tries to preserve the backslashes as literal backslashes. Due to this code, the backslashes in the input no longer function in escape sequences. When I wrote this, I thought it was a good idea. But it seems like a problem now.

By the way, with a quick test on http://math.stackexchange.com/questions/ask, I see that the code at http://mathb.in/51078 that is breaking on MathB.in seems to be rendering fine on Math StackExchange. I'll have to see how they are doing this right.

It will take me a while to get back to this project. So in the meantime, any pull requests are very welcome.

commented

I wonder if this is related:

Doesn't work:
\[
\dot{\varepsilon}_{13} n_{3}
\]

Works:
\[
\dot\varepsilon_{13} n_{3}
\]
Works:
\[
\dot{\varepsilon}_{13} n_3
\]

It appears that }_something_{ will render something as italic instead of picking up subscripts in math mode.

commented

This is no longer be an issue. MathB.in now uses the TeXMe parser which handles a mix of Markdown (GFM) and LaTeX (MathJax) code robustly.