This site is supported by donations to The OEIS Foundation.

Template:Ord

From OeisWiki
Jump to: navigation, search

The {{ord}} OEIS Wiki formatting and function template gives the proper ordinal suffix as superscript (i.e. st, nd, rd or th) by default or on the baseline (i.e. st, nd, rd or th), for an ordinal number.

Usage

For ordinal suffix as superscript (default), use

{{ord|an integer}}

or

{{ord|an expression evaluating to an integer}}

while for ordinal suffix on the baseline, use (anything other than sup works, though - is recommended)

{{ord|an integer|-}}

or

{{ord|an expression evaluating to an integer|-}}

Valid input

An integer (or an expression evaluating to an integer) as first parameter, sup (default) or - as second parameter.

Examples

Examples with valid input

Code Result
{{ord|-1021}} −1021st
{{ord|-1011}} −1011th
{{ord|-1001}} −1001st
{{ord|-131}} −131st
{{ord|-121}} −121st
{{ord|-113}} −113 th
{{ord|-112}} −112 th
{{ord|-111}} −111th
{{ord|-101}} −101st
{{ord|-91}} −91st
{{ord|-24}} −24th
{{ord|-23}} −23 rd
{{ord|-22}} −22 nd
{{ord|-21}} −21st
{{ord|-20}} −20 th
{{ord|-14}} −14th
{{ord|-13}} −13 th
{{ord|-12}} −12 th
{{ord|-11}} −11th
{{ord|-10}} −10 th
{{ord|-5}} −5 th
{{ord|-4}} −4th
{{ord|-3}} −3 rd
{{ord|-2}} −2 nd
{{ord|-1}} −1st
{{ord|0}} 0 th
{{ord|1}} 1st
{{ord|2}} 2 nd
{{ord|3}} 3 rd
{{ord|4}} 4th
{{ord|5}} 5 th
{{ord|6}} 6 th
{{ord|7}} 7 th
{{ord|8}} 8 th
{{ord|9}} 9 th
{{ord|10}} 10 th
{{ord|11}} 11th
{{ord|12}} 12 th
{{ord|13}} 13 th
{{ord|14}} 14th
{{ord|15}} 15 th
{{ord|16}} 16 th
{{ord|17}} 17 th
{{ord|18}} 18 th
{{ord|19}} 19 th
{{ord|20}} 20 th
{{ord|21}} 21st
{{ord|22}} 22 nd
{{ord|23}} 23 rd
{{ord|24}} 24th
{{ord|91}} 91st
{{ord|101}} 101st
{{ord|111}} 111th
{{ord|112}} 112 th
{{ord|113}} 113 th
{{ord|121}} 121st
{{ord|131}} 131st
{{ord|1001}} 1001st
{{ord|1011}} 1011th
{{ord|1021}} 1021st

If you want the ordinal suffix on the baseline (instead of as superscript), use - as second parameter.

Code Result
{{ord|-5|-}} −5 th
{{ord|-4|-}} −4th
{{ord|-3|-}} −3 rd
{{ord|-2|-}} −2 nd
{{ord|-1|-}} −1st
{{ord|0|-}} 0 th
{{ord|1|-}} 1st
{{ord|2|-}} 2 nd
{{ord|3|-}} 3 rd
{{ord|4|-}} 4th
{{ord|5|-}} 5 th

Examples with expressions evaluating to integers:

{{ord|11^2}}

yields

121st

{{ord|{{Fibonacci|4}}}}

yields

3 rd

Examples with invalid input

Code Result
{{ord|{{math|''j''{{sp|1}}|tex = j|&}}}} Ord error: Argument must be an integer.
{{ord|{{math|''k''{{sp|1}}|tex = k|&}}}} Ord error: Argument must be an integer.
{{ord|{{math|''n''|tex = n|&}}}} Ord error: Argument must be an integer.
{{ord|{{math|(''n'' + 1)|tex = (n + 1)|&}}}} Ord error: Argument must be an integer.
Code Result
{{ord|24.6}} Ord error: Argument must be an integer.
{{ord|third}} Ord error: Argument must be an integer.
{{ord}} Ord error: Argument must be an integer.