Greek letters in HTML, XML, TeX, and Unicode

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

LetterTeXEntityUnicode
ΑΑ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

LetterTeXEntityUnicode
α\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 hexidecimal 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.