Skip to main content

Module superscript

Module superscript 

Source
Expand description

The Unicode superscript and subscript forms of characters, the only table of these forms in the library: the text backend prints a superscript or a subscript span with them, and the numbering feature’s number formats #{unicodesuperscript} and #{unicodesubscript} write their digits with them.

Plain text has no raised or lowered characters of its own, but Unicode encodes a raised and a lowered form of some characters: the ten digits, five signs, and a number of letters, most of them taken from phonetic notation. superscript_form and subscript_form return that form for one character, and None for a character that has none. The text emitter writes a character that has no form unchanged, beside its converted neighbors: 10a in a superscript span is ¹⁰ᵃ, while q stays q, since this table holds no superscript q.

A program that chooses the number template of a counter style whose numbers the text output shows raised (for instance a footnote’s mark numbered with #{alph}) can check here which of the characters that template writes have a superscript form.

§The superscript forms

Each row pairs the characters of its first column, in order, with the forms of its second column.

charactersforms
digits: 0123456789⁰¹²³⁴⁵⁶⁷⁸⁹
signs: +-=()⁺⁻⁼⁽⁾
lowercase letters: abcdefghijklmnoprstuvwxyzᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖʳˢᵗᵘᵛʷˣʸᶻ
capital letters: ABDEGHIJKLMNOPRTUVWᴬᴮᴰᴱᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᴿᵀᵁⱽᵂ

The lowercase letters lack q; the capitals lack C, F, Q, S, X, Y and Z.

§The subscript forms

charactersforms
digits: 0123456789₀₁₂₃₄₅₆₇₈₉
signs: +-=()₊₋₌₍₎
lowercase letters: aehijklmnoprstuvxₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓ

No capital letter has a subscript form.

§Forms the table leaves out

The forms are those of the Unicode blocks that fonts have covered for a long time (Latin-1, Spacing Modifier Letters, the two Phonetic Extensions blocks, Superscripts and Subscripts, Latin Extended-C). The few later additions (a superscript q and the superscript capitals C, F and Q) are left out, because a reader’s font is unlikely to show them. The Greek modifier letters are left out too, because they are raised forms of Greek characters, not of the Latin ones a number format writes.

Functions§

subscript_form
Returns the Unicode subscript form of c (₁ for 1, ₐ for a), or None when the table holds none for it.
superscript_form
Returns the Unicode superscript form of c (¹ for 1, ᵃ for a), or None when the table holds none for it.