Essential Mathematical L^{A}TEX 2ε

D. P. Carlisle  Richard Kaye

12th August 1998

1 Introduction

This document is a supplement to “Essential L^{A}TEX 2ε”, describing basic mathematical typesetting in L^{A}TEX 2ε. It makes no attempt at completeness so if in doubt read the manual.

2 Math, Display-math and Equation

Mathematics is treated by L^{A}TEX completely differently from ordinary text. There are two special modes for mathematics, math mode and display math mode.

Math mode commands are surrounded by \( and \).

Some mathematics set inline 2 × 3 = 6. Note that spaces in the input file are ignored in math mode.

                                             ... set inline \( 2\times 3 =   6 \).
                                             Note that spaces ...

Display math mode commands are surrounded by \[ and \].

A larger equation to be displayed on a line by itself.

f(x) = ∑_{i=0}^{∞} \frac{f^{(i)}(x)}{i!}

                                             ... to be displayed on a line by itself.
                                             \[ f(x) =
                                              \sum_{i=0}^{\infty}\frac{f^{(i)}(x)}{i!} \]

There is a variant of Display math mode, the equation environment which automatically generates an equation number.

( \begin{matrix}1 & 2 \\ 0 & 1 \end{matrix} ) ( \begin{matrix}2 & 0 \\ 1 & 3 \end{matrix} ) = ( \begin{matrix}4 & 6 \\ 1 & 3 \end{matrix} ) (1)

                                             \begin{equation}
                                             \left(\begin{array}{cc}
                                             1 & 2 \\0 & 1
                                             \end{array}\right)
                                             \left(\begin{array}{cc}
                                             2 & 0\\1 & 3
                                             \end{array}\right)
                                             =
                                             \left(\begin{array}{cc}
                                             4 & 6 \\1 & 3
                                             \end{array}\right)
                                             \end{equation}

The short examples above show the main types of commands available in math mode.

1. Subscripts and superscripts are produced with _and ^, as in x_{1} = p^{2} x_{1} = p^{2}.

2. Fractions are produced by the \frac command. \(\frac{a + b}{c}\) \frac{a+b}{c}.

3. Various commands give names to mathematical symbols.

      \infty \Rightarrow \surd \bigotimes ∞ ⇒ √ ⨂

4. Arrays are produced by the array environment. This is identical to the tabular environment described in essential L^{A}TEX except that the entries are typeset in math mode instead of LR mode. Note that the array environment does not put brackets arround the array so it can also be used for setting determinants, or even sets of equations in which you want the columns to line up.

5. The commands \left and \right produce delimiters which grow as large as needed, they can be used with a variety of symbols, e.g., \left(, \left\{, \left|. The full set of these delimiters is shown in Table 9 below. There are some things to note:

(a) \left and \right must come in matching pairs, otherwise L^{A}TEX won’t know what formula the delimiter must be adjusted to fit round;

(b) you must remember to put a delimiter after \left and \right;

(c) the delimiters themselves needn’t be matched, so \( \left( ... \right] \) is OK;

(d) if you really don’t want any delimiter on one side, use ‘.’ in place of a delimiter, as in \( \left\{ ... \right. \) (which is often used for definitions by cases).

3 Spacing

All spaces in the input file are ignored in math mode. Sometimes you may want to adjust the spacing. Use one of the following commands or an explicit

\hspace.

\, thin space  \: medium space
\! negative thin space \; thick space

A good example of where L^{A}TEX needs some help with spacing is

∫∫ z dxdy instead of ∫ ∫ zdxdy  \int\!\!\int z\, dx dy .. \int\int z dx dy.

4 Changing fonts in math mode

The default math mode font is math italic. This should not be confused with ordinary text italic. The letters are a slightly different shape, and the spacing between them is quite different. The font for ‘ordinary’ letters can be changed

with the commands, \mathbf, \mathrm, \mathit, \mathsf, and \mathnormal.

These commands take a single argument—the letters that should be bold or roman or whatever. Note that lower case Greek letters are just regarded as mathematical symbols, \alpha etc, and are not affected by these commands.

\bf produces bold face roman letters. If you wish to have bold face math italic letters, and bold face Greek letters and mathematical symbols, use the \boldmath command before going into math mode. This changes the default math fonts to bold.

x = 2π ⇒ x ≃ 6.28 x = 2π ⇒ x ≃ 6.28 x = 2π ⇒ x ≃ 6.28

                                             \( x = 2\pi \Rightarrow x \simeq 6.28 \)
                                             \(\mathbf{ x = 2\pi \Rightarrow x \simeq 6.28 } \)
                                             \boldmath
                                             \( x = 2\pi \Rightarrow x \simeq 6.28 \)

There is also a calligraphic font for upper case letters produced by the

\mathcal command.

FG  \( \mathcal{F}\mathcal{G} \)

AMS-L^{A}TEX provides more commands for bold-face mathematics, so that bold math italic and ordinary math fonts can be mixed in the same formula without using \boldmath, and it also adds ‘blackboard bold’ characters (\mathbb), ℕℤℚℝℂ, ‘script’, and ‘fraktur’ fonts (\mathfrak). 𝔄𝔅ℭ𝔇𝔈𝔉𝔊. (RK adds: I’m not very fond of the AMS’s script font though. I much prefer the oldfashioned copper-plate letters which are available in the ‘mathrsfs’ package, and which gives—using the \mathscr command—𝒜 ℬ𝒞 𝒟ℰ ℱ 𝒢 .)

5 Symbols

The tables show most of the symbols available from the standard L^{A}TEX symbol fonts. Negations of the relational symbols can be made with the \not command.

G ≢ H  G \not\equiv H

A very common mistake is to ignore the difference between the various ‘kinds’ of symbols. If you check the tables, you’ll notice that some symbols are available in different ways. The difference is the spacing on either side of the symbol. For example to get a colon in math mode, you type : or \colon. The second is a puctuation symbol, the first is a relation symbol. Here are examples of their proper use.

f: A → B {x : x ∉ x}

                                             \( f\colon A\to B \)
                                             \( \{ x : x \not\in x \} \)

The standard L^{A}TEX fonts have enough symbols for most people, see Tables 1– 13. If you need more you could try the AMS-TEX extra symbol fonts, most easily obtained by loading amssymb using the \usepackage command. See Tables 14 to 17. Much more control over mathematical typesetting is available as a series of AMS-L^{A}TEX packages you can also load.

6 What about $’s?

If you have converted to L^{A}TEX from plain or AMS-TEX, you will probably be wondering why there has been no mention of $ and $$.

In these systems math mode is surrounded by $’s and display math mode is surrounded by $$. This has certain drawbacks over the L^{A}TEX system as it is difficult for your text editor to match $’s as it is hard to tell which ones are starting math mode and which are ending it. TEX will also get confused if you miss a $ out.

The (incorrect) input

let (a,b,c)$ be a Pythagorean triple, i.e.\ three
integers such that $a^{2}+b^{2}=c^{2}$.

produces the slightly mysterious error message

! Missing $ inserted.
<inserted text>
$
<to be read again>
   ^
l.56 ...triple, i.e.\ three integers such that $a^
  {2}+b^{2}=c^{2}$
?

Note that it reports the wrong error and in the wrong place, the use of the ^command out of math mode. TEX has typeset ‘be a … such that’ in math mode and exited math mode at the $ after ‘such that’. If you had made the equivalent L^{A}TEX error, L^{A}TEX has a better idea of what you indended:

let (a,b,c)\) be a Pythagorean triple, i.e.\ three
integers such that \(a^{2}+b^{2}=c^{2}\)

The error message may still be unintelligable, but at least it reports the error in the right place, you have used \) to end math mode when you were not in math mode (as you omitted the \( which should have been before the (a,b,c)).

LaTeX error.  See LaTeX manual for explanation.
      Type  H <return>  for immediate help.
! Bad math environment delimiter.
\@latexerr ...for immediate help.}\errmessage {#1}
\)...ifinner $\else \@badmath \fi \else \@badmath
  \fi
l.56 let (a,b,c)\)
   be a Pythagorean triple, i.e.\ three integers such that \...
?

The single dollar is sometimes useful for small sections of math.

Let G be a p-group  Let $G$ be a $p$-group

The double dollar is not always equivalent to \[ ... \], and so should not be used if you want your L^{A}TEX file to be compatible with different styles and style options (try the fleqn style option).

