close
Sayahna Sayahna
Search

Difference between revisions of "Template:Nk"


(Fix $)
 
m (1 revision)
 
(No difference)

Latest revision as of 04:18, 22 March 2014

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