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
Click For Summary
SUMMARY

This discussion focuses on improving the alignment of math symbols with text on Google Sites using MathJax. Users can enable MathJax by adding specific configuration scripts to their pages, allowing LaTeX code to be rendered correctly. The provided script includes settings for inline and display math, ensuring proper formatting. However, users face limitations with Google Sites not recognizing JavaScript, which complicates the implementation of MathJax.

PREREQUISITES
  • Basic understanding of HTML and web page structure
  • Familiarity with LaTeX syntax for mathematical expressions
  • Knowledge of MathJax configuration and usage
  • Awareness of Google Sites limitations regarding JavaScript
NEXT STEPS
  • Research how to implement MathJax in Google Sites effectively
  • Explore alternative methods for rendering LaTeX on web pages
  • Learn about HTML Box limitations in Google Sites
  • Investigate user-friendly LaTeX rendering tools available online
USEFUL FOR

This discussion is beneficial for educators, scientists, and web developers looking to integrate mathematical notation into Google Sites effectively, particularly those who are new to HTML and LaTeX.

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 ·
Replies
1
Views
2K
  • · Replies 15 ·
Replies
15
Views
25K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
3
Views
4K