LaTeX on the Web

\(\LaTeX \) is a document markup language that is used at most universities around the world when writing text containing mathematics. The markup language uses \(\TeX \) typesetting for formulas. The \(\TeX \) typesetting system was designed by Donald Knuth in the 1970s.


xkcd - Donald Knuth

When you use \(\LaTeX \), you write code (using any text-editor), the code is then translated to some convenient format like pdf.

One advantage of writing in \(\LaTeX \) instead of using a regular word processor is that once you know how to input the code you can do it really fast; writing is faster than clicking. The disadvantage is that it takes rather long time to get used to writing code. The program is sometimes described as being hostile to the user (for references Google on hate+latex).

It is somewhat difficult to change the layout of the document when using \(\LaTeX \). The appearance that is produced by \(\LaTeX \) is, however, a standard appearance. Regular word processors have the feature WYSIWYG, What You See Is What You Get. Programs like \(\LaTeX \) use the slogan WYSIWYM, What You See Is What You Mean; implying that you should focus on the content and the structure of the document as opposed to focusing on the layout.

Web standard for mathematical formulas

When it comes to web pages, the standard for writing mathematical formulas recommended by World Wide Web Consortium(W3C) is MathML. In reality however, most browsers can not handle MathML.

An example of a MathML formula is shown below. It is not rendered by the browser but by MathJax (more info at the bottom of this page). By right-clicking on the formula you can view the code.

1 1 x 2 d x

Due to the lack of a functional web standard, \(\LaTeX\) has become a de facto standard for writing formulas on the Internet.

When you write mathematical formulas in \(\LaTeX\) to be shown on a web page, you don't write the entire document in \(\LaTeX\), you just use \(\TeX\) notation for the formulas. When writing a document in \(\LaTeX\), you enclose the code for mathematical expressions in $-signs (there are other ways of doing it), this piece of code is in math mode. It is only this part, the math mode, that is used by various web applications. The applications produce images from the code; the expressions are not displayed using fonts, like regular text; for this reason there is still a need of a functional html-standard like MathML.


Wikipedia uses \(\LaTeX\) to render mathematical formulas as images. You write the \(\LaTeX\)-code within math-tags, like this:

<math> LaTeX-code </math>

There is more information at Help:Displaying a formula - Wikipedia, the free encyclopedia. If you want to try editing Wikipedia without actually editing a real Wikipedia article, you can try the sandbox at Wikipedia:Sandbox - Wikipedia, the free encyclopedia.

WordPress blogs

WordPress supports \(\LaTeX\). If you want to write a mathematical expression in a blog, you enter the \(\LaTeX\)-code like this:

$latex LaTeX-code $

Formulas that appear on the same line as other text, so called inline formulas, are displaced. If you write a formula on a separate line, on the other hand, the formula looks good.

You can find documentation about \(\LaTeX\) in blogs at the site LaTeX Support. An example is shown below.


MathJax when writing html-code or using web platforms

Using Javascript, one can generate an image of a formula written i \(\LaTeX\). There are various solutions for doing this, one of the most well known is MathJax. MathJax can also generate images from MathML code, as seen at the top of this page.

In order to use MathJax, you don't have to install anything. You just insert a Javascript-link between the html head-tags, as seen here.

In a similar way, by including the Javascript-link between the html head-tags, you can also use \(\LaTeX\) rendered by MathJax if you use a web platform.

After linking to the MathJax CDN, you insert an inline formula by enclosing it by \( and \), and a displayed formula by enclosing it between \[ and \]. Some examples of MathJax-formulas are shown below.

This is an inline formula \(\int^\infty_1 \frac{1}{x^2}\, dx\), and this is a displayed formula \[\int^\infty_1 \frac{1}{x^2}\, dx\]

You can see the \(\LaTeX \) source by right-clicking on a formula.

By changing the font-size, you can rescale any formula, from very small

\[\LaTeX \]

to huge:

\[\LaTeX \]

further info:

World Wide Web Consortium(W3C)

Donald Knuth's \(\TeX\)

CDN means Content delivery network Wikipedia: Content delivery network

Translate hand-written symbols to \(\TeX \): Detexify - LaTeX symbol classifier

by Malin Christersson under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Sweden License