HowTos:Add TeX to your webpage

From CompudocWiki
Jump to navigation Jump to search

This HowTo provides basic instructions on how to add TeX based formulas to your webpages located on the math webserver by using MathJax.

Introduction

The main math webserver as well as the cgi webserver have the MathJax package installed on them and you can very easily use it to add TeX based formulas/text to your webpages hosted on math webservers.

MathJax is a javascript based software that can interpret TeX/LaTeX formulas embedded in your webpage and replace them with fonts and images to make them look as close as possible to the TeX/LaTeX output. You can find extensive information about MathJax on MathJax homepage. Here we will just suggest a few quick ways to use it, for more extensive information check jsMath website.

Quick Start

To get started insert the following html code somewhere in the <head> section of your webpage:

 <SCRIPT SRC="/mathjax/MathJax.js">
   MathJax.Hub.Config({
     extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js"],
     jax: ["input/TeX","output/HTML-CSS"],
     tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]],  processEscapes: true}
   });
 </SCRIPT>

This code will make sure MathJax is loaded if and only if you use LaTeX style formulas somewhere in the body of your document. That means that the following text:

               \( f(\alpha) = x+\beta \)

will get translated into inline formula as in: \( f(\alpha)=x+\beta \) - note how there is a small delay before the text gets converted into formulas. For displayed equations you can do:

               \[ \int_alpha^\beta x = \mathbb{A} \]

which gets translated like this: \[ \int_\alpha^\beta x = \mathbb{A} \]

More Information

To see more information on how to tweak and use MathJax please refer to their website, in particular the configuration webpage.