Mobile app version of vmapp.org
Login or Join
LarsenBagley460

: How to typeset units in HTML What is the correct way to set type units in HTML? Stuff like 2km Do I just put the unit right after the value as above? Or is there a special short space?

@LarsenBagley460

Posted in: #Html #Typesetting

What is the correct way to set type units in HTML? Stuff like

2km

Do I just put the unit right after the value as above? Or is there a special short space? If so how do I prevent a line break between value and unit? How about combined units like

3Ah

where A stands for Ampere and h for hours does anything special go between A & h?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @LarsenBagley460

1 Comments

Sorted by latest first Latest Oldest Best

 

@Sent7350415

There is a space between the value and the unit - I think a nbsp should do.
I'm not sure about the "Ah" case. It's A times h, so it should be written with space "A h" (or with dot, "A·h") according to the text below; but "Ah" feels ok to me. For combining a unit with a prefix, there is no space between them - it is "2 km" for metres with the prefix kilo.

One would ask scientists how to write physical units, of course. And scientists use TeX/LaTeX for this, so it's a good idea to look there:

There is a TeX package describing how to render units in all detail.
LaTeX package "siu­nits" – In­ter­na­tional Sys­tem of Units.
See for example "2.4.1 Space between numerical value and unit symbol" on page 15.
It documents various special cases too, like that the temparature "10 °C" has a space, but the angle "10°" does not.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme