Difference between revisions of "Template:Format ionic substance"
Jump to navigation
Jump to search
imported>Renamed user awfwvowjvwrvnwio |
imported>Renamed user awfwvowjvwrvnwio (Fixed incorrect swapping of ion quantities in ionic substance formula.) |
||
| Line 1: | Line 1: | ||
| − | {{#ifeq:{{#ifeq:{{{1|}}}||1|{{#ifeq:{{{2|}}}||1|{{#ifeq:{{{3|}}}||1|{{#ifeq:{{{4|}}}||1|0}}}}}}}}|1|<span class="error">Requires 4 unnamed parameters.</span>|{{#ifeq:{{{5|nocharges}}}|displaycharges|{{#ifeq:{{#invoke:String|replace|{{{2}}}|+|}}|{{#invoke:String|replace|{{{4}}}|-|}}|{{Format ion formula|{{{1}}}|{{{2}}}}}({{Format ion formula|{{{3}}}|{{{4}}}}})|({{Format ion formula|{{{1}}}|{{{2}}}}})<sub>{{#invoke:String|replace|{{#expr:{{#invoke:String|replace|{{{ | + | {{#ifeq:{{#ifeq:{{{1|}}}||1|{{#ifeq:{{{2|}}}||1|{{#ifeq:{{{3|}}}||1|{{#ifeq:{{{4|}}}||1|0}}}}}}}}|1|<span class="error">Requires 4 unnamed parameters.</span>|{{#ifeq:{{{5|nocharges}}}|displaycharges|{{#ifeq:{{#invoke:String|replace|{{{2}}}|+|}}|{{#invoke:String|replace|{{{4}}}|-|}}|{{Format ion formula|{{{1}}}|{{{2}}}}}({{Format ion formula|{{{3}}}|{{{4}}}}})|({{Format ion formula|{{{1}}}|{{{2}}}}})<sub>{{#invoke:String|replace|{{#expr:{{#invoke:String|replace|{{{4}}}|-|}} / {{#invoke:Math|gcd|{{#invoke:String|replace|{{{2}}}|+|}}|{{#invoke:String|replace|{{{4}}}|-|}}}}}}|,|}}</sub>({{Format ion formula|{{{3}}}|{{{4}}}}})<sub>{{#invoke:String|replace|{{#expr:{{#invoke:String|replace|{{{2}}}|+|}} / {{#invoke:Math|gcd|{{#invoke:String|replace|{{{2}}}|+|}}|{{#invoke:String|replace|{{{4}}}|-|}}}}}}|,|}}</sub>}}|Not implemented yet.}}}}<noinclude> |
{{Documentation}}</noinclude> | {{Documentation}}</noinclude> | ||
Latest revision as of 19:43, 19 October 2015
Requires 4 unnamed parameters.
| This template employs intricate features of template syntax.
You are encouraged to familiarise yourself with its setup and parser functions before editing the template. If your edit causes unexpected problems, please undo it quickly, as this template may appear on a large number of pages. You can conduct experiments, and should test all major changes, in either this template's sandbox, the general template sandbox, or your user space before changing anything here. |
Usage
{{Format ionic substance|first_formula|first_charge|second_formula|second_charge}},
where first_formula and second_formula are the chemical formulae (as given to Template:Format molecular formula) of the ions (positive and negative, respectively), and first_charge and second_charge are their respective charges.
Examples
[[Sodium chloride|{{Format ionic substance|Na|+|Cl|-|displaycharges}}]]
Result: Na+(Cl-)
{{Format ionic substance|Al|3+|SO4|2-|displaycharges}}
Result: (Al3+)2(SO42-)3
| The above documentation is transcluded from Template:Format ionic substance/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |