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

Strange math rendering issue #9

Open
drewsday opened this issue Aug 27, 2015 · 5 comments
Open

Strange math rendering issue #9

drewsday opened this issue Aug 27, 2015 · 5 comments
Assignees

Comments

@drewsday
Copy link

I ran into a strange math rendering issue today which I believe I can only connect to prez.

I had the following equation I was trying to display:

$$ v_x = \lim \limits_{\Delta t \to 0} \frac{\Delta x}{\Delta t} = \frac{dx}{dt} $$

Testing with just MathJax and with just reveal.js, this renders correctly. Prez will not correctly render. It seems that the underscore after \limits is causing it to fail.

As a temporary fix, I can include the expression as an graphic, but I'm puzzled why this happens in prez.

@Delapouite
Copy link
Member

Hi.

I'm pretty sure it has to do with custom headers syntax that can optionnaly be added on top of each markdown documents. They are delimited by $ signs.

https://github.com/lmtm/prez#customize-slide-attributes
https://github.com/lmtm/prez/blob/master/lib/slide-properties.js#L46

I'll make a conf option to specify these delimiters soon.

@Delapouite Delapouite self-assigned this Aug 27, 2015
@drewsday
Copy link
Author

Based on that info, I did a test, and it looks like the use of two underscores in the equation is causing the expression to get interpreted as not an equation.

My regex knowledge is not great, but I couldn't quite figure out how line 46 in the slide-properties.js would match the particular equation that I had, since there was no : character in it, and I have a zero in it as well as some slashes and brackets that look to me like they won't match the regex pattern.

Is there any other place in the code where using two underscores would be recognized as a type of delimiter? (I wouldn't be surprised if that's the wrong question to ask, but I'd hate to have you make a conf option if it's not needed.)

@Delapouite
Copy link
Member

You're right. After a bit of investigation, $ symbols are not guilty but the underscores are.
The slides are first converted to markdown before the MathJax plugin kicks in. So the part inside the underscores gets converted to an <em> tag and therefore the equation is then invalid.

@drewsday
Copy link
Author

Since that is the case, then I should be able to escape the underscores in the equations and have it rendered as a correct equation. I tried it for my case, and it seemed to work properly. I'm not sure what other cases may or may not be rendered correctly, but I seem to have a better work around for now.

Thanks.

@dluciv
Copy link

dluciv commented Oct 23, 2016

BTW, to show math, I do so:

Reveal.configure({
    "center": false,
    dependencies: [
        { src: 'plugin/zoom-js/zoom.js', async: true },
        { src: 'plugin/notes/notes.js', async: true },
        { src: 'plugin/math/math.js', async: true }
]});

and then

Reveal.initialize();

In custom.js. Without calling Reveal.initialize myself it does not load MathJax. What's wrong there?..

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

No branches or pull requests

3 participants