Re: both sub- and superscript together?
- From: "Jukka K. Korpela" <jkorpela@xxxxxxxxx>
- Date: Thu, 5 Jul 2007 11:37:16 +0300
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 elementsare 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/
.
- References:
- both sub- and superscript together?
- From: Ben
- Re: both sub- and superscript together?
- From: rf
- Re: both sub- and superscript together?
- From: Ben
- both sub- and superscript together?
- Prev by Date: Re: both sub- and superscript together?
- Next by Date: Advice on learning web page creation and database integration
- Previous by thread: Re: both sub- and superscript together?
- Next by thread: Re: both sub- and superscript together?
- Index(es):
Relevant Pages
|