Chemistry LaTeX has been added to CHF

Oct 2019
5
4
Washington
Chemistry LaTeX has been added to CHF.

In addition to math formulas, chemistry inputs will also work when entering them into LaTeX.

Math Equations

For example, here is the Quadratic Formula:
Code:
[MATH]x = {-b \pm \sqrt{b^2-4ac} \over 2a}[/MATH]
\(\displaystyle x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)


Chemistry Formulas

And some chemistry formulas:
Code:
[MATH]
\ce{C6H5-CHO}
\ce{$A$ ->[\ce{+H2O}] $B$}
\ce{SO4^2- + Ba^2+ -> BaSO4 v}
[/MATH]
\(\displaystyle \ce{C6H5-CHO}
\ce{$A$ ->[\ce{+H2O}] $B$}
\ce{SO4^2- + Ba^2+ -> BaSO4 v}\)


Using \ce for Chemistry Equations

Here are some examples showing this:
Code:
[MATH]\ce{Na2SO4 ->[H2O] Na+ + SO4^2-}[/MATH]

[MATH]\ce{(2Na+,SO4^2-) + (Ba^2+, 2Cl- ) -> BaSO4 v + 2NaCl}[/MATH]

[MATH]\ce{2LiOH_{(s)} + CO_{2(g)} -> Li_{2}CO_{3(s)}+ H_{2}O_{(g)}}[/MATH]
\(\displaystyle \ce{Na2SO4 ->[H2O] Na+ + SO4^2-}\)

\(\displaystyle \ce{(2Na+,SO4^2-) + (Ba^2+, 2Cl- ) -> BaSO4 v + 2NaCl}\)

\(\displaystyle \ce{2LiOH_{(s)} + CO_{2(g)} -> Li_{2}CO_{3(s)}+ H_{2}O_{(g)}}\)


Using \cf for Chemistry Equations

For those who prefer:
Code:
[MATH]\cf{ A + B -> C + D }[/MATH]
\(\displaystyle \cf{ A + B -> C + D }\)


Using Arrows

You could use \rightarrow instead of ->
Code:
[MATH]\ce{2LiOH_{(s)} + CO_{2(g)} {\rightarrow} Li_{2}CO_{3(s)}+ H_{2}O_{(g)}}[/MATH]
\(\displaystyle \ce{2LiOH_{(s)} + CO_{2(g)} {\rightarrow} Li_{2}CO_{3(s)}+ H_{2}O_{(g)}}\)


Package Numbers in Chemical Formulas

Package numbers in chemical formulas are assumed to be subscripts, to save some typing:
Code:
[MATH]\ce{2LiOH_{(s)} +CO2_{(g)} -> Li2CO3_{(s)} +H2O_{(g)}}[/MATH]
\(\displaystyle \ce{2LiOH_{(s)} +CO2_{(g)} -> Li2CO3_{(s)} +H2O_{(g)}}\)
 
  • Like
Reactions: topsquark