Template:Convert/doc

Usage
This template shows measurement quantities as primary and converted secondary units (or ranges), with optional rounding, wikilinks, abbreviation, or US spellings, and various separators including: parentheses "", slash, "or", hyphens, comma, "to" or dashes. Styles include: distance "32 m" and "32 m"; temperature "18 °C" or "18 °C"; weight "55.0 kg" or "65 to 80 kg"; etc. For units see: Convert/list of units. Single value:  value in_unit 

Range of 2 values, or set of 3 or 4 (see below for list of range options):  {&#123;convert|val1|range|val2 |in_unit|out_unit|round_to|...}} {&#123;convert/3 |val1|range|val2|words|val3|in_unit|out_unit|round_to|...}} {&#123;convert/4 |val1|words|val2|words|val3|words|val4|in_unit|out_unit|...}}
 * Numbers must be entered in unformatted form (without commas). Values output by the template will be displayed formatted and with a true minus sign where appropriate. To specify with commas, re-code a number as 9,000,500 (becomes 9000500).
 * Optional parameters, in examples below, allow abbreviated units (abbr=on), or US spellings (sp=us for meter), or slash separation (disp=s), or hyphenation (adj=on), etc.
 * For this template many levels of substitution are possible, hence doing this fully, step by step, is cumbersome. Use Special:ExpandTemplates instead.
 * The template has no in-built capacity for dimensional analysis. It is therefore up to the user to ensure that most input and output units are compatible.  Do not, for example, attempt to convert barrels to tonnes (but see bbl to t).  Also beware of units with similar names; the code , for example, is for the avoirdupois ounce (a unit of mass), do not use this if you want fluid ounces.
 * An attempt to convert a unit to itself (e.g. km to km), will result in a template loop.
 * The range functionality is not fully implemented for all units, so experimentation may be required.
 * This documentation page tends to lag behind in terms of what the template can do. For details see the talk page and its archives.

Range of 2 values

 * Note: not yet operational for all units

The following conversions are currently not available as a range of values:
 * Some imperial and US gallon-based units
 * Other fuel-consumption units, except "mpg" or "L100km" shown above.
 * Large scale units (e3, e6, e9)
 * Combination-based units (ft&in, st&lb, lb&oz) due to complexity of the conversion.

Range/set of 3 or 4 values

 * Note: not yet operational for all units

For {&#123;convert/4}}, the separator words can be any text. For {&#123;convert/3}}, the first separator word must be x, and, or, to, -, or by.

Parameters still under construction
{| class="wikitable" ! colspan="2" | Parameters still under construction. May not work in all situations
 * Round by 5 || attach &#124;disp=5 to round output to nearest 5 units. Might not work when linking unit names.
 * disp=tablecen||Similar to disp=table except that the values with be centered within the column. See the tables at La Nouvelle branch, BM-21 Grad for in use examples.
 * disp=comma||Similar to disp=s except the two values will be separated by a comma, for situations where the first value is already within parentheses. See the Geography tables on Labrador for an example.
 * abbr=in||Abbreviates only the input unit.
 * abbr=out||Abbreviates only the output unit.
 * abbr=comma||Abbreviates (removes) commas. This is a limited, temporary option, until comma=off can be implemented. For ranges, using abbr=comma conflicts with internal options, so instead, append "nocomma" to a range-word: tonocomma, bynocomma, andnocomma, -nocomma & xnocomma.
 * abbr=mos||For ranges, abbreviates with the input unit repeated, twice. Not to be confused with the specifications at MOS:NUM.
 * disp=br||For using [brackets] instead of (parentheses), this would be best used when measurements are written within an existing set of (parentheses). It is grammatically correct and avoids double parentheses: )).  Must use |abbr=on to force all units abbreviated, otherwise units are not abbreviated.  Example: 55 miles [89 kilometres].  '''SEE attach   as noted above.
 * abbr=out||Abbreviates only the output unit.
 * abbr=comma||Abbreviates (removes) commas. This is a limited, temporary option, until comma=off can be implemented. For ranges, using abbr=comma conflicts with internal options, so instead, append "nocomma" to a range-word: tonocomma, bynocomma, andnocomma, -nocomma & xnocomma.
 * abbr=mos||For ranges, abbreviates with the input unit repeated, twice. Not to be confused with the specifications at MOS:NUM.
 * disp=br||For using [brackets] instead of (parentheses), this would be best used when measurements are written within an existing set of (parentheses). It is grammatically correct and avoids double parentheses: )).  Must use |abbr=on to force all units abbreviated, otherwise units are not abbreviated.  Example: 55 miles [89 kilometres].  '''SEE attach   as noted above.
 * abbr=mos||For ranges, abbreviates with the input unit repeated, twice. Not to be confused with the specifications at MOS:NUM.
 * disp=br||For using [brackets] instead of (parentheses), this would be best used when measurements are written within an existing set of (parentheses). It is grammatically correct and avoids double parentheses: )).  Must use |abbr=on to force all units abbreviated, otherwise units are not abbreviated.  Example: 55 miles [89 kilometres].  '''SEE attach   as noted above.
 * disp=br||For using [brackets] instead of (parentheses), this would be best used when measurements are written within an existing set of (parentheses). It is grammatically correct and avoids double parentheses: )).  Must use |abbr=on to force all units abbreviated, otherwise units are not abbreviated.  Example: 55 miles [89 kilometres].  '''SEE attach   as noted above.
 * disp=br||For using [brackets] instead of (parentheses), this would be best used when measurements are written within an existing set of (parentheses). It is grammatically correct and avoids double parentheses: )).  Must use |abbr=on to force all units abbreviated, otherwise units are not abbreviated.  Example: 55 miles [89 kilometres].  '''SEE attach   as noted above.


 * Combine both of the above
 * If both the desired precision and the desired number of significant figures are specified, the conversion will be rounded to the least precise of these.


 * Default rounding
 * If neither the desired precision nor the desired number of significant figures are specified, the conversion will be rounded either to a comparable precision as the input value (the number of digits after the decimal point—or the negative of the number of non-significant zeroes before the point—is increased by one if the conversion is a multiplication by a number between 0.02 and 0.2, remains the same if the factor is between 0.2 and 2, is decreased by 1 if it is between 2 and 20, and so on) or to two significant figures, whichever is the most precise. An exception to this is temperature wherein the conversion will be rounded either to precision comparable to that of the input value or to that which would give three significant figures when expressed in kelvins, whichever is the most precise.

Units supported
The table below lists units supported by this template. It is divided up according to the quantity being measured. Not all supported units are listed here; there are links to complete lists for each quantity.

The codes listed in the code column (column 3) are accepted as input by the template. These can be used as the second or third unnamed parameter. For some units there exist alternative codes. These are listed in brackets and have been incorporated to make the code more flexible for editors, e.g. °F or F may be entered.

The codes listed in the combinations column (column 7) can be used to produce multiple conversions. They can only be used as the third unnamed parameter, e.g.  produces "55 nmi".

Examples

 * Monitor quality or look at examples at Convert/check.