latex

parse latex for wikipedia

  1. // ==UserScript==
  2. // @name latex
  3. // @namespace http://*.*/*
  4. // @version 0.5
  5. // @description parse latex for wikipedia
  6. // @author yulinfeng.mail@foxmail.com
  7. // @match https://chat.openai.com/*
  8. // @match https://*.wikipedia.org/*
  9. // @match https://*.reddit.com/*
  10. // @match https://*.quora.com/*
  11. // @match http://*.reddit.com/*
  12. // @match http://*.quora.com/*
  13. // @match http://*.wikipedia.org/*
  14. // @match https://www.bing.com/search?*
  15. // @grant none
  16.  
  17. // ==/UserScript==
  18. (function() {
  19. if (window.MathJax === undefined) {
  20. var script = document.createElement("script");
  21. script.type = "text/javascript";
  22. script.src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML";
  23. var config = 'MathJax.Hub.Config({' + 'extensions: ["tex2jax.js"],' + 'tex2jax: { inlineMath: [["$","$"],["\\\\\\\\\\\\(","\\\\\\\\\\\\)"]], displayMath: [["$$","$$"],["\\\\[","\\\\]"]], processEscapes: true },' + 'jax: ["input/TeX","output/HTML-CSS"]' + '});' + 'MathJax.Hub.Startup.onload();';
  24. if (window.opera) {
  25. script.innerHTML = config
  26. } else {
  27. script.text = config
  28. }
  29. document.getElementsByTagName("head")[0].appendChild(script);
  30. } else {
  31. MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
  32. }
  33. })();