Jump to content

Template:Chem2/doc

From Simple English Wikipedia, the free encyclopedia

{{chem2}} is a template used to format a chemical formula or equation.

Formula punctuation

[change source]
Symbol Gives Example Output
\s {{chem2|CH3\sCH3}} CH
3
–CH
3
\d = {{chem2|CH2\dCH2}} CH
2
=CH
2
\t {{chem2|HC\tCH}} HC≡CH
\q {{chem2|[Cl4Re\qReCl4](2−)}} [Cl
4
Re≣ReCl
4
]2−
\- - {{chem2|A\-B}} A-B
\\ \ {{chem2|C\\D}} C\D
\h η {{chem2|\h}} η
\h{1} η1 {{chem2|\h{1} |}} § {} η1
\m{1} μ1 {{chem2|\m{1} |}} μ1
-> {{chem2|2H2 + O2 -> 2H2O}} § {} 2H
2
+ O
2
→ 2H
2
O
<-> {{chem2|K<->L}} K ⇌ L
*  · {{chem2|CoCl2*6H2O}} CoCl
2
 · 6H2O
\* * {{chem2|Cp\*2Fe}} Cp*
2
Fe
_{} subscript {{chem2|C_{''n''}H_{2''n''+2} }} § {} C
n
H
2n+2
^{} superscript {{chem2|^{13}CH4}} 13
CH
4
&nabla; {{chem2|&nabla;}}
( ) ( ) {{chem2|R\sCH(OH)CN}} R–CH(OH)CN

end }-bracket issue

[change source]

When input ends correctly with a }-bracket, like with A_{x}H_{1-x}, the final }-brackets are technically mixed up:

{{chem2|A_{x}H_{1-x}}} → A
x
H_{
1
x} Red XN

The closing bracket } of input and end of template brackets }} are interpreted by Wikipedia software in reversed order.

  • Solutions:
add empty pipe: {{chem2|...{...}|}} (empty parameter #2)
add parameters numbers 1 and 2 (empty): {{chem2|1=...{...}|2=}}
add a space: {{chem2|...{...} }}
Result: {{chem2|A_{x}H_{1-x}|}} → A
x
H
1-x
Green tickY

Formulas, charges, equations

[change source]

Formulas (without charge) are just written:

  • {{chem2|CH3(CH2)5CH3}} → CH
    3
    (CH
    2
    )
    5
    CH
    3
  • {{chem2|Fe3S2(CO)9}} → Fe
    3
    S
    2
    (CO)
    9
  • {{chem2|C_{''n''}H_{2''n''+2}|}} → C
    n
    H
    2n+2

Charges are written inside parentheses:

  • {{chem2|SO4(2-)}} → SO2−
    4
  • {{chem2|S19(2+)}} → S2+
    19

Charges +1 and −1 can be written plain:

  • {{chem2|Na+}} → Na+
  • {{chem2|O2-}} → O
    2
same as {{chem2|O2(-)}} → O
2

Chemical equations:

  • {{chem2|2 S + 3 O2 + 2 H2O -> 2 H2SO4}} → 2 S + 3 O
    2
    + 2 H
    2
    O → 2 H
    2
    SO
    4
  • {{chem2|2S + 3O2 + 2H2O -> 2H2SO4}} → 2S + 3O
    2
    + 2H
    2
    O → 2H
    2
    SO
    4

The arrows can be written as -> or just . All characters (and unicode markup) are valid input except \, = (Mediawiki use it), _ and - (endash etc.)

  • {{chem2|2 H2(g) + O2(g) -> 2H2O(g)|}} → 2 H
    2
    (g) + O
    2
    (g) → 2H
    2
    O(g)
  • {{chem2|NH2RCHCO2H <-> NH3+RCHCO2-}} → NH
    2
    RCHCO
    2
    H ⇌ NH+
    3
    RCHCO
    2

Hapticity and mu:

  • {{chem2|W(CO)3(PiPr3)2(\h{2}H2)}} → W(CO)
    3
    (PiPr
    3
    )
    2
    2−H
    2
    )
  • {{chem2|W(CO)3(PiPr3)2(\h{2}H2)|auto=yes}}W(CO)
    3
    (PiPr
    3
    )
    2
    (η2H
    2
    )
[change source]

As of March 2023, {{chem2}} should not be used inside wikilinks; this can cause erratic failures to properly render sub/superscripts in other invocations on the same page. Instead, use the following options.

