Skip to content

Instantly share code, notes, and snippets.

@fizyk20
Forked from goatandsheep/Texify-Mathjax.js
Last active July 4, 2018 12:42
Show Gist options
  • Save fizyk20/aa04e990080517d8af4aa49162a87130 to your computer and use it in GitHub Desktop.
Save fizyk20/aa04e990080517d8af4aa49162a87130 to your computer and use it in GitHub Desktop.
[Deprecated] A Tampermonkey / Greasemonkey script that turns LaTeX code on page into mathematical symbols using MathJax
// ==UserScript==
// @name TeXify the World MathJax
// @version 1.0
// @description Enables MathJax to process LaTeX on all websites. Based off SOUP (Stack Overflow Unofficial Patch) and http://www.math.ucla.edu/~robjohn/math/mathjax.html.
// @include *
// ==/UserScript==
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js" //(mathjaxVersion + "/mathjax/latest/MathJax.js?config=TeX-AMS_HTML");
var config = 'MathJax.Hub.Config({ ' + 'extensions: ["tex2jax.js"], ' +
'tex2jax: { skipTags: ["script","noscript","style","textarea"],inlineMath: [ ["[;", ";]"], ["$$","$$"]], displayMath: [["[(;",";)]"]], processEscapes: true }, ' +
'jax: ["input/TeX", "output/HTML-CSS"] ' + ' }); ' +
'MathJax.Hub.Startup.onload(); ' +
'window.setInterval(function () {"use strict"; MathJax.Hub.Queue(["Typeset", MathJax.Hub]); }, 3000);';
script.text = config;
document.getElementsByTagName("head")[0].appendChild(script);
console.log("The TeX-ification is complete!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment