Subscript and Superscript Tests

This EPUB tests subscript and superscript rendering.

Features tested:

Basic superscript (exponents, footnotes)

Basic subscript (chemical formulas, sequences)

Mixed sup and sub in same paragraph

Ordinal numbers

Nested with bold and italic

Long runs of sup/sub text

Basic Superscript

Mathematical Formulas

E = mc² is Einstein's mass-energy equivalence.

The area of a circle is πr².

2¹⁰ = 1024.

xn + yn = zn

Footnote References

This is a sentence with a footnote¹ reference.

Multiple footnotes² can appear³ in one paragraph.

Basic Subscript

Chemical Formulas

Water is H₂O.

Carbon dioxide is CO₂.

Glucose: C₆H₁₂O₆.

Sulfuric acid: H₂SO₄.

Mathematical Sequences

The sequence a₁, a₂, a₃, ..., an.

Matrix element Aij where i is row and j is column.

Mixed Superscript and Subscript

Chemistry and Physics

The pH of water is 7, meaning [H₃O⁺] = 10⁻⁷ mol/L.

Speed of light: c = 2.998 × 10⁸ m/s.

Avogadro's number: 6.022 × 10²³ mol⁻¹.

Complex Formulas

Isotope notation: ²³⁵U₉₂ (uranium-235).

Electron configuration: 1s² 2s² 2p⁶.

Ordinal Numbers

Ordinal Suffixes

On the 1st of January, the 2nd quarter begins on the 3rd month.

The 4th through 20th days of the month.

The 21st, 22nd, 23rd, and 24th hours.

Historical Dates

The 19th century saw rapid industrialization.

World War II ended on May 8th, 1945.

Nested with Bold and Italic

Bold Superscript

Bold superscript: x² + y² = r².

Bold base with superscript: E = mc².

Italic Subscript

Italic subscript: Hn represents the n-th harmonic.

Italic base with subscript: a₁, a₂, a₃.

Combined Styles

Bold text with H₂O and E = mc² inside.

Italic text with CO₂ and xn inside.

Long Superscript and Subscript Runs

Extended Superscript

This wordhas a rather long superscript attached to it continuing normally.

Polynomial: x¹⁰ + x⁹ + x⁸ + x⁷ + x⁶ + x⁵ + x⁴ + x³ + x² + x + 1.

Extended Subscript

This wordhas a rather long subscript attached to it continuing normally.

Sequence: a₁, a₂, a₃, a₄, a₅, a₆, a₇, a₈, a₉, a₁₀.

Alternating

Mixed: x²y₁ + x³y₂ + x⁴y₃ = 0.

Edge Cases and Stress Tests

Empty and Whitespace

Empty superscript: xy should show xy.

Whitespace: x y should show x y.

Nested Sup/Sub (Not Standard)

Nested attempt: xyz (may not render correctly).

Unicode in Sup/Sub

Greek letters: α² + β² = γ².

Symbols: H₂O → H⁺ + OH⁻.

Line Breaking

Long text with superscript at the end of a line to test wrapping behavior when the superscript might need to wrap to the next line¹ and continue here.

CSS Style Tests

CSS Classes

This tests superscript via CSS class (.super): E = mc2.

This tests subscript via CSS class (.sub): Water is H2O.

CSS Inline Styles

This tests superscript via inline style: E = mc2.

This tests subscript via inline style: Water is H2O.

Comparison Side-by-Side

Tag `sup`: E = mc²

Class `super`: E = mc2

Inline `super`: E = mc2

Tag `sub`: H₂O

Class `sub`: H2O

Inline `sub`: H2O

Mixed and Nested in CSS

CSS Class mixed: [H3O+] = 10-7 mol/L.

CSS Inline mixed: [H3O+] = 10-7 mol/L.

Bold text with class H2O and E = mc2 inside.

Italic text with inline H2O and E = mc2 inside.