{"action":"opened","issue":{"url":"https://api.github.com/repos/hakimel/reveal.js/issues/1359","labels_url":"https://api.github.com/repos/hakimel/reveal.js/issues/1359/labels{/name}","comments_url":"https://api.github.com/repos/hakimel/reveal.js/issues/1359/comments","events_url":"https://api.github.com/repos/hakimel/reveal.js/issues/1359/events","html_url":"https://github.com/hakimel/reveal.js/issues/1359","id":107316455,"number":1359,"title":"MathJax sometimes fails in markdown sections/slides","user":{"login":"karlroberts","id":462160,"avatar_url":"https://avatars.githubusercontent.com/u/462160?v=3","gravatar_id":"","url":"https://api.github.com/users/karlroberts","html_url":"https://github.com/karlroberts","followers_url":"https://api.github.com/users/karlroberts/followers","following_url":"https://api.github.com/users/karlroberts/following{/other_user}","gists_url":"https://api.github.com/users/karlroberts/gists{/gist_id}","starred_url":"https://api.github.com/users/karlroberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karlroberts/subscriptions","organizations_url":"https://api.github.com/users/karlroberts/orgs","repos_url":"https://api.github.com/users/karlroberts/repos","events_url":"https://api.github.com/users/karlroberts/events{/privacy}","received_events_url":"https://api.github.com/users/karlroberts/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-19T06:54:16Z","updated_at":"2015-09-19T06:54:16Z","closed_at":null,"body":"HI,\r\nThanks for Reveal.js it's awesome. I have been using the MaxJax plugin and found it works well in most cases but then sometimes it fails when used in MarkDown sections.\r\n\r\nIt seems that when the math statement gets too complex it fails, but the same math is rendered fine in a normal html section. Perhaps one too many { causes markdown a problem?\r\n\r\nHere are some example that demonstrate it.\r\n\r\n-- the following is in a markdown slide:-\r\n```\r\n#### example math functions\r\n* this inline math works  $ (\\theta_0,\\theta_1) $ \r\n* the following none inline math works Fine\r\n\r\n$$ J(\\theta_0,\\theta_1) = \\sum_i^m  $$\r\n\r\n* however this math fails to render as MathJax\r\n\r\n$$ J(\\theta_0,\\theta_1) = \\sum_{i=0}  $$\r\n\r\nNB the above works in http://cdn.mathjax.org/mathjax/latest/test/sample-dynamic-2.html or when placed in a HTML section rather than a markdown section.\r\n```\r\n\r\nnote that when I look at the page element the working one is rendered as:-\r\n```\r\n<p><span class=\"MathJax_Preview\" style=\"color: inherit;\"></span><div class=\"MathJax_SVG_Display\" style=\"text-align: center;\"><span class=\"MathJax_SVG\" id=\"MathJax-Element-12-Frame\" role=\"math\" style=\"font-size: 105%; display: inline-block;\"><svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"15.176ex\" height=\"6.667ex\" viewBox=\"0 -1623.2 6525.4 2882\" style=\"vertical-align: -3.035ex; margin: 1px 0ex;\"><g stroke=\"currentColor\" fill=\"currentColor\" stroke-width=\"0\" transform=\"matrix(1 0 0 -1 0 0)\"><use xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#MJMATHI-4A\" x=\"0\" y=\"0\"></use><use xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#MJMAIN-28\" x=\"638\" y=\"0\"></use><g transform=\"translate(1032,0)\"><use xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#MJMATHI-3B8\" x=\"0\" y=\"0\"></use><use transform=\"scale(0.707)\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#MJMAIN-30\" x=\"670\" y=\"-213\"></use></g><use xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#MJMAIN-2C\" x=\"1963\" y=\"0\"></use><g transform=\"translate(2412,0)\"><use xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#MJMATHI-3B8\" x=\"0\" y=\"0\"></use><use transform=\"scale(0.707)\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#MJMAIN-31\" x=\"670\" y=\"-213\"></use></g><use xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#MJMAIN-29\" x=\"3343\" y=\"0\"></use><use xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#MJMAIN-3D\" x=\"4015\" y=\"0\"></use><g transform=\"translate(5076,0)\"><use xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#MJSZ2-2211\" x=\"0\" y=\"0\"></use><use transform=\"scale(0.707)\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#MJMATHI-69\" x=\"849\" y=\"-1558\"></use><use transform=\"scale(0.707)\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#MJMATHI-6D\" x=\"583\" y=\"1640\"></use></g></g></svg></span></div><script type=\"math/tex; mode=display\" id=\"MathJax-Element-12\"> J(\\theta_0,\\theta_1) = \\sum_i^m  </script></p>\r\n```\r\n\r\nbut the failing one is rendered as:-\r\n```\r\n<p>$$ J(\\theta<em>0,\\theta_1) = \\sum</em>{i=0}  $$</p>\r\n```\r\n\r\nAs mentioned above the failing math works if I place it in a normal html section.\r\n--- the following is in index.html\r\n```\r\n<section>\r\n  <p>\r\n    $$ J(\\theta_0,\\theta_1) = \\sum_{i^m} $$\r\n </p>\r\n <p>\r\n    $$ J(\\theta_0,\\theta_1) = {1\\over2m} \\sum_i^m \\left(h_\\theta\\left(x^{(i)}\\right) - y^{(i)}\\right)^2 $$\r\n </p>\r\n</section>\r\n```\r\n\r\nfor compleatness here is my reveal initialize function found in index.html\r\n\r\n```\r\n<script>\r\n\t\t\t// Full list of configuration options available at:\r\n\t\t\t// https://github.com/hakimel/reveal.js#configuration\r\n\t\t\tReveal.initialize({\r\n\t\t\t\tcontrols: true,\r\n\t\t\t\tprogress: true,\r\n\t\t\t\thistory: true,\r\n\t\t\t\tcenter: true,\r\n\r\n\t\t\t\ttransition: 'none', // none/fade/slide/convex/concave/zoom\r\n\r\n\t\t\t\tmath: {\r\n\t\t\t\t\tmathjax: 'https://cdn.mathjax.org/mathjax/latest/MathJax.js',\r\n\t\t\t\t\tconfig: 'TeX-AMS_HTML', \r\n\t\t\t\t},\r\n\r\n\t\t\t\t// Optional reveal.js plugins\r\n\t\t\t\tdependencies: [{\r\n\t\t\t\t\t\tsrc: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/lib/js/classList.js',\r\n\t\t\t\t\t\tcondition: function() {\r\n\t\t\t\t\t\t\treturn !document.body.classList;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, {\r\n\t\t\t\t\t\tsrc: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/plugin/markdown/marked.js',\r\n\t\t\t\t\t\tcondition: function() {\r\n\t\t\t\t\t\t\treturn !!document.querySelector('[data-markdown]');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, {\r\n\t\t\t\t\t\tsrc: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/plugin/markdown/markdown.js',\r\n\t\t\t\t\t\tcondition: function() {\r\n\t\t\t\t\t\t\treturn !!document.querySelector('[data-markdown]');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, {\r\n\t\t\t\t\t\tsrc: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/plugin/highlight/highlight.js',\r\n\t\t\t\t\t\tasync: true,\r\n\t\t\t\t\t\tasync: true,\r\n\t\t\t\t\t\tcallback: function() {\r\n\t\t\t\t\t\t\thljs.initHighlightingOnLoad();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, {\r\n\t\t\t\t\t\tsrc: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/plugin/zoom-js/zoom.js',\r\n\t\t\t\t\t\tasync: true\r\n\t\t\t\t\t}, {\r\n\t\t\t\t\t\tsrc: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/plugin/notes/notes.js',\r\n\t\t\t\t\t\tasync: true\r\n\t\t\t\t\t},\r\n\t\t\t\t\t// MathJax\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tsrc: 'http://cdn.jsdelivr.net/reveal.js/3.0.0/plugin/math/math.js',\r\n\t\t\t\t\t\tasync: true\r\n\t\t\t\t\t}\r\n\t\t\t\t]\r\n\t\t\t});\r\n\t\t</script>\r\n```\r\n\r\nI hope you can spot the problem.\r\n\r\nCheers\r\n\r\nKarl"}}