[whatwg] Physical quantities: <var> or <i>?

On Tue, 26 Jul 2011, Jukka K. Korpela wrote:
> 25.07.2011 22:02, Ian Hickson wrote:
> > > 
> > > So what markup should we use for E = mc?, given that by the 
> > > applicable standards, E, M, and c should appear in italics and the 
> > > other characters as normal (upright)?
> > 
> > It sounds like you want to use these characters:
> > 
> >     U+1D438 MATHEMATICAL ITALIC CAPITAL E
> >     U+1D45A MATHEMATICAL ITALIC SMALL M
> >     U+1D450 MATHEMATICAL ITALIC SMALL C
> 
> No, I don?t want to use them, since only about one person in a million 
> would see the expression. There are several reasons to that, including 
> the absence of those characters in fonts?the only commonly available 
> font that contained a reasonable collection of Plane 1 characters was 
> code2001, and it does not seem to be distributed by its author any more.

Well, any new feature will take time to get adopted. We live in the future 
here. That it doesn't work yet isn't a valid argument against it. :-)


> Comparing this with how well <i>E</i> = <i>m</i><i>c</i>? works, I 
> don't think anyone who understands the implications will give a second 
> though to using such Plane 1 characters in HTML documents.

If it works well, I think we're good. Problem solved.


> > Alternatively, you can use MathML to mark up the equation.
> 
> Or I could use LaTeX and get a presentation of acceptable quality. Or an 
> image, as people still widely use. The question was about markup of 
> physical quantities in HTML. Using other tools just to present a casual 
> equation in running text would be disproportionate.

MathML is merely one of several options available to HTML authors that I 
was enumerating. It is obviously not the only one. For more complicated 
cases, it may be the preferred option (e.g. if you have fractions, 
calculus, etc). For simpler cases, e.g. a single variable, it's obviously 
not simpler than just using <var>.



> > Whether you want something in italics or not is more a matter for CSS 
> > than a matter for HTML.
> 
> In many contexts, by long traditions and conventions, the use of italics 
> is a matter of content, not casual presentation.

Well, kinda. The content is "variable", or "planck constant", or "pi"; the 
presentation as a set of pixels representing an italics /i/ vs an audio 
sample that says "eye" vs a set of raised dots in Nemeth Braille is the 
presentational aspect. As such I think it's fair to say that the italics 
is a mapping of the <var> semantic to display presentation via CSS.


> > > Should we consider the var element as covering physical quantities 
> > > too? After all, they can be regarded as variables in a broad sense, 
> > > as symbols that denote different values in different situations. 
> > > However, <var>c</var> would be odd, wouldn't it, since the symbol 
> > > denotes a universal constant of nature.
> > 
> > You can look at it as being a variable whose value is a constant of 
> > nature. I've clarified the spec to indicate that this is fine.
> 
> I don?t think you have clarified whether <var> is suitable for 
> physical quantities, but I guess you meant to imply it?even though 
> there is not a single example about markup for physical quantities.

Given that the spec contains the exact example you gave (E=mc^2), and 
given that the definition explicitly includes "an identifier representing 
a constant" as one of the uses for the element, I have to disagree with 
your assessment.


> On the other hand, it seems that it doesn?t really matter. The <var> 
> element has now been defined to have such a wide and vague meaning that 
> it is pointless to use it. There is little reason to expect that any 
> software will ever pay attention to <var> markup on any semantic basis.

You seem to imply that there was reason to expect so before, which is 
certainly news to me! I would not really expect these elements to be used 
for anything other than styling hooks.


> So authors will use <i> if they think italics is semantically essential, 
> and <var> won?t be used much.

That seems to be the status quo.


> > > A programming language variable is something that is _not_ 
> > > conventionally rendered in italics. Rather, they are usually (though 
> > > for no really good reason) rendered in a monospace font, like any 
> > > other expressions in computer languages.
> > 
> > Indeed. And vectors are usually bold.
> 
> So why should authors be told to use markup that by default (and always 
> when CSS is off) results in programming language constructs to be 
> italicized? Flagging ?placeholders? with italics (as in ?issue the 
> command <kbd>rm <i>filename</i></kbd> to delete a file) is a widely used 
> and understood style, but programming language variables are a 
> completely different issue.

Well it's entirely up to the authors, of course; if they would rather only 
use <div>s and <span>s then there's not much we can do to stop them. 
However, some authors like the ease of maintenance that comes from using 
elements as a general classification mechanism and classes to provide 
fine-grained control, and it is mostly for them that HTML provides a 
variety of more specific elements like <var>.


> > > Too bad there's no example of<var> used in programming context. The 
> > > current wording suggests that it would be normal, when discussing 
> > > programming, to write, say, "Then we define the variable 
> > > <var>myFoo</var> of type<code>fooType</code> with initial value 
> > > <code>"Foo"</code> - -", which really makes no sense, even if we use 
> > > both<var> and<code> for myFoo.
> > 
> > Why does it make no sense?
> 
> Because it implies that in default rendering, identifiers of variables 
> appear in italics whereas identifiers of types or classes do not. Why 
> would anyone use extra <var> markup when it has no other implications 
> than requiring extra CSS code to remove (when possible) italics?

To enable easier maintenance of the markup and easy self-documenting 
styling, same as pretty much all of HTML.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 20 January 2012 14:30:03 UTC