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

Problem on Using Mathjax with Jekyll Markdown #830

Closed
ByzanTine opened this issue May 29, 2014 · 2 comments
Closed

Problem on Using Mathjax with Jekyll Markdown #830

ByzanTine opened this issue May 29, 2014 · 2 comments
Labels
Expected Behavior This is how MathJax works

Comments

@ByzanTine
Copy link

Hello,
I am not sure if it's my mistakes, but after I tried a lot, I still get weird result with a jekyll theme using Mathjax.
I tried to write my blog
http://byzantine.github.io/ByzanTineBlog/%5B%22machine%20learning%22%5D/hmm-and-viterbi/
And the first three latex expression use three different method. You may find the .md here
https://github.com/ByzanTine/ByzanTineBlog/blob/gh-pages/_posts/2014-05-28-hmm-and-viterbi.md

The problem is when I am using $$ $$, it display as inline. And when I am using [ ... ], it works pretty good but when I do a little bit complex expression like

[P(z_t|z_{t-1} z_{t-2}) = P(z_2|z_1)\quad t\in 2...T]

Then it won't render properly.
In case you can't see my page, here is the .md file
screenshot from 2014-05-28 23 53 26

And here is the output
screenshot from 2014-05-28 23 54 18

By the way, here is the config of Mathjax I am using
screenshot from 2014-05-28 23 58 32

Hope somebody can help me out!

@pkra
Copy link
Contributor

pkra commented May 29, 2014

This is a common problem with Markdown and MathJax interacting badly. The problem is that the markdown processor runs first and transforms _...._ into <em> ... </em>. This alone would break the rendering; in addition the TeX preprocessor will stop at HTML elements, so the \[ and \] are being ignored.

For more information, see http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-in-html-documents.

@pkra
Copy link
Contributor

pkra commented May 29, 2014

I almost forgot: to fix this, just use markdown's escape mechanism and turn _ into \_ . That way, Markdown will convert \_ to _ in the HTML and MathJax will be happy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Expected Behavior This is how MathJax works
Projects
None yet
Development

No branches or pull requests

2 participants