Skip to content

Instantly share code, notes, and snippets.

@pkra
Last active December 12, 2015 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkra/4725284 to your computer and use it in GitHub Desktop.
Save pkra/4725284 to your computer and use it in GitHub Desktop.
A bookmarklet, see https://en.wikipedia.org/wiki/Bookmarklet#Installation A fork of [this](https://gist.github.com/pkra/4574933) (in turn based on https://github.com/dzejkej/mathjax-bookmarklet and http://docs.mathjax.org/en/latest/dynamic.html). Modified for wordpress.com, trying to incorporate [Davide Cervone's answer](http://stackoverflow.com…
javascript:(function(){var images = document.getElementsByTagName('img'), count = 0; for (var i = images.length - 1; i >= 0; i--) { var img = images[i]; if (img.className === "latex") { var script = document.createElement("script"); script.type = "math/tex"; if (window.opera) {script.innerHTML = img.title} else {script.text = img.title} img.parentNode.replaceChild(script,img);count++; }};function a(a){var b=a.createElement('script'),c;b.src='https://c328740.ssl.cf1.rackcdn.com/mathjax/2.1-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML.js',b.type='text/javascript',c='MathJax.Hub.Config({tex2jax:{inlineMath:[[\'$\',\'$\']],displayMath:[[\'\\\\[\',\'\\\\]\']],processEscapes:true}});MathJax.Hub.Startup.onload();',window.opera?b.innerHTML=c:b.text=c,a.getElementsByTagName('head')[0].appendChild(b)}function b(b){b.MathJax===undefined?a(b.document):b.MathJax.Hub.Queue(new b.Array('Typeset',b.MathJax.Hub))}var c=document.getElementsByTagName('iframe'),d,e;b(window);for(d=0;d<c.length;d++)e=c[d].contentWindow||c[d].contentDocument,e.document||(e=e.parentNode),b(e)})()
@pkra
Copy link
Author

pkra commented May 1, 2013

Maybe a smaller EqnChunk setting would be worth a try.http://docs.mathjax.org/en/latest/options/HTML-CSS.html?highlight=chunk

@pkra
Copy link
Author

pkra commented May 2, 2013

Simpler using jquery

javascript:(function(){

var s=document.createElement('script');s.setAttribute('src','http://code.jquery.com/jquery.js');document.getElementsByTagName('body')[0].appendChild(s); $('body img.tex').replaceWith(function() { return '(' + $(this).attr("alt") + ')'; }); var s=document.createElement('script');s.setAttribute('src','https://c328740.ssl.cf1.rackcdn.com/mathjax/2.1-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML');document.getElementsByTagName('body')[0].appendChild(s);

})()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment