2017.06.06 13:10

It is really easy to add TeX in HTML. I use MathJax.

  1. Define the string that indicate the TeX block. Add this in the <head>. This is not needed in Jekyll, since the kramdown Markdown parser handles it.
     <script type="text/x-mathjax-config">
       MathJax.Hub.Config({
       tex2jax: {inlineMath: [ ['$','$'], ['\\(','\\)'] ]}
       });
     </script>
    
  2. Add in <head> the .js that converts these blocks. I add this in _includes/themes/bootstrap-3/default.html in my Jekyll Bootstrap installation (with Bootstrap 3 theme used).
    <script type="text/javascript" async
       src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML">
    </script>
    
  3. Add your TeX block in your .html or .md.
    $$a_1$$ \\(a_2\\)
    

    Will show as \(a_1\) \(a_2\).



blog comments powered by Disqus