You can enclose LaTeX math code in $...$
for inline math, and $$...$$
resp. for indented equations.
MathJax supports essentially the commands native to $\LaTeX$ as well as those defined by amsmath
and amssymb
(with some exceptions in both directions). For a complete list, see the MathJax reference.
I have found these references to be useful:
Aside from that, my personal hints (and what I edit most):
\mathbb{N}
for the natural numbers; similar for other such sets.
\mathcal{L}
for calligraphic letters, e.g. languages
- If you prefer left-aligned non-inline formulae, use
$\qquad \displaystyle ...$
(in an own paragraph) instead of $$ ... $$
.
\operatorname{name}
for long operator names (non-italic letters and spacing).
\mathrm{name}
or \mathsf{name}
for dedicated names, such as P and NP (non-italic letters).
- Parentheses around big stuff (e.g. fractions) are usually undersized. Use
\left( ... \right)
(similar for [
resp. ]
and {
resp. }
) to have them adapt their size accordingly.
- Use
\to
, \iff
and \implies
instead of \rightarrow
, \Leftrightarrow
and \Rightarrow
where appropriate (i.e. semantically fitting).
- You can define your own macros. They survive across multiple math environments, so take care not to destroy other posts.
- Use
\text{...}
when using English in formulae.
- Use
\dots
instead of ...
.
Be aware that the spoiler tag (!>
) does not support multiple lines -- even inside math formulae! You'll have to write all of your formula in one line when using spoiler tags.
Examples
Let $a,b \in \mathbb{B}$ and $a \leq b$. Then, $a + b \geq b$.
$$\sum\limits_{i=0}^n i = \frac{n(n+1)}{2}$$
$\qquad\displaystyle \sum_{i=1}^n i = \frac{n(n+1)}{2}$
$$ \lim\limits_{n \to \infty} \frac{1}{n} = 0 $$
$ \max_n f(x) = - \min_n (-f(n)) $
$L = \{ \langle M, w \rangle \mid M \text{ is a TM and } M(w) = 1 \}$
Quicksort runs in $O(n\log n)$ time on average, but in $O(n^2)$ time in the worst case.
$$\begin{align*}
a_0 &= 1 \\
a_{n+1} &= 2 \cdot a_n + 3
\end{align*}$$
$$\chi_S(s) = \begin{cases}
1 &, s \in S \\
0 &, s \notin S
\end{cases}$$
$\begin{pmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{pmatrix}$
$\begin{align*}
S &\to (S)S \mid A \mid \varepsilon \\
A &\to aA \mid a
\end{align*}$