Template:chemical formula
- The following documentation is located at Template:chemical formula/documentation. [edit]
- Useful links: subpage list • links • redirects • transclusions • errors (parser/module) • sandbox
![]() | Uses Lua: |
This is a template used to format a chemical formula or equation.
Use
editFormula punctuation
editSymbol | Gives | Example | Output |
---|---|---|---|
\s |
− | {{chemf|CH3\sCH3}} |
CH3−CH3 |
\d |
= | {{chemf|CH2\dCH2}} |
CH2=CH2 |
\t |
≡ | {{chemf|HC\tCH}} |
HC≡CH |
\q |
≣ | {{chemf|[Cl4Re\qReCl4](2−)}} |
[Cl4Re≣ReCl4]2− |
\- |
- | {{chemf|A\-B}} |
A-B |
\\ |
\ | {{chemf|C\\D}} |
C\D |
\h |
η | {{chemf|\h}} |
η |
\h{1} |
η1- | {{chemf|\h{1} |}} |
η1- |
\m{1} |
μ1- | {{chemf|\m{1} |}} |
μ1- |
-> |
→ | {{chemf|2H2 + O2 -> 2H2O}} |
2H2 + O2 → 2H2O |
<-> |
⇌ | {{chemf|K<->L}} |
K ⇌ L |
* |
· | {{chemf|CoCl2*6H2O}} |
CoCl2·6H2O |
\* |
* | {{chemf|Cp\*2Fe}} |
Cp*2Fe |
_{} |
subscript | {{chemf|C_{''n''}H_{2''n''+2}} } |
CnH2n+2 |
^{} |
superscript | {{chemf|^{13}CH4}} |
13CH4 |
∇ |
∇ | {{chemf|∇}} |
∇ |
( ) |
( ) | {{chemf|R\sCH(OH)CN}} |
R−CH(OH)CN |
end }-bracket issue
editWhen input ends correctly with a }-bracket, like with A_{x}H_{1-x}
, the final }-brackets are technically mixed up:
{{chemf|A_{x}H_{1-x}}}
→ AxH_{−1x}
The closing bracket {..}
of input and end of template brackets }}
.
- Solutions:
- add empty pipe:
{{chemf|..{..}|}}
(empty parameter #2) - add parameters numbers 1 and 2 (empty):
{{chemf|1=..{..}|2=}}
- add a space:
{{chemf|..{..} }}
- add empty pipe:
- Result:
{{chemf|A_{x}H_{1-x}|}}
→ AxH1−x
Formulas, charges, equations
editFormulas (without charge) are just written:
{{chemf|CH3(CH2)5CH3}}
→ CH3(CH2)5CH3{{chemf|Fe3S2(CO)9}}
→ Fe3S2(CO)9{{chemf|C_{''n''}H_{2''n''+2}|}}
→ CnH2n+2
Charges are written inside parentheses:
{{chemf|SO4(2-)}}
→ SO2−4{{chemf|S19(2+)}}
→ S2+19
Charges +1 and −1 can be written plain:
{{chemf|Na+}}
→ Na+{{chemf|O2-}}
→ O−2
- same as
{{chemf|O2(-)}}
→ O−2
Chemical equations:
{{chemf|2 S + 3 O2 + 2 H2O -> 2 H2SO4}}
→ 2 S + 3 O2 + 2 H2O → 2 H2SO4{{chemf|2S + 3O2 + 2H2O -> 2H2SO4}}
→ 2S + 3O2 + 2H2O → 2H2SO4
The arrows can be written as ->
or just →
. All characters (and unicode markup) are valid input except \
, = (Mediawiki use it), _
and -
(endash etc.)
{{chemf|2 H2(g) + O2(g) -> 2H2O(g)|}}
→ 2 H2(g) + O2(g) → 2H2O(g){{chemf|NH2RCHCO2H <-> NH3+RCHCO2-}}
→ NH2RCHCO2H ⇌ NH+3RCHCO−2
Hapticity and mu:
{{chemf|W(CO)3(PiPr3)2(\h{2}H2)}}
→ W(CO)3(PiPr3)2(η2-H2){{chemf|W(CO)3(PiPr3)2(\h{2}H2)|auto=yes}}
→ W(CO)3(PiPr3)2(η2-H2)
Wikilinks
editWhole formula link
editLink the whole formula with |link=<wiki pagename>
:
{{chemf|FeCl3|link=iron(III) chloride}}
→ FeCl3
Or use wikilink brackets in input like [[ammonia|NH3]]
:
Link each element (C, Hg) and generic element code (R, X)
editUse |auto=yes
to link from the first occurrence of each element symbol, and some functional-group symbols such as Ph