##Getting started
On earthscience.SE, we use MathJax to format our math. MathJax is a tool that lets us display LaTeX math on a browser.
To use mathjax, enclose your math within single($...$) or double($$...$$) dollars. Single dollars make the math inline, for example, Let $x$ be a variable gives:
Let $x$ be a variable.
On the other hand, double dollars make the math a block element. It gets its own line, and is slightly larger. For example, The Navier-Stokes equation of motion in a rotating reference frame is: $$\dfrac{\partial\mathbf u}{\partial t} = - \mathbf u \cdot \nabla \mathbf u -\dfrac{1}{\rho}\nabla p-2 \mathbf \Omega \times \mathbf u + \mathbf g + \mathbf F$$ gives:
The Navier-Stokes equation of motion in a rotating reference frame is: $$\dfrac{\partial\mathbf u}{\partial t} = - \mathbf u \cdot \nabla \mathbf u -\dfrac{1}{\rho}\nabla p-2 \mathbf \Omega \times \mathbf u + \mathbf g + \mathbf F$$
Note that extra spaces in LaTeX do not render. Use \: or ~ for a space.
Basic chem
We use the mhchem $\LaTeX$ package for chemistry. It lets us easily format chemical names/reactions without typing too much.
There really is only one command you need to know here: \ce{...}. \ce{...} takes its parameters and automagically formats it. For example,
$\ce{HCl}$ dissociates in water as follows: $$\ce{H2O + HCl<=>H3O+ + Cl-}$$ Renders as
$\ce{HCl}$ dissociates in water as follows: $$\ce{H2O + HCl<=>H3O+ + Cl-}$$
Note that spaces are very important for mhchem to separate super/subscripts from normal text. \ce{H3O+} will display $\ce{H3O+}$, but \ce{H2O +} will display $\ce{H2O +}$. Various types of reaction arrows are supported, including ->, <=>, <==>>, etc.
It also supports various types of bonds, via the \bond{..} command (to be called inside \ce{...}). You need not call \bond for normal bonds.
Eg: \ce{H\bond{->}A-B=C#D\bond{~}E\bond{~-}F\bond{...}G\bond{<-}E} displays:
$$\ce{H\bond{->}A-B=C#D\bond{~}E\bond{~-}F\bond{...}G\bond{<-}E}$$
Full documentation of mhchem here
Basic math
###Superscripts and subscripts
You can denote superscripts via the ^ character, and subscripts via _. For example, x^2 renders as $x^2$, x_1 renders as $x_1$, and x_1^3 renders as $x_1^3$.
If you want to include more than one character in the super/sub script, enclose it in curly braces ({...}).
For example, x^10 renders as $x^10$, but x^{10} renders as $x^{10}$
###Fractions and square roots
Fractions can be easily displayed using \frac{..}{..}. For example, \frac{a+b^c}{de+f} renders as $\frac{a+b^c}{de+f}$
Protip: You can exclude the braces for single-character numerators/denominators (if the first character is a letter, you need to use a space after \frac, though). For example \frac12 renders as $\frac12$, and \frac ab renders as $\frac ab$
Square roots can be added in a similar manner, via \sqrt{....}. For example, \sqrt{x+y} renders as $\sqrt{x+y}$.
###Greek letters Greek letters can be added usung a backslash (''), followed by the name of the letter. Captialise the first letter of the name for greek capital letters.
Eg \alpha \beta \gamma \Omega renders as $\alpha \beta \gamma \Omega$.
Make sure that you put spaces after these if you are typing normal alphabet characters. Eg e^{\pii} gives an error, you need to use e^{\pi i}.
Note that there are special commands \varepsilon , \varsigma , \varrho , and \varpi to distinguish between the lunate Greek letters.
Further reading
- Wikipedia TeX help page (extremely useful as a reference, useless as a tutorial)
- TeX/LaTeX Stack Exchange site
- Harvard intro to TeX
- LaTeX wikibook, Math section
- LaTeX wikibook, Advanced Math section
This post based upon this post, a CW primarily by ManishEarth on chemistry.SE