- From: Jukka K. Korpela <jkorpela@cs.tut.fi>
- Date: Fri, 10 Sep 2004 23:52:03 +0300 (EEST)
- To: Rolf Pfister <pfister@pci.unizh.ch>
- Cc: www-validator@w3.org
On Fri, 10 Sep 2004, Rolf Pfister wrote: > the validator thinks this is wrong: > <PRE> > m*v<SUP>2</SUP> > </PRE> The validator doesn't really think. It simply reports that the document does not comply with the document type that you have declared. And indeed all the published HTML specifications restrict the content model of the PRE element so that e.g. the SUP element is excluded. > I use this construct several times in this file. And you have superscripts and subscripts of different kinds there, and even images. The superscript 2 issue itself could be solved by using the special character SUPERSCRIPT TWO (which you can write in HTML using ² for example), but for most other issues there is no such solution. > If its really wrong how could I avoid it? Whether it really matters is debatable. The syntax rules for PRE are based on the principle that no change in font size should be allowed there, since the very idea of PRE is to present preformatted text exactly as written so that characters remain exactly positioned with respect to each other. But such a principle cannot really be presented in the formal syntax (DTD); hence the syntax is unnecessarily restrictive (e.g., forbids <font>, although <font> could be used just for a colour change). Moreover, the principle might not matter in all uses of PRE - if you violate the principle, the characters might not stay positioned as they are, in all circumstances, but this might be acceptable. So one approach is to use a modified DTD. Naturally your document would not then comply with HTML specifications, but they might still work, and you could still use a validator to check the syntax (so that you deviate from "official" syntax only when you really want to). Using HTML 4.01 as the basis, the relevant syntax rule is <!ENTITY % pre.exclusion "IMG|OBJECT|BIG|SMALL|SUB|SUP"> in the Strict version and <!ENTITY % pre.exclusion "IMG|OBJECT|APPLET|BIG|SMALL|SUB|SUP|FONT|BASEFONT"> in the Transitional version. (In Transitional, APPLET, FONT, and BASEFONT are not allowed at all, so they need not be listed in the exclusion list.) This lists those inline elements that are not allowed inside PRE, directly or indirectly. So by removing an element from the list you make it allowed, in your modified DTD. On the other hand, a different - and perhaps better - approach is to consider whether you could make the markup comply with HTML specifications, perhaps even dispensing with the PRE element altogether. This might be a long process, but it might also result in a better rendering of the formulas you have. For ideas on presenting mathematical expressions using HTML (and CSS), see my http://www.cs.tut.fi/~jkorpela/math/ (I think many of your formulas can be relatively easily presented without using PRE, while some - especially those with largish quotients - might be rather tricky.) -- Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
Received on Friday, 10 September 2004 20:52:37 UTC