w:vertAlign (Vertical Alignment)

Applies superscript or subscript vertical positioning to the run relative to the baseline.

Parent elements

Description

w:vertAlign positions the run text as superscript or subscript relative to the surrounding baseline. It is defined in ECMA-376 Part 1 §17.3.2.42.

The offset and size reduction applied to the glyphs are determined by the font and renderer; the element itself only specifies the intent. For precise control, combine with w:sz (to set absolute size) and character position adjustment via w:position.

Attributes

Attribute Type Possible Values Description
w:val ST_VerticalAlignRun baseline (default, no shift), superscript (raised above baseline), subscript (lowered below baseline) The vertical alignment mode for the run.

Examples

<!-- E=mc<superscript>2</superscript> -->
<w:r><w:t>E=mc</w:t></w:r>
<w:r>
  <w:rPr>
    <w:vertAlign w:val="superscript"/>
    <w:sz w:val="20"/>
  </w:rPr>
  <w:t>2</w:t>
</w:r>
<!-- H<subscript>2</subscript>O -->
<w:r><w:t>H</w:t></w:r>
<w:r>
  <w:rPr>
    <w:vertAlign w:val="subscript"/>
  </w:rPr>
  <w:t>2</w:t>
</w:r>
<w:r><w:t>O</w:t></w:r>

Notes

  • Baseline: w:val="baseline" (default) applies no vertical offset.
  • Superscript: Raised above baseline; typically 33-50% smaller than normal text.
  • Subscript: Lowered below baseline; typically 33-50% smaller than normal text.
  • Font Size: w:vertAlign doesn’t change w:sz; combine with w:sz for explicit size control.
  • Renderer Dependent: Exact offset and size reduction depends on font and rendering engine.
  • Character Positioning: Use w:position (in half-points) for additional fine-tuning.
  • Toggle Cancellation: w:val="baseline" cancels superscript/subscript from parent style.
  • Common Use Cases: Mathematical equations, chemical formulas, footnote/endnote references.
  • RTL Support: Works consistently with right-to-left and complex script text.
  • Compatibility: All Office versions support superscript and subscript consistently.