[change source]

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

  • {{chem2|FeCl3|link=Iron(III) chloride}}FeCl
    3

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

  • {{chem2|3[[hydrogen|H2]] + 2[[nitrogen|N2]] <-> 2[[ammonia|NH3]]}} → 3H
    2
    + 2N
    2
    <
    > 2NH
    3
[change source]

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

  • {{chem2|CH3CH2CH3CBrFCIClCH3|auto=yes}}CH
    3
    CH
    2
    CH
    3
    CBrFCIClCH
    3
[change source]

Some common groups are recognized and linked if you wikilink them using [[ ]]

  • {{chem2|R\-[[COOH]]}} → R-COOH
  • {{chem2|[[CH3]]C[[R]]2[[I]]}} → [[CH
    3
    ]]CR
    2
    I
  • In particular H2O links to water of crystallization in {{chem2|CuSO4 * 5 [[H2O]]}} → CuSO
    4
     · 5 [[H
    2
    O]], because a link to water is generally unnecessary.

You can link to any article even if chem2 is unaware of it:

  • {{chem2|[[C6H5NH2]]}} → [[C
    6
    H
    5
    NH
    2
    ]]

To change the default link:

  • {{chem2|[[water|H2O]]}}H
    2
    O

All recognised symbols and codes

[change source]
All link targets recognised by {{chem2}} (elements, general codes, functional groups)

Script error: The function "_autodoc" does not exist.

Examples and tests

[change source]

