Welcome to our community

Be a part of something great, join today!

Ugly LaTeX on Google sites

caffeinemachine

Well-known member
MHB Math Scholar
Mar 10, 2012
834
I want to write math symbols along with normal text on my google site. I googled on how to go about doing that. That led me to this page https://sites.google.com/site/gencoreoperative/index/articles-and-hacks/google-s-latex

So now what I did was put "Prove that for any natural number <img src="http://www.google.com/chart?cht=tx&chf=bg,s,FFFFFF00&chco=000000&chl=n" /> the number <img src="http://www.google.com/chart?cht=tx&chf=bg,s,FFFFFF00&chco=000000&chl=\displaystyle{2n}\choose{n}" /> divides the least common multiple of <img src="http://www.google.com/chart?cht=tx&chf=bg,s,FFFFFF00&chco=000000&chl=1,\,2,\,\ldots,\,2n-1,\,2n" />." inside an 'HTML Box' I inserted using the insert menu. It works but the output is extremely ugly. The Math symbols are not properly aligned with the text.
 

Ackbach

Indicium Physicus
Staff member
Jan 26, 2012
4,197
We use MathJax here, which provides very nice alignment of text and $\LaTeX$. Is there a way you could install MathJax on your site?
 

Bacterius

Well-known member
MHB Math Helper
Jan 26, 2012
644
What I did to enable MathJax on my website (credits to Jameson for showing me) is add this script to the top of every page you want to become math-enabled:

Code:
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({

    TeX: {extensions: ["cancel.js"]},
    extensions: ["tex2jax.js"],
    jax: ["input/TeX", "output/HTML-CSS"],
 displayAlign: "center",
          displayIndent: "2em",
    tex2jax: {
       inlineMath: [ ['$','$'], ['\\(','\\)'] ], 
displayMath: [ ['$$','$$'], ['\\\[','\\\]'] ],
      processEscapes: true
    }
  });  
</script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
Then on those pages everything between dollar signs will be interpreted as LaTeX code and rendered accordingly.
 

caffeinemachine

Well-known member
MHB Math Scholar
Mar 10, 2012
834
We use MathJax here, which provides very nice alignment of text and $\LaTeX$. Is there a way you could install MathJax on your site?
Thanks Ackbach for replying. To me 'MathJax' is a bugaboo. I have heard stories that people use MathJax.. but I don't know anything more than that about it. :eek: I'll ask my techie friend about MathJax.. he might know something.

- - - Updated - - -

What I did to enable MathJax on my website (credits to Jameson for showing me) is add this script to the top of every page you want to become math-enabled:

Code:
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({

    TeX: {extensions: ["cancel.js"]},
    extensions: ["tex2jax.js"],
    jax: ["input/TeX", "output/HTML-CSS"],
 displayAlign: "center",
          displayIndent: "2em",
    tex2jax: {
       inlineMath: [ ['$','$'], ['\\(','\\)'] ], 
displayMath: [ ['$$','$$'], ['\\\[','\\\]'] ],
      processEscapes: true
    }
  });  
</script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
Then on those pages everything between dollar signs will be interpreted as LaTeX code and rendered accordingly.
Thanks Bacterius. I tried something like this too.. But google sites don't recognize javascripts.. I wish I could explain this better but I am a total newbie when it comes to websites, HTML, MathJax, JS, PHP.
 

dwsmith

Well-known member
Feb 1, 2012
1,673
Last edited:

Jameson

Administrator
Staff member
Jan 26, 2012
4,052
What kinds of code do you have permission to use on the site? Finding a way to render $\LaTeX$ online isn't the problem, as there are many free sites that allow this. The tricky part is making the input user friendly and avoiding the horribly long string of code you posted in the OP.