9.4.3 Subscripts and Superscripts
Subscripts are obtained either by the command
or by the special character:
Superscripts are obtained either by the command
or by the special character:
Examples:
- This example uses
\sb
and\sp
: - This example uses _ and ^
- Recall from
earlier that
mandatory arguments only consisting of one
character don't need to be grouped, so the above code can also be
written as:
This is simpler than the first two examples. However it's a good idea to be in the habit of always using braces in case you forgot them when they're needed.
Notice how the subscript gets tucked under the slope of the in:
Compare with
Example (Nested)
Subscripts and superscripts can also be nested (note that it is now necessary to group the argument to the superscript command):
which produces
This example isn't quite right as e isn't actually a variable and shouldn't be typeset in italic. The correct way to do this is:
which results in:
If you are going to use e a lot, it will be simpler to define a new command to do this. The definition should go in the preamble:
Then in the document:
Take care when nesting subscripts or superscripts. The following
will give a ! Double subscript error.
This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-00-5).