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

Ian Hickson ian at hixie.ch
Mon Jul 25 12:02:15 PDT 2011


On Thu, 14 Apr 2011, Jukka K. Korpela wrote:
>
> Looking at the nice summary (with examples) of text-level markup at 
> http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#usage-summary 
> I started wondering why there is no example of markup for symbols of 
> physical quantities. The descriptions of individual elements or their 
> examples don't seem to say anything about this either.

The main reason is that most of these symbols have Unicode characters and 
don't need special markup.


> 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

Alternatively, you can use MathML to mark up the equation.


> Physical quantities surely satisfy the requirement that "typical 
> typographic presentation is italicized" in the following, and they are 
> to be offset from the normal prose, but why aren't they mentioned in the 
> fairly long list of examples then:
> 
> "The i element represents a span of text in an alternate voice or mood, 
> or otherwise offset from the normal prose, such as a taxonomic 
> designation, a technical term, an idiomatic phrase from another 
> language, a thought, a ship name in Western texts, or some other prose 
> whose typical typographic presentation is italicized." 
> http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-i-element
> 
> (As an aside, the wording "a taxonomic designation" is too broad, as by 
> biological nomenclature rules, genus and species names are to be 
> italiced but higher taxons, e.g. family names, like Canidae, must not. 
> Besides, e.g. an English name of a species is taxonomic too... So 
> "scientific names of organisms" would be a better formulation.)

Whether you want something in italics or not is more a matter for CSS than 
a matter for HTML.


> 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.


On Thu, 14 Apr 2011, Bjartur Thorlacius wrote:
>
> Well, a constant isn't really variable any more, is it? I thought <var> 
> was meant to mark up text that couldn't simply be 'copypasted' without 
> filling in the unknowns (free variables). Defined variables (whether in 
> source code or formulae) do not conform to that definition.
> 
> So, <code>rm -r <var>$path</var></code> would conform (as a reply to the 
> question "how does one remove a (potentially non-empty) directory on 
> *nix?") as $path is undefined, but <code><var>i</var>++</code> would 
> not, as i isn't ment to be substituted.

What do you base this interpretation on?


On Sat, 16 Apr 2011, Jukka K. Korpela wrote:
> 
> Besides, there is no implied uniform rendering for variables in the 
> current broad meaning for <var>. In mathematics, variables are 
> conventionally written in italics. But the HTML(5) notion of variable is 
> wider: "The var element represents a variable. This could be an actual 
> variable in a mathematical expression or programming context, or it 
> could just be a term used as a placeholder in prose." 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. This is the kind of thing I would 
expect to see handled using classes, e.g.:

   <var class=vector>a</var> &#x2A2F; <var class=vector>b</var> =
   <var>a</var> <var>b</var> sin <var>θ</var> <var class=vector>n</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?

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


More information about the whatwg mailing list