mathematic formula syntactic error when I convert LaTex to markdown with pandoc -


is there way convert latex file markdown without many errors? don't want lots of works fix errors...

i use command: pandoc -s xxx.tex -o xxx.md convert , use mou view it. here piece of code converted pandoc:

$$\begin{aligned}   h_{1}:p(q_{2}|q_{1})=&p=p(q_{2}|\neg q_{1})\\ h_{2}:p(q_{2}|q_{1})=p_{1}&\ne p_{2}=p(q_{2}|\neg q_{1}) \end{aligned}$$ 

here errors:

  • it seems correct, all _ red, shows there errors. try add \ before every _. , in $$display$$ formula, if there more 1 subscript signs, mou show formula illegal.
  • and inline mathematical formula converted $c_{k} = 0$, correct syntactic $$$c_{k} = 0$$$ in mou.

i run same code on stackedit, online markdown editor, code works well! not error in stackedit, no _ errors , $inline$ errors. unfortunately, mechanism of github pages seems same mou, rather stackedit. tried download mathjax , link markdown file, useless.

thanks!


my perpose post summary on github pages. here solution found(and problem seems happen on mac):

  • to using subscript sign _ derectly, rather adding \ before each _, adding these code _config.yml in repo directory:

    markdown: redcarpet  redcarpet:   extensions: [autolink, no_intra_emphasis, strikethrough, tables, with_toc_data] 
  • using $inlinemath$ rather $$$inlinemath$$$, should add piece of code head.html or <head> block:

      <!--here code config mathjax-->      <script type="text/x-mathjax-config">     mathjax.hub.config({     tex2jax: {       inlinemath: [['$','$'], ['\\(','\\)']],  <!--this line set inline math-->       processenvironments: true,       processescape: true     },     'html-css': {       matchfontheight: true,       availablefonts: [],       webfont: 'tex'     }     });   </script>    <!-- here code, link mathjax -->   <script type="text/javascript"    src="http://cdn.mathjax.org/mathjax/latest/mathjax.js?config=tex-ams-mml_htmlormml">   </script> 

then post beautiful formula less work :)


Comments