(The first "→" in each example is not part of the output; it separates the example from its output.)

  • {{chem2|[Cl4Re\qReCl4](2-)|}} → [Cl
    4
    Re≣ReCl
    4
    ]2−
  • {{chem2|NH2RCHCO2H <-> NH3+RCHCO2−}} → NH
    2
    RCHCO
    2
    H ⇌ NH+
    3
    RCHCO
    2

  • {{chem2|\\hallo}} → \hallo
  • {{chem2|H3CC\tCH <-> H2C\dC\dCH2}} → H
    3
    CC≡CH ⇌ H
    2
    C=C=CH
    2
  • {{chem2|4 NH3 + 5 O2 -> 4 NO + 6 H2O}} → 4 NH
    3
    + 5 O
    2
    → 4 NO + 6 H
    2
    O

  • {{chem2|H2O &#8594; H2O}} → H
    2
    O → H
    2
    O
  • {{chem2|H2O(l) -> H2O(g)}} → H
    2
    O(l) → H
    2
    O(g)

  • {{chem2|4 NH3 + 5 O2 → 4 NO + 6 H2O}} → 4 NH
    3
    + 5 O
    2
    → 4 NO + 6 H
    2
    O
  • {{chem2|4NH3 + 5O2 → 4NO + 6H2O}} → 4NH
    3
    + 5O
    2
    → 4NO + 6H
    2
    O
  • {{chem2|2Mn2(+)}} → 2Mn+
    2
  • {{chem2|2Mn2(+) + 3H2O}} → 2Mn+
    2
    + 3H
    2
    O
  • {{chem2|Mn–}} → Mn

  • {{chem2|Mn2(2-)}} → Mn2−
    2
  • {{chem2|Mn2☃+}} → Mn
    2
    +
    ;
  • {{chem2|Mn2(2☃–)}} → Mn
    2
    (
    2

    )
  • {{chem2|Mn2(+)}} → Mn+
    2
  • {{chem2|Mn2+}} → Mn+
    2
  • {{chem2|Mn2(-)}} → Mn
    2
  • {{chem2|Mn2-}} → Mn
    2

  • Lua error in Module:Demo at line 40: bad argument #2 to 'format' (no value).
  • (chem: Lua error in Module:Demo at line 40: bad argument #2 to 'format' (no value).
  • {{chem2|C_{abc}|}} → C
    abc
  • {{chem2|CoCl2*1.5H2O}} → CoCl
    2
     · 1.5H2O
  • {{chem2|Cu2C2*H2O}} → Cu
    2
    C
    2
     · H2O

Special

  • {{chem2|[Me2Al(\m{2}Me)]2}} → [Me
    2
    Al(μ2−Me)]
    2
  • {{chem2|^{13}CO2}}13
    CO
    2
  • {{chem2|^{13}CO2|auto=yes}}13
    CO
    2
  • {{chem2|\h{5}(C5H5)2TiCl2}} → η5−(C
    5
    H
    5
    )
    2
    TiCl
    2
  • (bad) {{chem2|\h{5}\s(C5H5)2TiCl2}} → η5−–(C
    5
    H
    5
    )
    2
    TiCl
    2
  • {{chem2|CH2\dCH2\sCH2\sC\tCH\qMn}} → CH
    2
    =CH
    2
    –CH
    2
    –C≡CH≣Mn

  • {{chem2|RC(OR')3}} → RC(OR')
    3
  • {{chem2|C\\C}} → C\C
  • {{chem2|C2*NH3}} → C
    2
     · NH
    3
  • {{chem2|C2*2NH3}} → C
    2
     · 2NH
    3
  • {{chem2|C1.2H3.5}} → C
    1.2
    H
    3.5

  • {{chem2|\b\bAbC\e\e}} → AbC
  • {{chem2|C2(μ\-C)}} → C
    2
    (μ-C)

  • {{chem2|SO4(2-)}} → SO2−
    4
  • {{chem2|2Mn2(2+)}} → 2Mn2+
    2
  • {{chem2|CH3-CH2-OH}} → CH
    3
    CH
    2
    OH
  • {{chem2|[ZnCl4]-}} → [ZnCl
    4
    ]
  • {{chem2|[ZnCl4](2-)}} → [ZnCl
    4
    ]2−
  • {{chem2|((H2O)5{CoCl2})2|auto=yes}} → ((H
    2
    O)
    5
    {CoCl
    2
    })
    2
  • {{chem2|Si(OH)4}} → Si(OH)
    4

  • {{chem2|Cu2C2*H2O|auto=yes}}Cu
    2
    C
    2
     · H2O
  • {{chem2|Cu2C2*2H2O}} → Cu
    2
    C
    2
     · 2H2O
  • {{chem2|CuSO*2H2O}} → CuSO · 2H2O
  • {{chem2|CuSO4*15H2O}} → CuSO
    4
     · 15H2O
  • {{chem2|CuSO4(H2O)5}} → CuSO
    4
    (H
    2
    O)
    5
  • {{chem2|H+ + OH- → H2O}} → H+
    + OH
    → H
    2
    O
  • {{chem2|H → O}} → H → O

  • {{chem2|ZxPo4}} → ZxPo
    4
        Unknown element.
  • {{chem2|((Na)Cl}} → ((Na)Cl     Too many "(".
  • {{chem2|Si(OH))4}} → Si(OH))
    4
        Too many ")".
  • {{chem2|Si&[[☃]]Si}} → Si&Si
  • {{chem2|1=CH2=CH2}} → CH
    2
    =CH
    2
  • {{chem2|Cl2O6|link=dichlorine hexoxide}}Cl
    2
    O
    6
  • {{chem2|[Fe(Phen)(Phen)3](2+)}} → [Fe(Phen)(Phen)
    3
    ]2+
  • {{chem2|[Fe(Phen)(Phen)3](2+)|auto=yes}} → [[[Iron|Fe]](Phen)(Phen)
    3
    ]2+
  • {{chem2|[C2O2](2+)}} → [C
    2
    O
    2
    ]2+
  • {{chem2|SI4|link=Tomato}}SI
    4
  • {{chem2|H2SO4+}} → H
    2
    SO+
    4
  • {{chem2|Mn-}} → Mn
  • {{chem2|Mn22+}} → Mn+
    22
    , {{chem2|Mn22-}} → Mn
    22
  • {{chem2|Mn(2+)}} → Mn2+
  • {{chem2|Mn2(+)}} → Mn+
    2
  • {{chem2|Mn(22-)}} → Mn22−
  • {{chem2|Mn3(22-)}} → Mn22−
    3
  • {{chem2|Mn(22+)}} → Mn22+
  • {{chem2|Mn2(22+)}} → Mn22+
    2
  • {{chem2|Mn2(2+)}} → Mn2+
    2
  • {{chem2|Mn22(2+)}} → Mn2+
    22

Chem vs chem2

[change source]
  • {{chem|(CH|3|)|2|CO}}(CH
    3
    )
    2
    CO
  • {{chem2|(CH3)2CO}} → (CH
    3
    )
    2
    CO
  • {{chem|H|2|+}}H+
    2
  • {{chem2|H2+}} → H+
    2

Predefined codes (groups etc.)

[change source]
Predefined codes
code target article {{chem2|code}} type note
A. Groups etc with element-like names

Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row

B. Groups which are redirected from their normal target if wikilinked; never autolinked.

Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row Template:Chem2/doc/row

TemplateData

[change source]
This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Chem2 in articles based on its TemplateData.

TemplateData for Chem2

No description.

Template parameters

ParameterDescriptionTypeStatus
11

no description

Unknownoptional
autoauto

no description

Unknownoptional
linklink

no description

Unknownoptional

Tracking

[change source]

See also

[change source]