chemfig: Chemistry in WordPress

I just learned about adding chemical graphics in wordpress using the QuickLaTeX plugin and the chemfig package (links: QuickLaTeX, chemfig and chemfig).

Here is my first attempt, starting with something simple: molecular hydrogen.

 \begin{verbatim} \chemfig{H-H} \end{verbatim}

This code gives:
  \chemfig{H-H}

And now for a double bond: molecular oxygen.

 \begin{verbatim} \chemfig{O=O} \end{verbatim}

  \chemfig{O=O}

Putting these together we get water.

 \begin{verbatim} \chemfig{H-O-H} \end{verbatim}

  \chemfig{H-O-H}

However a water molecule actually has an angle of about 104.5 degrees. The angle below is raised 75.5 degrees because it would normally be 180 degrees between the hydrogens, .

 \begin{verbatim} \chemfig{H-O-[:+75.5]H} \end{verbatim}

  \chemfig{H-O-[:+75.5]H}

The oxygen has a higher affinity for electrons (is highly electronegative) and develops a negative charge while the electrons pulled away from the hydrogen give them positive charges from the proton nucleus.

 \begin{verbatim} \chemfig{H^+-O^{-}-[:+75.5]H^+} \end{verbatim}

  \chemfig{H^+-O^{-}-[:+75.5]H^+}

These charges result in hydrogen bonds between water molecules, which allows water to be a solid and a liquid at higher temperatures than is usual for a molecule of its size.  This also is responsible for the expansion of ice compared to the liquid form (the molecules take up more space to arrange themselves with optimal hydrogen bonding).

 \begin{verbatim} \chemfig{H^+-O^{-}-[:+75.5]H^+-[::+0,,,,dash pattern=on 2pt off 2pt]O^{-}(-[:+104.5]H^+)-H^+} \end{verbatim}

  \chemfig{H^+-O^{-}-[:+75.5]H^+-[::+0,,,,dash pattern=on 2pt off 2pt]O^{-}(-[:+104.5]H^+)-H^+}

And here is an actual reaction (the bond angles in the water come from :

 \begin{verbatim} \chemname{\chemfig{O=O}}{Oxygen} \chemsign{+} 2 \chemname{\chemfig{H-H}}{Hydrogen} \chemrel{->} 2 \chemname{\chemfig{H^+-[:-37.75]O^{-}-[:+37.75]H^+}}{Water} \end{verbatim}

  \chemname{\chemfig{O=O}}{Oxygen} \chemsign{+} 2 \chemname{\chemfig{H-H}}{Hydrogen} \chemrel{->} 2 \chemname{\chemfig{H^+-[:-37.75]O^{-}-[:+37.75]H^+}}{Water}

Switching gears with carbon, here is methane.

 \begin{verbatim} \chemfig{C(-[:0]H)(-[:90]H)(-[:180]H)(-[:270]H)} \end{verbatim}

  \chemfig{C(-[:0]H)(-[:90]H)(-[:180]H)(-[:270]H)}

Actually methane is organized into a tetrahedron with approximately 109.5 degree angles between the hydrogen atoms (, , ). Projecting above and below the plane of the image can be indicated with Cram-style bonds.

 \begin{verbatim} \chemfig{C(-[:90]H)(<:[:-9.75]H)(<[:-29.25]H)(-[:199.5]H)} \end{verbatim}

  \chemfig{C(-[:90]H)(<:[:-9.75]H)(<[:-29.25]H)(-[:199.5]H)}

Now for cyclic hydrocarbons! Benzene is:

 \begin{verbatim} \chemfig{C*6((-H)-C(-H)=C(-H)-C(-H)=C(-H)-C(-H)=)} \end{verbatim}

  \chemfig{C*6((-H)-C(-H)=C(-H)-C(-H)=C(-H)-C(-H)=)}

And as is typically done for hydrocarbons, we can leave out the hydrogen atoms and just show the carbon backbone:

 \begin{verbatim} \chemfig{*6(=-=-=-)} \end{verbatim}

  \chemfig{*6(=-=-=-)}

Finally, the delocalized pi-bonds can be illustrated as a ring which better reflects the aromatic p molecular orbitals (these give benzene and similar aromatic hydrocarbons enhanced molecular stability):

 \begin{verbatim} \chemfig{**6(------)} \end{verbatim}

  \chemfig{**6(------)}

Glucose! (the most common form at least) I actually had help on this one; I started to put it together than found it already assembled in Section 11.3.4 P. 37 of the ChemFig Documentation.  I just modified it slightly:

 \begin{verbatim} \setcrambond{2pt}{}{} \chemname{\chemfig{HO-[2,0.5,2]?<[7,0.7](-[2,0.5]OH)-[,,,, line width=4pt](-[6,0.5]OH)>[1,0.7](-[6,0.5]OH)-[3,0.7]O-[4]?(-[2,0.3]-[3,0.5]OH)}}{$\alpha$-D-Glucopyranose} \end{verbatim}

  \setcrambond{2pt}{}{} \chemname{\chemfig{HO-[2,0.5,2]?<[7,0.7](-[2,0.5]OH)-[,,,, line width=4pt](-[6,0.5]OH)>[1,0.7](-[6,0.5]OH)-[3,0.7]O-[4]?(-[2,0.3]-[3,0.5]OH)}}{$\alpha$-D-Glucopyranose}

Finally, let me have a shot (double entendre) at putting together caffeine.  First the hydrocarbon shorthand:

 \begin{verbatim} \chemname{\chemfig{*6(-N(-)-(=O)-N(-)-(=O)-(*5(-N(-)-=N-=)))}}{Caffeine} \end{verbatim}

  \chemname{\chemfig{*6(-N(-)-(=O)-N(-)-(=O)-(*5(-N(-)-=N-=)))}}{Caffeine}

Then the full version with all the atoms labeled:

 \begin{verbatim} \chemname{\chemfig{*6(C-N(-C(<:[:-9.75]H)(<[:-29.25]H)(-[:199.5]H))-C(=O)-N  (-C(<:[:+129.75]H)(<[:100]H)(-[:-40.5]H))-C(=O)-C(*5(-N(-C(<:[:+180]H)  (<[:+170]H)(-[:-307.5]H))-C(-H)=N-C=C)))}}{Caffeine} \end{verbatim}

  \chemname{\chemfig{*6(C-N(-C(<:[:-9.75]H)(<[:-29.25]H)(-[:199.5]H))-C(=O)-N(-C(<:[:+129.75]H)(<[:100]H)(-[:-40.5]H))-C(=O)-C(*5(-N(-C(<:[:+180]H)(<[:+170]H)(-[:-307.5]H))-C(-H)=N-C=C)))}}{Caffeine}

Leave a Reply

Your email address will not be published. Required fields are marked *