LaTeX Improving Math Symbol Alignment on Google Sites: A Scientist's Guide

  • Thread starter Thread starter caffeinemachine
  • Start date Start date
  • Tags Tags
    Google Latex
AI Thread Summary
To incorporate math symbols alongside regular text on Google Sites, users have explored using MathJax for better formatting and alignment of LaTeX code. The initial attempt involved using Google Chart URLs to display math symbols, but the output was visually unappealing. A suggested solution is to add a specific MathJax script to the top of each page, which enables the rendering of LaTeX code between dollar signs. However, challenges arise as Google Sites does not support JavaScript, complicating the implementation of MathJax. Users are encouraged to seek alternatives for rendering LaTeX online or to find user-friendly methods that simplify the coding process.
caffeinemachine
Gold Member
MHB
Messages
799
Reaction score
15
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.
 
Physics news on Phys.org
We use MathJax here, which provides very nice alignment of text and $\LaTeX$. Is there a way you could install MathJax on your site?
 
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.
 
Ackbach said:
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. :o I'll ask my techie friend about MathJax.. he might know something.

- - - Updated - - -

Bacterius said:
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.
 
Last edited:
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.
 

Similar threads

Replies
1
Views
1K
Replies
15
Views
25K
Replies
4
Views
4K
Replies
3
Views
2K
Back
Top