How do I configure mathjax for iPython notebooks?

后端 未结 5 949
借酒劲吻你
借酒劲吻你 2021-02-06 05:16

I\'m trying to find a way for mathjax to not use STIX fonts for math in my iPython notebook. Instead, I\'d much rather have it use the \'TeX\' fonts. According to the documentat

5条回答
  •  情话喂你
    2021-02-06 05:28

    I've tweaked @Stefan Shi's answer to something a little easier, at least if you have the command-line svn installed.

    • Put the following into a script file called install_tex_fonts (install_tex_fonts.bat in Windows-land):

      svn export https://github.com/mathjax/MathJax/trunk/fonts/HTML-CSS/TeX/woff fonts/HTML-CSS/TeX/woff
      svn export https://github.com/mathjax/MathJax/trunk/jax/output/HTML-CSS/fonts/TeX jax/output/HTML-CSS/fonts/TeX
      
    • Move the script file into {PYTHON}/Lib/site-packages/notebook/static/components/MathJax where {PYTHON} is the root directory where you installed Python

    • Open a shell (command prompt) in this directory
    • Run the script by typing install_tex_fonts (or ./install_tex_fonts on *nix systems; I guess you also have to chmod a+x it)
    • Add the following section in your ~/.jupyter/custom/custom.js file (the $([IPython.events]).on('app_initialized.NotebookApp') line should already be there):

      $([IPython.events]).on('app_initialized.NotebookApp', function(){
      
        MathJax.Hub.Config({
          "HTML-CSS": {
              availableFonts: ["TeX"],
              preferredFont: "TeX",
              webFont: "TeX"
          }
         });
      

提交回复
热议问题