Wikipedia:WikiProject Space/phys unit templs

From Wikipedia, the free encyclopedia

[edit] Between Imperial and SI units conversion templates

These templates are used for automated parenthesized unit conversion. If, for example, You write a distance in kilometer (SI unit), say 12 km, and also wish a distance in miles in parenthesis for the Imperial unit readers but don't care to manually convert the distance in km to miles, then You may instead write the template call {{km to mi|12}} to get the text 12 kilometers (7.5 mi), where Wikipedia computes 12 km = 7.5 mi for You. There are many fine adjustments parameters for these templates (see below), so the template call {{km to mi|12|abbr=no}}, writes full unit names, like 12 kilometers (7.5 miles).

Note: the full documentation is repeated in the respective template (second column), so you may also read about their usage there.

template
sample
template link argument
unit
autogenerated
unit in
parenthesis
════════ Length and area conversions ════════
12 kilometers (7.5 mi) {{km to mi|kilometer quantity}} kilometer, km imperial miles, mi
12 miles (19.3 km) {{mi to km|miles quantity}} imperial miles, mi kilometer, km
12 meters (39.4 ft) {{m to ft|meter quantity}} meter, m foot, ft
12 feet (3.7 m) {{ft to m|foot quantity}} foot, ft meter, m
12 square kilometers (4.6 sq mi) {{km2 to mi2|square kilometer quantity}} square kilometer, km2 square miles, mi2
12 square miles (31.1 km²) {{mi2 to km2|square mile quantity}} square miles, mi2 square kilometer, km2
12 square meters (129.2 sq ft) {{m2 to ft2|square meter quantity}} square meter, m2 square foot, ft2
12 square feet (1.1 m²) {{ft2 to m2|square foot quantity}} square foot, ft2 square meter, m2

[edit] Fine adjustments

Valid for all the above templates.

Usage:

{{template name
| number
| abbr=mos/yes/no
| spell=American/Commonwealth
| precision=number of digits (1)
| wiki=yes/no
}}

Italicized parameters are optional:

  • number is a required parameter, which specifies the quantity of argument unit ("km", kilometers in Template:km to mi) to be converted to target unit ("mi" miles in Template:km to mi). Please do not format this parameter; i.e., use 1234 instead of 1,234 (one thousand and two hundred thirty four).
  • abbr=mos/yes/no can take values of either mos, yes, or no. Mos will show the names of the units as specified in the Manual of Style for dates and numbers, yes will show the abbreviated names of the units (km, mi, ft, m2 etc.), and no will show the full names of the units (kilometers, miles, foot, square meters etc.). The default value is mos.
  • spell=American/Commonwealth can take values of American or Commonwealth and is only meaningful when abbr is set to no. American will use "kilometers", and Commonwealth—"kilometres". The default value is American.
  • precision=number of digits is the number of decimal digits in the converted value. The default value is 1.
  • wiki=yes/no specifies whether the names of the units should be wiki-linked or not, and can take values of either yes or no. The default value is no.

Examples:

Manual of Style notation: {{ft to m|1000}}
→ 1,000 feet (304.8 m)
Short notation: {{km to mi|100|abbr=yes}}
→ 100 km (62.1 mi)
Full notation: {{ft to m|num=100|abbr=no|spell=Commonwealth|precision=2|wiki=yes}}
→ 100 feet (30.48 metres)
No links/long units/American (default): {{km2 to mi2|33|abbr=no}}
→ 33 square kilometers (12.7 square miles)

[edit] Se also