α \alpha  θ \theta  o o  τ \tau
β \beta  ϑ \vartheta π \pi  υ \upsilon
γ \gamma  γ \gamma  ϖ \varpi  ϕ \phi
δ \delta  κ \kappa  ρ \rho  φ \varphi
ϵ \epsilon  λ \lambda  ϱ \varrho  χ \chi
ε \varepsilon μ \mu  σ \sigma  ψ \psi
ζ \zeta  ν \nu  ς \varsigma ω \omega
η \eta  ξ \xi
Γ \Gamma  Λ \Lambda  Σ \Sigma  Ψ \Psi
Δ \Delta  Ξ \Xi  Υ \Upsilon Ω \Omega
Θ \Theta  Π \Pi  Φ \Phi

Table 1: Greek Letters

± \pm  ∩ \cap  ⋄ \diamond  ⊕ \oplus
∓ \mp  ∪ \cup  △ \bigtriangleup  ⊖ \ominus
× \times ⊎ \uplus  ▽ \bigtriangledown ⊗ \otimes
÷ \div  ⊓ \sqcap  ◁ \triangleleft  ⊘ \oslash
∗ \ast  ⊔ \sqcup  ▷ \triangleright  ⊙ \odot
⋆ \star  ∨ \vee  ◯ \bigcirc  ⨿ \amalg
∘ \circ  ∧ \wedge  † \dagger  ≀ \wr
• \bullet \ \setminus ‡ \ddagger  · \cdot
+ +  − -

Table 2: Binary Operation Symbols

≤ \leq  ≥ \geq  ≡ \equiv ⊧ \models
≺ \prec  ≻ \succ  ∼ \sim  ⊥ \perp
⪯ \preceq  ⪰ \succeq  ≃ \simeq | \mid
≪ \ll  ≫ \gg  ≍ \asymp ∥ \parallel
⊂ \subset  ⊃ \supset  ≈ \approx ▷◁ \bowtie
⊆ \subseteq  ⊇ \supseteq    ≅ \cong  ∝ \propto
≠ \neq  ⌣ \smile  ⊢ \vdash ⊣ \dashv
⊑ \sqsubseteq ⊒ \sqsupseteq  ≐ \doteq ⌢ \frown
∈ \in  ∋ \ni  = =  > >

< <  : :

Table 3: Relation Symbols

   , ,  ; ;  : \colon . \ldotp · \cdotp

Table 4: Punctuation Symbols

← \leftarrow  ⟵ \longleftarrow  ↑ \uparrow
⇐ \Leftarrow  ⟸ \Longleftarrow  ⇑ \Uparrow
→ \rightarrow  ⟶ \longrightarrow  ↓ \downarrow
⇒ \Rightarrow  ⟹ \Longrightarrow  ⇓ \Downarrow
↔ \leftrightarrow ⟷ \longleftrightarrow ↕ \updownarrow
⇔ \Leftrightarrow ⟺ \Longleftrightarrow ⇕ \Updownarrow
↦ \mapsto  ⟼ \longmapsto  ↗ \nearrow
↩ \hookleftarrow  ↪ \hookrightarrow  ↘ \searrow
↼ \leftharpoonup  ⇀  \rightharpoonup  ↙ \swarrow
↽ \leftharpoondown ⇁  \rightharpoondown  ↖ \nwarrow

Table 5: Arrow Symbols

 . . . \ldots · · · \cdots     ⋮ \vdots  ... \ddots
 ℵ \aleph ′  \prime  ∀ \forall  ∞ \infty
 ℏ \hbar ∅ \emptyset ∃ \exists  ♠ \spadesuit
 ı  \imath ∇ \nabla  ¬ \neg  ♡ \heartsuit
 ȷ \jmath √ \surd  ♭ \flat  ♢ \diamondsuit
 ℓ \ell  ⊤ \top  ♮ \natural  ♣ \clubsuit
 ℘ \wp  ⊥ \bot  ♯ \sharp  ∂ \partial
 ℜ \Re  ∥ \|  \ \backslash △ \triangle
 ℑ \Im  ∠ \angle  . .  |  |

Table 6: Miscellaneous Symbols

          ∑ \sum  ⋂ \bigcap  ⨀ \bigodot
          ∏ \prod  ⋃ \bigcup  ⨂ \bigotimes
          ∐ \coprod ⨆ \bigsqcup ⨁ \bigoplus
          ∫ \int  ⋁ \bigvee  ⨄ \biguplus
          ∮ \oint  ⋀ \bigwedge

