Skip to content

Chemical Equation

When writing chemical formulas in LATEX, you need to wrap the formula or equation in \ce{}. For example, to write sulfuric acid, you should use \ce{H2SO4}: HA2SOA4.

Inorganic Compounds

  • Integers: Subscripts, charges, oxidation numbers

    \ce{CO2}: COA2, \ce{H+}: HA+, \ce{Cl-}: ClA, \ce{Cu^2+}: CuA2+, etc. For instance, in the case of copper(II) ion, if you don't add ^, it will appear as \ce{Cu2+}: CuA2A+.

    Oxidation numbers are shown like iron(II) \ce{Fe^{II}}: FeAII, and lead(IV) \ce{Pb^{IV}}: PbAIV.

  • Fractional subscripts

    Like regular math expressions in LATEX, you can use fractions, e.g., \ce{Fe(CN)_{\frac62}}: Fe(CN)A62.

  • Parentheses, square brackets, curly braces

    Parentheses: \ce{(NH4)2S}: (NHA4)A2S, square brackets: \ce{[AgCl2]-}: [AgClA2]A, curly braces: \ce{[\{(x2)3\}2]^3+}: [(x2)3A2]A3+.

    Note

    For curly braces, an escape character is needed to display them properly.

  • Superscripts and subscripts: Isotopes, molecular ions

    \ce{^{227}_{90}Th+}: A90227A2902227ThA+, \ce{H^2+}: HA2+.

  • Dots: Radicals, hydrates

    \ce{Cl*}: Cl, \ce{*CH3}: CHA3, \ce{KCr(SO4)2*12H2O}: KCr(SOA4)A212HA2O.

Organic Compounds

  • Chemical Bonds

    Single bond \ce{CH3-CHO}: CHA3CHO, double bond \ce{CH2=CH2}: CHA2=CHA2, triple bond \ce{CH#CH}: CHCH.

    Other bond types include \ce{A\bond{~}B\bond{~-}C}: A---B---C, \ce{A\bond{~--}B\bond{~=}C\bond{-~-}D}: A---B---C---D, \ce{A\bond{...}B\bond{...}C}: ABC.

  • Italicized: cis and trans

    In organic chemistry, the terms cis and trans are written in italics to denote stereoisomers. Since math formulas are italicized in LaTeX, wrap them in $ signs, e.g., $$\ce{$cis${-}CH3CH-CHCH3}$$:

    cis-CHA3CHCHCHA3

Chemical Equations

  • Arrows: Reaction directions

    Different arrow types can be used, such as \ce{->}: , \ce{<=>}: , \ce{<=>>}: , and \ce{<<=>}: .

    You can also add reaction conditions easily.

    • Example:

      $$
      \ce{2H2 + O2 ->[\Delta] H2O}
      $$
      
      $$
      \ce{N2 + H2 ->[{catalyst}][{hightemp}] NH3}
      $$
    • Output:

      2HA2+OA2ΔHA2ONA2+HA2hightempcatalystNHA3
  • Arrows: Precipitate and gas

    \ce{Ca(OH)2 + CO2 = CaCO3 v + H2O}

    Ca(OH)A2+COA2=CaCOA3+HA2O

    \ce{Fe + 2H+ = H2 ^ + Fe^2+}

    Fe+2HA+=HA2+FeA2+

Additional Content

  • Notes below text

    Isomers and allotropes often require annotations beneath the chemical formula, e.g., \underset{\text{glucose}}{\ce{C6H12O6}}:CA6HA12OA6glucose.

  • Multiline reactions

    Use the align environment by adding \begin{align*}...\end{align*}.

    Start each line with & and end with \\.

    • Example:

      $$
      \begin{align*}
      & \ce{CO2 + 3H2 <=> CH3OH + H2O} \\
      & \ce{CO2 + H2 <=> CO + H2O} \\
      & \ce{CO + 2H2 <=> CH3OH} \\
      & \ce{CH3OH <=> CH3OCH3 + H2O}
      \end{align*}
      $$
    • Output:

      COA2+3HA2CHA3OH+HA2OCOA2+HA2CO+HA2OCO+2HA2CHA3OHCHA3OHCHA3OCHA3+HA2O