Re: both sub- and superscript together?



Scripsit Ben:

a<sup>2</sup><sub style='position: relative; left: -.5em;'>i</sub> ?

It works - very nice! Thank you,

Unfortunately, that's mostly an illusion. Test it using different fonts and different browsers, and you'll probably see many variants ranging from very nice to really awful, like the superscript and the subscript overlaid.

When you shift the subscript to the left - which you can do with other techniques as well (see e.g. http://www.cs.tut.fi/~jkorpela/math/#subsup ), you need to make a guess or an estimate on how much it needs to be shifted to reach the same horizontal position as the superscript. The real effect depends on the font, and using the em unit does not solve all the problems here.

So you need to be careful, and the results will still vary, though perhaps tolerably. It is essential to vertical-align for sup and sub, since otherwise the effects will be far too different on IE and Firefox (which have rather different defaults for it).

From the HTML perspective, the basic problem is in that sub and sup elements
are defined in a rather presentation-oriented manner rather than structurally. When you write <sub>i</sub>, you're saying that i is a subscript but not what it is associated with. In the given case, "i" is a subscript for "a" whereas "2" is a superscript (exponent) for the expression consisting of "a" with subscript "i". There is no way to express this structural relationship in HTML.

Andreas effectively suggested the safe approach of giving up the idea of imitating the conventional mathematical notation and using parentheses to indicate the structure. It unambiguously indicates the meaning, though in a style that differs from normal math texts. Other approaches involve various risks, so you need to weigh the risks against the desirability of "math style" rendering.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

.



Relevant Pages

  • Superscript and Subscript in Reports and forms
    ... reports with chemical formulas where subscript or a formula with superscript ... There are three different fonts with which superscripts and subscripts can ... A second tip to pass along is to create an Input mask for numbers. ...
    (microsoft.public.access.reports)
  • Re: How do I type a fraction in `Word`without using super/sub script
    ... It doesn't mention that a variety of fonts (not including Times New ... unfortunately) include whole sets of superscript and subscript ... numbers and a "solidus" slash at a steeper angle, ...
    (microsoft.public.word.docmanagement)
  • Re: Abbreviation for Carbon Dioxide
    ... Also, in some fonts (including the "C" fonts that come with Word2007, ... there are special characters for the subscript and superscript ...
    (microsoft.public.word.docmanagement)
  • Re: How do I insert superscripts & subscripts using XP WORD
    ... like I said I can change the fonts ... but unchecking superscript ultimately doesn't ... If the text you want to make subscript or superscript is already typed ...
    (microsoft.public.word.docmanagement)
  • Re: lining numerals in Constantia?
    ... subscript and superscript fonts in Constantia as viewed in Word 2007 ... Lead PM for fonts, Microsoft typography, received a reply. ... it's still early days and we can't make any official promises." ...
    (microsoft.public.word.printingfonts)