mathb icon indicating copy to clipboard operation
mathb copied to clipboard

Refuses to render sometimes with valid LaTeX

Open dbanet opened this issue 9 years ago • 6 comments

http://mathb.in/39606

dbanet avatar Jul 26 '15 07:07 dbanet

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

jcreigh avatar Jan 27 '16 05:01 jcreigh

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.

jcreigh avatar Jan 27 '16 05:01 jcreigh

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}
$$

susam avatar Jan 28 '16 17:01 susam

But then they're literally underscores instead of being rendered as subscripts On Jan 28, 2016 12:36 PM, "Susam Pal" [email protected] 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 https://github.com/susam/mathb/issues/8#issuecomment-176296329.

jcreigh avatar Jan 28 '16 17:01 jcreigh

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 (https://github.com/susam/mathb/blob/0433c40cdc5f97dd8e7f9861dcf6b512baa5bcd9/scripts/mathb.js#L229) 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.

susam avatar Jan 28 '16 18:01 susam

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.

adigitoleo avatar Mar 16 '22 03:03 adigitoleo

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.

susam avatar Oct 08 '22 00:10 susam