Template:Molecular formula Hill key/doc
Appearance
This is a documentation subpage for Template:Molecular formula Hill key. It may contain usage information, categories and other content that is not part of the original template page. |
Generates a string version of the molecular formula suitable for sorting in Hill order. Every element that is present is given a fixed-width zero-padded field for the number of atoms present (currently field-width=5, based on largest formula in Category:Set index articles on molecular formulas). It can thus be used as a hidden key in a sortable table (see Help:Sortable tables#Specifying a sort key for a cell).
Usage
[edit]Syntax | Result | Dev-notes |
---|---|---|
{{Molecular formula Hill key|C=1|H=1|B=1}}
| C00001H00001B00001 |
verifying Hill order |
{{Molecular formula Hill key|C=1|B=1}}
| C00001B00001 |
verifying Hill order |
{{Molecular formula Hill key|H=1|B=1}}
| B00001H00001 |
verifying Hill order |
{{Molecular formula Hill key|C=1|H=5|N=5}}
| C00001H00005N00005 |
|
{{Molecular formula Hill key|C=1.5|H=1.05}}
| C001.5H01.05 |
TODO: handle non-integers |
{{Molecular formula Hill key|C=1|H=5|N=5|charge=-}}
| C00001H00005N00005− |
TODO: specify as 1 |
{{Molecular formula Hill key|C=1|H=5|N=5|charge=5}}
| C00001H00005N000055 |
TODO: specify as + |
{{Molecular formula Hill key|C=1|H=5|N=5|charge=+4}}
| C00001H00005N00005+4 |
TODO: zero-pad |
{{Molecular formula Hill key|C=1|H=5|N=5|charge=4+}}
| C00001H00005N000054+ |
TODO: canonical to charge-symbol first |