Greek letters in HTML, XML, TeX, and Unicode

big pi

Greek letters are simple to represent in HTML and TeX. In both systems, the code for a letter is essentially its name. The letter name is capitalized to get the capitalized form. HTML surrounds the letter name with an ampersand and semicolon. TeX prefixes the name with a backslash. For example, in HTML, λ is λ and Λ is Λ. In TeX these are \lambda and \Lambda.

HTML and Unicode distinguish between Roman letters and Greek letters that look similar. For example, the English letter “A” has Unicode value x41, but the Greek letter Alpha has Unicode value x391. TeX, however, only provides symbols for Greek letters that do not look like their English counterparts. TeX also has alternate versions of some Greek letters [1].

See note below about representing Greek letters in XML [2].

 

Capital Greek letters

Letter TeX Entity Unicode
Α Α x391
Β Β x392
Γ \Gamma Γ x393
Δ \Delta Δ x394
Ε Ε x395
Ζ Ζ x396
Η Η x397
Θ \Theta Θ x398
Ι Ι x399
Κ Κ x39A
Λ \Lambda Λ x39B
Μ Μ x39C
Ν Ν x39D
Ξ \Xi Ξ x39E
Ο Ο x39F
Π \Pi Π x3A0
Ρ Ρ x3A1
Σ \Sigma Σ x3A3
Τ Τ x3A4
Υ \Upsilon Υ x3A5
Φ \Phi Φ x3A6
Χ Χ x3A7
Ψ \Psi Ψ x3A8
Ω \Omega Ω x3A9

Note that the Unicode numbers above are consecutive with one exception: there is no Unicode character x3A2 between Ρ and Σ. The reason is given below. [3]

 

Lower-case Greek letters

Letter TeX Entity Unicode
α \alpha α x3B1
β \beta β x3B2
γ \gamma γ x3B3
δ \delta δ x3B4
ε \epsilon ε x3B5
ζ \zeta ζ x3B6
η \eta η x3B7
θ \theta θ x3B8
ι \iota ι x3B9
κ \kappa κ x3BA
λ \lambda λ x3BB
μ \mu μ x3BC
ν \nu ν x3BD
ξ \xi ξ x3BE
ο ο x3BF
π \pi π x3C0
ρ \rho ρ x3C1
ς \varsigma ς x3C2
σ \sigma σ x3C3
τ \tau τ x3C4
υ \upsilon υ x3C5
φ \phi φ x3C6
χ \chi χ x3C7
ψ \psi ψ x3C8
ω \omega ω x3C9

Notes

[1] TeX also has several variations on Greek letters that are commonly used in mathematics: \varepsilon, \vartheta, \varpi, \varrho, and \varphi.

[2] HTML entities are illegal in XML and but legal in XHTML. XML applications require a numeric encoding of Greek letters. (You can simply put Unicode characters directly into your HTML page provided you set your content-type correctly. However, character entities and hexadecimal encodings allow you to represent non-ASCII symbols using only ASCII characters.) You can create an XML numeric encoding from a Unicode character by adding &# on the left and ; on the right, such as Γ for Γ, Unicode value x393.

[3] The Unicode value of a lower-case Greek letter is the value of its upper-case counterpart plus x20. However, there is one complication. Greek has two forms of the lower-case sigma:  ς used only as the final letter of a word and the more familiar σ used everywhere else. That’s why there is no upper-case character x3A2 corresponding to the lower-case x3C2. The letter ς is an exception to the rule that HTML entities and TeX command sequences simply use the name of the Greek letter.

See also Common math symbols in HTML, XML, TeX, and Unicode.