Table 7: Variable-sized Symbols

  \arccos  \cos   \csc  \exp  \ker     \limsup  \min  \sinh
  \arcsin  \cosh  \deg  \gcd  \lg      \ln      \Pr   \sup
  \arctan  \cot   \det  \hom  \lim     \log     \sec  \tan
  \arg     \coth  \dim  \inf  \liminf  \max     \sin  \tanh

Table 8: Log-like Symbols

   ( (  ) )  ↑ \uparrow  ⇑ \Uparrow
   [ [  ] ]  ↓ \downarrow  ⇓ \Downarrow
   { \{  } \}  ↕ \updownarrow ⇕ \Updownarrow
   ⌊ \lfloor ⌋ \rfloor ⌈ \lceil  ⌉ \rceil
   ⟨ \langle ⟩ \rangle / /  \ \backslash
   | |  ∥ \|

Table 9: Delimiters

} \rmoustache  { \lmoustache  } \rgroup     { \lgroup
| \arrowvert   ‖ \Arrowvert   | \bracevert

Table 10: Large Delimiters

â \hat{a}    á \acute{a}  ā \bar{a}  ȧ \dot{a}   ă \breve{a}
ǎ \check{a}  à \grave{a}  a⃗ \vec{a}  ä \ddot{a}  ã \tilde{a}

Table 11: Math mode accents

ãbc  \widetilde{abc}      âbc  \widehat{abc}
\overleftarrow{abc}  \overleftarrow\{abc\}  \overrightarrow{abc}  \overrightarrow\{abc\}
\overline{abc}  \overline\{abc\}       \underline{abc}  \underline\{abc\}
\overbrace{abc} \overbrace\{abc\}      \underbrace{abc} \underbrace\{abc\}
\sqrt{abc} \sqrt\{abc\}            \sqrt[n]{abc} \sqrt[n]\{abc\}
f′  f'                    \frac{abc}{xyz}  \frac\{abc\}\{xyz\}

Table 12: Some other constructions

         ℧ \mho  ⋈ \Join
         □ \Box  ◇ \Diamond
         ⊏ \sqsubset ⊐ \sqsupset
         ⊲ \lhd  ⊳ \rhd
         ⊴ \unlhd  ⊵ \unrhd
         ⇝ \leadsto

Table 13: Further symbols available with the latexsym package

⊡ \boxdot  ⊞ \boxplus
⊠ \boxtimes  □ \square
■ \blacksquare  ▪  \centerdot
♢ \lozenge  ♦ \blacklozenge
⟳ \circlearrowright ⟲ \circlearrowleft
⇌ \rightleftharpoons ⇋ \leftrightharpoons
⊟ \boxminus  ⊩ \Vdash
⊪ \Vvdash  ⊨ \vDash
↠ \twoheadrightarrow ↞ \twoheadleftarrow
⇇ \leftleftarrows  ⇉ \rightrightarrows
⇈ \upuparrows  ⇊ \downdownarrows
↾ \upharpoonright  ⇂ \downharpoonright
↿ \upharpoonleft  ⇃ \downharpoonleft
↣ \rightarrowtail  ↢ \leftarrowtail
⇆ \leftrightarrows  ⇄ \rightleftarrows
↰ \Lsh  ↱ \Rsh

Table 14: Some AMS symbols

⇝ \rightsquigarrow  ↭ \leftrightsquigarrow
↫ \looparrowleft  ↬ \looparrowright
≗ \circeq  ≿ \succsim
≳ \gtrsim  ⪆ \gtrapprox
⊸ \multimap  ∴ \therefore
∵ \because  ≑ \doteqdot
≜ \triangleq  ≾ \precsim
≲ \lesssim  ⪅ \lessapprox
⪕ \eqslantless  ⪖ \eqslantgtr
⋞ \curlyeqprec  ⋟ \curlyeqsucc
≼ \preccurlyeq  ≦ \leqq
⩽ \leqslant  ≶ \lessgtr
‵  \backprime  ≓ \risingdotseq
≒ \fallingdotseq  ≽ \succcurlyeq
≧ \geqq  ⩾ \geqslant
≷ \gtrless  ⊏ \sqsubset
⊐ \sqsupset  ▷ \vartriangleright
◁ \vartriangleleft  ⊵ \trianglerighteq
⊴ \trianglelefteq  ⋆ \bigstar
≬  \between  ▼ \blacktriangledown
▶ \blacktriangleright ◀ \blacktriangleleft
△ \vartriangle  ▲ \blacktriangle
▽ \triangledown  ≖ \eqcirc
⋚ \lesseqgtr  ⋛ \gtreqless
⪋ \lesseqqgtr  ⪌ \gtreqqless
⇛ \Rrightarrow  ⇚ \Lleftarrow
⊻ \veebar  ⊼ \barwedge
⩞ \doublebarwedge  ∠ \angle
∡ \measuredangle  ∢ \sphericalangle
∝ \varpropto  ⌣ \smallsmile
⌢ \smallfrown  ⋐ \Subset
⋑ \Supset  ⋓ \Cup
⋒ \Cap  ⋏ \curlywedge
⋎ \curlyvee  ⋋ \leftthreetimes
⋌ \rightthreetimes  ⫅ \subseteqq
⫆ \supseteqq  ≏ \bumpeq
≎ \Bumpeq  ≪ \lll
≫ \ggg  Ⓢ \circledS
⋔ \pitchfork  ∔ \dotplus
∽ \backsim  ⋍ \backsimeq
∁  \complement  ⊺  \intercal
⊚ \circledcirc  ⊛ \circledast
⊝ \circleddash  ⌜  \ulcorner
⌝  \urcorner  ⌞  \llcorner
⌟  \lrcorner  ¥ \yen
✓ \checkmark  ® \circledR
✠ \maltese  ≨ \lvertneqq
≩ \gvertneqq  ≰ \nleq

Table 15: More AMS symbols

≱ \ngeq  ≮ \nless
≯ \ngtr  ⊀ \nprec
⊁ \nsucc  ≨ \lneqq
≩ \gneqq  ⩽̸ \nleqslant
⩾̸ \ngeqslant  ⪇ \lneq
⪈ \gneq  ⪯̸ \npreceq
⪰̸ \nsucceq  ⋨ \precnsim
⋩ \succnsim  ⋦ \lnsim
⋧ \gnsim  ≦̸ \nleqq
≧̸ \ngeqq  ⪵ \precneqq
⪶ \succneqq  ⪹ \precnapprox
⪺ \succnapprox  ⪉ \lnapprox
⪊ \gnapprox  ≁ \nsim
≇ \ncong  ⊊ \varsubsetneq
⊋ \varsupsetneq  ⫅̸ \nsubseteqq
⫆̸ \nsupseteqq  ⫋ \subsetneqq
⫌ \supsetneqq  ⫋ \varsubsetneqq
⫌ \varsupsetneqq  ⊊ \subsetneq
⊋ \supsetneq  ⊈ \nsubseteq
⊉ \nsupseteq  ∦ \nparallel
∤ \nmid  ∤ \nshortmid
∦ \nshortparallel ⊬ \nvdash
⊮ \nVdash  ⊭ \nvDash
⊯ \nVDash  ⋭ \ntrianglerighteq
⋬ \ntrianglelefteq ⋪ \ntriangleleft
⋫ \ntriangleright ↚ \nleftarrow
↛ \nrightarrow  ⇍ \nLeftarrow
⇏ \nRightarrow  ⇎ \nLeftrightarrow
↮ \nleftrightarrow ⋇ \divideontimes
∅ \varnothing  ∄ \nexists
℧ \mho
ℶ \beth  ℷ \gimel
ℸ \daleth  ⋖ \lessdot
⋗ \gtrdot  ⋉ \ltimes
⋊ \rtimes  ∣ \shortmid
∥ \shortparallel  ∖ \smallsetminus
∼ \thicksim  ≈ \thickapprox
≊ \approxeq  ≿ \succapprox
≾ \precapprox  ↶ \curvearrowleft
↷ \curvearrowright 𝟋 \digamma
κ \varkappa  ℏ \hslash
ℏ \hbar  ϶ \backepsilon

Table 16: Even more AMS symbols

𝔸 𝔹 ℂ 𝔻 𝔼 𝔽  \mathbb A \mathbb B ...
𝔄 𝔅 ℭ 𝔇 𝔈 𝔉  \mathfrak A \mathfrak B ...
𝒜 ℬ 𝒞 𝒟 ℰ ℱ  \mathscr A \mathscr B ...

Table 17: Other symbol fonts available with amssymb and mathrsfs