Logo HTML Topics: Subscripts and Superscripts

Course Material Index  Section Index  Previous Page  Next Page

Subscripts

A very common tag needed by scientists is the subscript. The text to be subscripted is enclosed between the tags <SUB> and </SUB>. So to show the parameter p subscripted 1, 2, ... , n, you should write

<i>p</i><SUB>1</SUB>, <i>p</i><SUB>2</SUB>, ... , <i>p</i><SUB>n</SUB>,

which displays as p1, p2, ... , pn.

Given the poor rendition of italicised subscript and superscript fonts in many HTML browsers, we have chosen not to italicise variables when they are used as subscripts or superscripts. This is purely a matter of style, and is the one adopted for this particular course material.

Superscripts

The complimentary tag to the subscript is the superscript.  The text to be superscripted is enclosed by the tags <SUP> and </SUP>. So to raise the variable x to the power of two you should write

<SUP><i>x</i></SUP>,

which displays as x2.

You may note that one side effect of the use of subscripts and superscripts in HTML documents is to cause a change in the linespacing used by the browser. The use of these tags spoils the appearance of paragraph text in which they occur, but this effect cannot be avoided.

Use of Subscripts and Superscripts

Nesting

The order in which tags are used is very important since different results will be obtained depending on whether they are nested or not. Thus the square of the ith variable x may be written without nesting as:

<I>x</I><SUB>i</SUB><SUP>2</SUP>, which displays as xi2 (or as xi2 using a larger font).

By nesting the tags it is the subscript that appears squared and not the variable x:

<I>x</I><SUB>i<SUP>2</SUP></SUB>, which displays as xi2 (or as xi2 using a larger font).

Combinations

Occasionally it is necessary to assign both subscripts and superscripts to a variable as in F2hkl (which is something you will see later in the course material). In this particular example, the 2 indicating that the variable is squared has been superscripted first and the parameters hkl have been subscripted second.

The alternative format Fhkl2, in which the square is superscripted after the subscript parameters, may be ambiguous since the parameter l may appear to be squared.

Missing or Mistyped End Tags

It is especially important with these tags that the end tag is supplied in the correct place: it is very easy to omit or mistype /SUB for /SUP (or vice versa) with the sort of effect shown below:

Mistyped end tags can cause the text after x2 (written as <I>x</I><SUP>2</SUB>) to go up hill!


Course Material Index  Section Index  Previous Page  Next Page
© Copyright 1995-2006.  Birkbeck College, University of London.
 
Author(s): Jeremy Karl Cockcroft
Huub Driessen