htmllatexhtml4

Subscript and superscript alignment using only HTML markup


The following picture can be easily produced using a latex rendering software:

Tensors, from Wikipedia!

In particular superscript and subscript parts are one over the other.

Is it possibile getting the same result using only HTML 4 syntax by some clever use of <sup> and <sub> tags, without use of CSS or MathML?


Solution

  • No, it is not possible to have sub- and superscript for an element at the same time using only HTML.

    However, using CSS, there are solutions. For inspiration, have a look at this thread.

    Edit: Source.

    <sub>

    The HTML Subscript Element (<sub>) defines a span of text that should be displayed, for typographic reasons, lower, and often smaller, than the main span of text.

    [...]

    The <sup> HTML element that produces superscript. Note that you cannot use them both at the same time and you need to use MathML to produce both a superscript and a subscript next to the chemical symbol of an element, representing its atomic number and its nuclear number.

    Also note the following remark about <sub> from the same page:

    This element should be used for typographical reasons only, i.e. changing the position of the text changing its meaning like in mathematical (like t2, though the use of a MathML formula should be considered) or chemical formulas (like H2O).