Jump to content

User:Wikid77/Template:Convert/mix2/doc

From Wikipedia, the free encyclopedia

The mixed converter Template:Convert/mix2 will convert 2 amounts of different units at once, allowing any range words/text between the 2 amounts. However, both amounts can use different units, or the same unit type. The output unit must be specified, or put "0" for the default output unit.

Usage:    {{convert/mix2 |5|in|cm|by|3|ft|m}}
{{convert/mix2 |9|ft|m|high, weighing|56|kg}}
{{convert/mix2 |750|m|ft|up to|3|km|mi}}
{{convert/mix2 |11|in|cm|m|x|1.6|ft|m|abbr=on}}

The template has the same parameters as Template:Convert, and so it allows abbreviation abbr=in or abbr=out or abbr=none, wikilinks lk=on, lk=in or lk=out, and adjective mode adj=on. The separator can also be a semicolon: disp=semi, disp=or, disp=comma, disp=x & disp=b (default parentheses). Using optional parameter "warn=yes" will warn when the separator is an unusual word (other than: to, by, and, or, -, +/-, x, xx or comma).

Examples

The following examples show various separator text, with p=2 to round the precision to 2 decimal places:

  • {{convert/mix2 |5|in|cm|by|3|ft|m}}        → 5 inches by 3 feet (13 cm by 0.91 m)
  • {{convert/mix2 |5|in|cm|x|1.4|ft|m|p=2}}     → 5 inches × 1.4 feet (12.70 cm × 0.43 m)
  • {{convert/mix2 |9|ft|m|high, weighing|56|kg}} → 9 feet high, weighing 56 kilograms (2.7 m high, weighing 123 lb)
  • {{convert/mix2 |750|m|ft|up to|3|km|mi}}     → 750 metres up to 3 kilometres (2,460 ft up to 1.9 mi)
  • {{convert/mix2 |5+1/2|in|m|by|1+2/3|ft|m}}    → 5 12 inches by 1 23 feet (0.14 m by 0.51 m)

Any text can separate the amounts, but the typical range-words are: to, by, and, or, -, +/-, x, xx & comma. Display types: disp=comma, disp=semi, disp=or, disp=s, disp=2 (or disp=out), disp=# (or disp=number), disp=x and disp=b. The results are identical to using Template:Convert for each amount individually, and then mixing the inputs and outputs.

Common problems

Because there are 2 sets of unit-codes (for 2 inputs and 2 outputs), care must be taken to place all 7 parameters in the proper order. Note that the name of the template is "Convert/mix2" and omitting the "/mix2" will produce incorrect results. Some issues to note:

  • Check the placement of all 7 parameters for both sets of unit-codes.
  • Remember the name as "convert/mix2".
  • To skip an output unit, put "0" to get the default output.
  • When using disp=x, the custom text is in parameters 8 and 9.
See also