Template:Sortfrac

Jump to navigation Jump to search

<span class="template-frac">1{{{1}}}</span>

Template documentation[view] [edit] [history] [purge]

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 "7823" [1]
  • "{{sortfrac|2|3}}" gives "23" [2]
  • "{{sortfrac|3}}" gives "13" [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>&frasl;<sub>{{{3}}}</sub>}}
   |{{#if:{{{2|}}}
     |{{sort
       |{{#expr: {{{1}}}/{{{2}}} }}
       |<sup>{{{1}}}</sup>&frasl;<sub>{{{2}}}</sub>}}
     |{{sort
       |{{#expr: 1/{{{1}}} }}
       |<sup>1</sup>&frasl;<sub>{{{1}}}</sub>}}
    }}
}}
</span>

See also[edit source]

External links[edit source]