Fyrimynd:Sortfrac

Frá Wikipedia, hin frælsa alfrøðin
Jump to navigation Jump to search

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

Documentation icon Skjalfesting til fyrimyndina[vís] [rætta] [søga] [dagfør]

This template is a combination of {{frac}} and {{sort}}. It allows numerical sorting of a column containing fractions.

Dømi[rætta wikitekst]

  • "{{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.

Kota[rætta wikitekst]

<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>

Sí eisini[rætta wikitekst]