Posted: Feb 15, 2012 9:38 pm
by Pulsar
This thread is meant as a small Latex manual to help the Equations thread and its discussion. In its current form the MathJax editor doesn't allow every standard Latex command, so I will also explore some workarounds and tricks.
To view any source code, right-click on the formula. Make sure that Settings, Math Renderer is set to HTML-CSS.


Font styles
Latex's default font in mathematical equations is a form of italics. But different styles are available; for instance, if you want a normal upright character a, type \mathrm{a} (rm stands for Roman). The most common styles are the following:


Note that you need the command \boldsymbol{} to type a bold math symbol; \mathbf{} renders a bold upright character. If you want to include normal text inside an equation, use the \text{} command. Unfortunately, MathJax doesn't seem to like Latex commands inside the \text{} environment.


There are various commands for horizontal spaces: a backslash follow by a blank space, \ , inserts a normal space. For smaller spaces, use one of these \, \; \: For larger, there is \quad and \qquad . For a space of any length, there's the \hspace{} command: just insert a unit between the brackets.
For instance, \hspace{1cm} will render a 1cm space. Other units are available as well, such as mm, in (inch), or pt (point).

There is also a command for a tiny negative space, to place two characters closer together: \!
And the \phantom{} commands provides a neat trick to insert a space with the length of the characters inside the brackets.

In standard Latex, a vertical line-break can be inserted by two backslashes: \\, and a line space of any length can be achieved by e.g. \\[1cm]. Unfortunately, MathJax is more limited: I only managed to get \\ to work inside a \begin{align}\end{align} environment (see below). In standard Latex, there's also the \vspace{} command, but that doesn't seem to work either. Here are a few examples:



Here are a few common accents and over- and underlines:


Sub- and superscript

To add a subscript to a character, use an underscore _, or _{} if you want to add more than one subscript character. For superscript, use ^ or ^{}. If you want a standalone sub- or superscript (i.e. not preceded by a normal character), you have to precede _ or ^ by empty brackets; see the example for a hypergeometric function.


Note the \circ for degrees. It's also common practice to use upright text for units, like km and s in the last example.

To be continued...