Template:Sortfrac
Jump to navigation
Jump to search
<span class="template-frac">1⁄{{{1}}}</span>
This template is a combination of {{frac}} and {{sort}}. It allows numerical sorting of a column containing fractions.
Examples[edit source]
"{{sortfrac|78|2|3}}"
gives "782⁄3" [1]"{{sortfrac|2|3}}"
gives "2⁄3" [2]"{{sortfrac|3}}"
gives "1⁄3" [3]
For examples of tables using the template see DHL Delivery Man Award.
Code[edit source]
<span class="template-frac">
{{#if:{{{3|}}}
|{{sort
|{{#expr: {{{1}}}+{{{2}}}/{{{3}}} }}
|{{{1}}}<sup>{{{2}}}</sup>⁄<sub>{{{3}}}</sub>}}
|{{#if:{{{2|}}}
|{{sort
|{{#expr: {{{1}}}/{{{2}}} }}
|<sup>{{{1}}}</sup>⁄<sub>{{{2}}}</sub>}}
|{{sort
|{{#expr: 1/{{{1}}} }}
|<sup>1</sup>⁄<sub>{{{1}}}</sub>}}
}}
}}
</span>
See also[edit source]
- Template:Sortname - sort names using "last name, first name" as default sort key
- {{Sfrac}}
External links[edit source]
- Template:Sortfrac at Wikipedia, the free Terran-based encyclopedia that anyone can edit.
The above documentation is transcluded from Template:Sortfrac/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |