Template:chemical formula

From Wiktionary, the free dictionary
Jump to navigation Jump to search


This is a template used to format a chemical formula or equation.

Use[edit]

Formula punctuation[edit]

Symbol 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
&nabla; {{chemf|&nabla;}}
( ) ( ) {{chemf|R\sCH(OH)CN}} R−CH(OH)CN

end }-bracket issue [edit]

When 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|..{..} }}
Result: {{chemf|A_{x}H_{1-x}|}}AxH1−x

Formulas, charges, equations[edit]

Formulas (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-}}O2
same as {{chemf|O2(-)}}O2

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+3RCHCO2

Hapticity and mu:

  • {{chemf|W(CO)3(PiPr3)2(\h{2}H2)}}W(CO)3(PiPr3)22-H2)
  • {{chemf|W(CO)3(PiPr3)2(\h{2}H2)|auto=yes}}W(CO)3(PiPr3)22-H2)

Wikilinks[edit]

Whole formula link[edit]

Link the whole formula with |link=<wiki pagename>:

  • {{chemf|FeCl3|link=iron(III) chloride}}FeCl3

Or use wikilink brackets in input like [[ammonia|NH3]]:

  • {{chemf|3[[hydrogen|H2]] + 2[[nitrogen|N2]] <-> 2[[ammonia|NH3]]}}3H2 + 2N2 ⇌ 2NH3

Link each element (C, Hg) and generic element code (R, X)[edit]

Use |auto=yes to link from the first occurrence of each element symbol, and some functional-group symbols such as Ph

  • {{chemf|CH3CH2CH3CBrFCIClCH3|auto=yes}}CH3CH2CH3CBrFCIClCH3