-
see how any formula was written in any question or answer, including this one, right-click on the expression it and choose "Show Math As > TeX Commands". (When you do this, the '$' will not display. Make sure you add these. See the next point.)
-
For inline formulas, enclose the formula in
$...$
. For displayed formulas, use$$...$$
.
These render differently. For example, type
$sum_{i=0}^n i^2 = frac{(n^2+n)(2n+1)}{6}$
to show∑ n i=0 i 2 =(n 2 +n)(2n+1)6 ∑i=0ni2=(n2+n)(2n+1)6 (which is inline mode) or type
$$sum_{i=0}^n i^2 = frac{(n^2+n)(2n+1)}{6}$$
to show(which is display mode).∑ i=0 n i 2 =(n 2 +n)(2n+1)6 ∑i=0ni2=(n2+n)(2n+1)6 -
For Greek letters, use
alpha
,eta
, …,omega
:α,β,…ω α,β,…ω. For uppercase, useGamma
,Delta
, …,Omega
:Γ,Δ,…,Ω Γ,Δ,…,Ω. -
For superscripts and subscripts, use
^
and_
. For example,x_i^2
:x 2 i xi2,log_2 x
:log 2 x log2x. -
Groups. Superscripts, subscripts, and other operations apply only to the next “group”. A “group” is either a single symbol, or any formula surrounded by curly braces
{
…}
. If you do10^10
, you will get a surprise:10 1 0 1010. But10^{10}
gives what you probably wanted:10 10 1010. Use curly braces to delimit a formula to which a superscript or subscript applies:x^5^6
is an error;{x^y}^z
isx y z xyz, andx^{y^z}
isx y z xyz. Observe the difference betweenx_i^2
x 2 i xi2 andx_{i^2}
x i 2 xi2. -
Parentheses Ordinary symbols
()[]
make parentheses and brackets(2+3)[4+4] (2+3)[4+4]. Use{
and}
for curly braces{} {}.These do not scale with the formula in between, so if you write
(frac{sqrt x}{y^3})
the parentheses will be too small:(x √ y 3 ) (xy3). Usingleft(
…ight)
will make the sizes adjust automatically to the formula they enclose:left(frac{sqrt x}{y^3} ight)
is(x √ y 3 ) (xy3).left
andight
apply to all the following sorts of parentheses:(
and)
(x) (x),[
and]
[x] [x],{
and}
{x} {x},|
|x| |x|,langle
andangle
⟨x⟩ ⟨x⟩,lceil
andceil
⌈x⌉ ⌈x⌉, andlfloor
andfloor
⌊x⌋ ⌊x⌋. There are also invisible parentheses, denoted by.
:left.frac12 ight brace
is12 } 12}. -
Sums and integrals
sum
andint
; the subscript is the lower limit and the superscript is the upper limit, so for examplesum_1^n
∑ n 1 ∑1n. Don't forget{
…}
if the limits are more than a single symbol. For example,sum_{i=0}^infty i^2
is∑ ∞ i=0 i 2 ∑i=0∞i2. Similarly,prod
∏ ∏,int
∫ ∫,igcup
⋃ ⋃,igcap
⋂ ⋂,iint
∬ ∬. -
Fractions There are two ways to make these.
frac ab
applies to the next two groups, and producesab ab; for more complicated numerators and denominators use{
…}
:frac{a+1}{b+1}
isa+1b+1 a+1b+1. If the numerator and denominator are complicated, you may preferover
, which splits up the group that it is in:{a+1over b+1}
isa+1b+1 a+1b+1. -
Fonts
- Use
mathbb
orBbb
for "blackboard bold":CHNQRZ CHNQRZ. - Use
mathbf
for boldface:ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz. - Use
mathtt
for "typewriter" font:ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz. - Use
mathrm
for roman font:ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz. - Use
mathsf
for sans-serif font:ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz. - Use
mathcal
for "calligraphic" letters:ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ - Use
mathscr
for script letters:ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ - Use
mathfrak
for "Fraktur" (old German style) letters:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.
- Use
-
Radical signs Use
sqrt
, which adjusts to the size of its argument:sqrt{x^3}
x 3 − − √ x3;sqrt[3]{frac xy}
xy √ 3 xy3. For complicated expressions, consider using{...}^{1/2}
instead. -
Some special functions such as "lim", "sin", "max", "ln", and so on are normally set in roman font instead of italic font. Use
lim
,sin
, etc. to make these:sin x
sinx sinx, notsin x
sinx sinx. Use subscripts to attach a notation tolim
:lim_{x o 0}
lim x→0 limx→0 -
There are a very large number of special symbols and notations, too many to list here; see this shorter listing, or this exhaustive listing. Some of the most common include:
lt gt le ge eq
<>≤≥≠ <>≤≥≠. You can useot
to put a slash through almost anything:otlt
≮ ≮ but it often looks bad.imes div pm mp
×÷±∓ ×÷±∓.cdot
is a centered dot:x⋅y x⋅ycup cap setminus subset subseteq subsetneq supset in otin emptyset varnothing
∪∩∖⊂⊆⊊⊃∈∉∅∅ ∪∩∖⊂⊆⊊⊃∈∉∅∅{n+1 choose 2k}
orinom{n+1}{2k}
(n+12k) (n+12k)o ightarrow leftarrow Rightarrow Leftarrow mapsto
→→←⇒⇐↦ →→←⇒⇐↦land lor lnot forall exists op ot vdash vDash
∧∨¬∀∃⊤⊥⊢⊨ ∧∨¬∀∃⊤⊥⊢⊨star ast oplus circ ullet
⋆∗⊕∘∙ ⋆∗⊕∘∙approx sim simeq cong equiv prec
≈∼≃≅≡≺ ≈∼≃≅≡≺.infty aleph_0
∞ℵ 0 ∞ℵ0abla partial
∇∂ ∇∂Im Re
IR ℑℜ- For modular equivalence, use
pmod
like this:aequiv bpmod n
a≡b(modn) a≡b(modn). ldots
is the dots ina 1 ,a 2 ,…,a n a1,a2,…,ancdots
is the dots ina 1 +a 2 +⋯+a n a1+a2+⋯+an- Some Greek letters have variant forms:
epsilon varepsilon
ϵε ϵε,phi varphi
ϕφ ϕφ, and others. Script lowercase l isell
ℓ ℓ.
Detexify lets you draw a symbol on a web page and then lists the
TE X TEX symbols that seem to resemble it. These are not guaranteed to work in MathJax but are a good place to start. To check that a command is supported, note that MathJax.org maintains a list of currently supportedLA TE X LATEX commands, and one can also check Dr. Carol JVF Burns's page ofTE X TEX Commands Available in MathJax. -
Spaces MathJax usually decides for itself how to space formulas, using a complex set of rules. Putting extra literal spaces into formulas will not change the amount of space MathJax puts in:
a␣b
anda␣␣␣␣b
are bothab ab. To add more space, use\,
for a thin spaceab ab;;
for a wider spaceab ab.quad
andqquad
are large spaces:ab ab,ab ab.To set plain text, use
ext{…}
:{x∈s∣x is extra large} {x∈s∣x is extra large}. You can nest$…$
inside ofext{…}
. -
Accents and diacritical marks Use
hat
for a single symbolx ^ x^,widehat
for a larger formulaxy ˆ xy^. If you make it too wide, it will look silly. Similarly, there arear
x ¯ x¯ andoverline
xyz ¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯ xyz¯, andvec
x ⃗ x→ andoverrightarrow
xy − → xy→ andoverleftrightarrow
xy ← → xy↔. For dots, as inddx xx ˙ =x ˙ 2 +xx ¨ ddxxx˙=x˙2+xx¨, usedot
andddot
. -
Special characters used for MathJax interpreting can be escaped using the
character:
$
$ $,{
{ {,\_
_ _, etc. If you wantitself, you should use
ackslash
∖ ∖, because\
is for a new line.
(Tutorial ends here.)