Jump to content

Template:Sort Roman/doc

From Wikipedia, the free encyclopedia

Usage

[edit]

{{Sort Roman}} can be used in sortable tables to sort Roman numerals up to 38 correctly in numerical order. Without the template, IX, XIX, XXIX sort wrong. The template can be used on all Roman numerals up to 38 but only has to be used for IX, XIX, XXIX (9, 19, 29).

Change IX to {{Sort Roman|IX}}
Change XIX to {{Sort Roman|XIX}}
Change XXIX to {{Sort Roman|XXIX}}

The template also works with lowercase numerals like ix, xix, xxix.

There is no option to sort Roman numerals above 38 (more complicated and maybe never needed).

Arabic numerals (normal decimal digits) cannot be mixed with Roman numerals in a sortable column.

Demonstration

[edit]

The source text of this table uses {{Sort Roman}} in the whole third column and three cells of the fourth column.

Decimal number No sort template:
IX, XIX, XXIX sort wrong
{{Sort Roman|...}}
everywhere:
Sorts correctly
Only
{{Sort Roman|IX}}
{{Sort Roman|XIX}}
{{Sort Roman|XXIX}}:
Also sorts correctly
1 I I I
2 II II II
3 III III III
4 IV IV IV
5 V V V
6 VI VI VI
7 VII VII VII
8 VIII VIII VIII
9 IX IX IX
10 X X X
11 XI XI XI
12 XII XII XII
13 XIII XIII XIII
14 XIV XIV XIV
15 XV XV XV
16 XVI XVI XVI
17 XVII XVII XVII
18 XVIII XVIII XVIII
19 XIX XIX XIX
20 XX XX XX
21 XXI XXI XXI
22 XXII XXII XXII
23 XXIII XXIII XXIII
24 XXIV XXIV XXIV
25 XXV XXV XXV
26 XXVI XXVI XXVI
27 XXVII XXVII XXVII
28 XXVIII XXVIII XXVIII
29 XXIX XXIX XXIX
30 XXX XXX XXX
31 XXXI XXXI XXXI
32 XXXII XXXII XXXII
33 XXXIII XXXIII XXXIII
34 XXXIV XXXIV XXXIV
35 XXXV XXXV XXXV
36 XXXVI XXXVI XXXVI
37 XXXVII XXXVII XXXVII
38 XXXVIII XXXVIII XXXVIII

Redirects

[edit]