Fork me on GitHub

Installing & Configurating MathJax

LaTeX2HTML5

Make sure you have both the MathJax configuration and script. Put this in your <head> tag:


<script type="text/x-mathjax-config">
    // <![CDATA[
    MathJax.Hub.Config({ 
        TeX: {extensions: ["AMSmath.js", "AMSsymbols.js"]},     
        extensions: ["tex2jax.js"],
        jax: ["input/TeX", "output/HTML-CSS"],
        showProcessingMessages : false,
        messageStyle : "none" ,    
        showMathMenu: false ,
        tex2jax: {
            processEnvironments: true,
            inlineMath: [ ['$','$'], ["\(","\)"] ],
            displayMath: [ ['$$','$$'], ["\[","\]"] ],
            preview : "none",
            processEscapes: true
        },
        "HTML-CSS": { linebreaks: { automatic:true, width: "latex-container"} }
    });
    // ]]>
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>
        

LaTeX2HTML5 Installation

  1. Simply download the JS and CSS files and include them on your MathJax enabled website:
         <link rel="stylesheet" href="latex2html5.min.css"> 
         <script type="text/javascript" src="latex2html5.min.js"></script> 
        
  2. If you want the same font as the rendered examples:
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Arbutus+Slab" type="text/css">
        
  3. You have three options for parsing the $\LaTeX$:
    1. You can put $\LaTeX$ inside of the current page within a script tag with the type set to "tex/latex":
                  <script type="tex/latex">
                      ... LaTeX here ...
                  </script>
                  <script type="text/javascript">
                      $('body').latex();
                  </script>
              
    2. or you can read a .tex file from somewhere else, which is nice for editing .tex files:
                  <latex src="path/to/my/latex.tex">
                  <script type="text/javascript">
                      $('latex').LaTeX();
                  </script>
              
    3. or you can write it from scratch!
      
        MathJax.Hub.Register.StartupHook("End",function () {
      
            $('[type="tex/latex"]').each(function (i, el) {
                var $el = $(el);
                var TEX = new LaTeX2HTML5.TeX({
                    tagName: 'section',
                    className: 'latex-container',
                    latex: $el.text()
                });
                TEX.render();
                $el.replaceWith(TEX.$el);
            });
            
        });
      
      
      
                  

Powered by MathJax

Dan Lynch © LaTeX2HTML5 2014