Posted:

**Jun 27, 2015 7:08 pm**Muhuhuhuhahahahahaaaaaaaaa! I saw some of the frustration on threads asking for the math tag back. So I used Thwoth's excellent suggestion and circumvented the problem, at least as far as this part of Pulsar's Latex Tutorial goes.

Pulsar wrote: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.

- Code: Select all
`[latex]\textbf{A }\mathbf{\LaTeX\ }\textbf{Tutorial, part 1}[/latex]`

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:

- Code: Select all
`[latex]\begin{align}`

\text{(default)}\hspace{1cm} & ABCDEFGHIJKLMNOPQRSTUVWXYZ\\

& abcdefghijklmnopqrstuvwxyz\\

\backslash\text{mathrm}\hspace{1cm} & \mathrm{ABCDEFGHIJKLMNOPQRSTUVWXYZ}\\

& \mathrm{abcdefghijklmnopqrstuvwxyz}\\

\backslash\text{mathbf}\hspace{1cm} & \mathbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ}\\

& \mathbf{abcdefghijklmnopqrstuvwxyz}\\

\backslash\text{mathcal}\hspace{1cm} & \mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ}\\

\backslash\text{mathtt}\hspace{1cm} & \mathtt{ABCDEFGHIJKLMNOPQRSTUVWXYZ}\\

& \mathtt{abcdefghijklmnopqrstuvwxyz}\\

\backslash\text{mathbb}\hspace{1cm} & \mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}\\

\backslash\text{boldsymbol}\hspace{1cm} & \boldsymbol{ABCDEFGHIJKLMNOPQRSTUVWXYZ}\\

& \boldsymbol{abcdefghijklmnopqrstuvwxyz}

\end{align}[/latex]

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.

Spaces

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:

- Code: Select all
`[latex]\begin{align}`

&ab \quad a\,b \quad a\;b \quad a\: b \quad a\ b \qquad a\!b \\

&a\hspace{34pt}b \qquad c\phantom{abc} d

\end{align}[/latex]

Accents

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

- Code: Select all
`[latex]a' \quad a'' \quad \dot{a} \quad \ddot{a} \quad \dddot{a} \quad \vec{a} \quad \hat{a} \quad \tilde{a}`

\quad \widetilde{a} \quad \bar{a} \quad \overline{a} \quad \underline{a} \quad \overbrace{a} \quad \underbrace{a}[/latex]

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.

- Code: Select all
`[latex]a_i \quad a_{ij} \quad M_\text{tot} \quad a^2 \quad a^{-3/2} \quad {}_2 F_1 \qquad {} 15^\circ 02'15''`

\qquad 2\times 10^{15}\;\text{km}\,\text{s}^{-2}[/latex]

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...