قالب:Nk

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

Use

This template prefixes text with an invisible sort key based upon a real number for use in sortable tables with mixed numbers and text or just text. This template maintains a valid sort order with an accuracy of one part in 10,000,000,000 in the ranges 1e-300 to 1e300 and -1e-300 to -1e300.

The syntax of this template is:

{{nk|var1|var2}}

where:

  • var1 = any real number (may contain thousands separators), ∞, 1/∞, -1/∞, -∞, INF, 1/INF, -1/INF, -INF, IND, indeterminate, UND, undefined, UNK, unknown, NA, not applicable, or not available.
  • var2 = optional text to display (default = var1)
    • NOTE: If var2 is $, £, €, #, or No., var2 is prefixed to var1

The use of this template is illustrated in the sortable table below:

Wikitext Invisible sort key prefix sort without key sort with key
{{nk|0|zero}} <span style="display:none">!F </span> zero zero
{{nk|1|one}} <span style="display:none">!C </span> one one
{{nk|+2}} <span style="display:none">!B9993068528194 </span> +2 +2
{{nk|-3}} <span style="display:none">!J0010986122886 </span> -3 -3
{{nk|-4.01267}} <span style="display:none">!J0013894568551 </span> -4.01267 -4.01267
{{nk|5.125}}&nbsp;amperes <span style="display:none">!B9983658694749 </span> 5.125 amperes 5.125 amperes
{{nk|{{#expr:2*pi}}|2&pi;}} <span style="display:none">!B9981621229335 </span>
{{nk|7|VII}} <span style="display:none">!B9980540898509 </span> VII VII
{{nk|8.27|£}} <span style="display:none">!B9978873654909 </span> £8.27 £8.27
{{nk|-9.000}} <span style="display:none">!J0021972245773 </span> -9.000 -9.000
{{nk|10}} apples <span style="display:none">!B9976974149070 </span> 10 apples 10 apples
{{nk|1776|MDCCLXXVI}} <span style="display:none">!B9925178810764 </span> MDCCLXXVI MDCCLXXVI
{{nk|10,000,000,000}} <span style="display:none">!B9769741490700 </span> 10,000,000,000 10,000,000,000
{{nk|10,000,000,001}} <span style="display:none">!B9769741490699 </span> 10,000,000,001 10,000,000,001
{{nk|12,046,360,889,000|$}} <span style="display:none">!B9698802162706 </span> $12,046,360,889,000 $12,046,360,889,000
{{nk|1e100|googol}} <span style="display:none">!B7697414907005 </span> googol googol
{{nk|-1|minus one}} <span style="display:none">!I </span> minus one minus one
{{nk|0.25|$}} <span style="display:none">!D0013862943611 </span> $0.25 $0.25
{{nk|-0.035}} <span style="display:none">!H9966475927825 </span> -0.035 -0.035
{{nk|-1.4525e-9}}&nbsp;m <span style="display:none">!H9796500203727 </span> -1.4525e-9 m -1.4525e-9 m
{{nk|1e-300|googol<sup>-3</sup>}} <span style="display:none">!D6907755278982 </span> googol-3 googol-3
{{nk|-1e300|-googol<sup>3</sup>}} <span style="display:none">!J6907755278982 </span> -googol3 -googol3
{{nk|1e-301}} <span style="display:none">!E </span> 1e-301 1e-301
{{nk|-1e302}} <span style="display:none">!K </span> -1e302 -1e302
{{nk|-1e-303}} <span style="display:none">!G </span> -1e-303 -1e-303
{{nk|INF|1/0}} <span style="display:none">!A </span> 1/0 1/0
{{nk|IND|0/0}} <span style="display:none">!L </span> 0/0 0/0
{{nk|UND|∞ - ∞}} <span style="display:none">!M </span> ∞ - ∞ ∞ - ∞
{{nk|UNK|x}} <span style="display:none">!N </span> x x
{{nk|NA}} <span style="display:none">!O </span> NA NA
{{nk|not a number|AAA}} AAA AAA
{{nk||ZZZ}} ZZZ ZZZ

See also

This template invokes Template:Numkey2 to create the invisible sort key prefix.