pages-gem: MathJax not rendering on .github.io
Before submitting an issue, please be sure to
- Read the contributing instructions
- Update to the latest Gem version (either
gem update pages-gem
orbundle update pages-gem
)
This issue affects
- The site generated by GitHub Pages
- Building sites locally
What did you do (e.g., steps to reproduce)
When trying to use MathJax as described here to display latex formulas the formulas are not rendered on the github.io version of websites created with jekyll. When previewing a site locally with jekyll serve
, MathJax formula rendering works without issues.
What did you expect to happen?
See latex style formulas render online as well as offline.
What happened instead?
Latex style formulas didn’t render online.
Additional information
- Link to the live site (if applicable):
- Link to the source repo (if applicable):
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 19 (1 by maintainers)
Commits related to this issue
- (Hopefully) correct the MathJax issue. Found the solution here: https://github.com/github/pages-gem/issues/307. — committed to Csega/csega.github.io by Csega 7 years ago
- Following instructions From here: https://github.com/github/pages-gem/issues/307 — committed to Csega/csega.github.io by Csega 7 years ago
- trying to get mathjax to work. Following https://github.com/github/pages-gem/issues/307 — committed to sharkovsky/sharkovsky.github.io by sharkovsky 7 years ago
- Changed http to https load MathJaz Suggested as solution on https://github.com/github/pages-gem/issues/307 — committed to DavidJaz/DavidJaz.github.io by DavidJaz 7 years ago
- Fix math display https://github.com/github/pages-gem/issues/307 — committed to logancyang/legacy-jekyll-blog by logancyang 7 years ago
- add mathjax support to https https://github.com/github/pages-gem/issues/307 — committed to aliciawyy/aliciawyy.github.io by fcalice 7 years ago
- Added a new version of MathJax Plugin - Fixed it using a new procedure https://github.com/github/pages-gem/issues/307 — committed to johnanthonyjose/dynamic by johnanthonyjose 6 years ago
- MathJax added After several attempts, this was the only fix I found to render the math correctly... The script was copied from: * https://github.com/github/pages-gem/issues/307 * http://csega.github... — committed to valentermz/valentermz.github.io by valentermz 6 years ago
- changes to layout src: https://github.com/github/pages-gem/issues/307 @hugomilan — committed to jprahladan/calamityjane by jprahladan 6 years ago
- Fix mathjax on github.io need to use https for the script loads, see: https://github.com/github/pages-gem/issues/307 — committed to nbren12/clivar-blog-boostrapping by nbren12 4 years ago
- change mathjax script https://github.com/github/pages-gem/issues/307 — committed to greatertidy/greatertidy.github.io by clipp-ing 2 years ago
The issue was not due to jekyll but my browser refusing to load http content from mathjax on a https page. Changing the mathjax js to be loaded via https solved the problem.
Thanks, for now this is good to me. I even wrote a short blog post about it: http://csega.github.io/mypost/2017/03/28/how-to-set-up-mathjax-on-jekyll-and-github-properly.html.
Just if someone else face the same problem, you should use this:
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>I went to your repository and I have some suggestions.
Thank you very much for the help! It works now! 😃 The solution at the end was, that I had to move the scripts to the _includes/head.html, since the _layouts/default.html includes that. And I had to change the autoNumber: “AMS” to autoNumber: “all”, because with AMS the auto numbering did not work, I don’t know, why. But it works now, and it’s beautiful and thank you very much for your help again! 😃 I’ll definitely try Jekyll on my computer too. I am not really familiar with Ruby, but I hope it’s not too complicated.
I was able to render successfully locally and not on GitHub. This method solved the issue for me.
Mine is rendered locally but not remotely. here is the post
here is the source
I have put
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> MathJax.Hub.Config({ config: ["MMLorHTML.js"], extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js"], jax: ["input/TeX"], tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ], displayMath: [ ['$$','$$'], ["\\[","\\]"] ], processEscapes: false }, TeX: { TagSide: "right", TagIndent: ".8em", MultLineWidth: "85%", equationNumbers: { autoNumber: "AMS", }, unicode: { fonts: "STIXGeneral,'Arial Unicode MS'" } }, showProcessingMessages: false });
under_includes/head.html
and it’s being loaded as I checked in developer’s mode in Safari (Inspect element).On remote this is
<p>The expectation <script type="math/tex">E(X)</script></p>
On local this is
<p>The expectation <span class="MathJax_Preview" style="color: inherit; display: none;"></span><span class="MathJax" id="MathJax-Element-1-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>E</mi><mo stretchy="false">(</mo><mi>X</mi><mo stretchy="false">)</mo></math>" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-1" style="width: 2.462em; display: inline-block;"><span style="display: inline-block; position: relative; width: 2.001em; height: 0px; font-size: 122%;"><span style="position: absolute; clip: rect(1.744em, 1001.949em, 2.871em, -999.997em); top: -2.559em; left: 0em;"><span class="mrow" id="MathJax-Span-2"><span class="mi" id="MathJax-Span-3" style="font-family: STIXGeneral-Italic;">E<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mo" id="MathJax-Span-4" style="font-family: STIXGeneral-Regular;">(</span><span class="mi" id="MathJax-Span-5" style="font-family: STIXGeneral-Italic;">X<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.054em;"></span></span><span class="mo" id="MathJax-Span-6" style="font-family: STIXGeneral-Regular;">)</span></span><span style="display: inline-block; width: 0px; height: 2.564em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.247em; border-left-width: 0px; border-left-style: solid; width: 0px; height: 1.191em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>E</mi><mo stretchy="false">(</mo><mi>X</mi><mo stretchy="false">)</mo></math></span></span><script type="math/tex" id="MathJax-Element-1">E(X)</script></p>
If I recall correctly, autonumber AMS works when you define equations in the /begin{equation}, etc. I don’t think it will autonumerate equations defined in $$ eq $$. But you can check MathJax documentation, it is really nice.