% Drawing molecules
% Author: Stefan Kottwitz
% https://www.packtpub.com/hardware-and-creative/latex-cookbook
\documentclass[border=10pt]{standalone} 
%%%<
\usepackage{verbatim}
%%%>
\begin{comment}
:Title: Drawing molecules
:Tags: Chemistry;Graphics;TikZ;chemfig;Chapter11
:Author: Stefan Kottwitz
:Slug: molecules

In http://latex-cookbook.net/cookbook/examples/chemistry/
we already encountered formulae for molecules. Now we like to see
how to draw them. This means drawing a group of atoms
and connecting them by lines of various kinds.

This rather complex seeming task becomes manageable using the
chemfig package. It provides a compact syntax for drawing molecules.

The chemfig package internally uses TikZ for drawing. It automatically
takes care of the bounding box, so the drawing would not overlap other
text. Advanced users could even insert TikZ code.

The main command is \chemfig, it takes an argument consisting of

- letters for atoms

- symbols for bonds, such as -, -, and ~ for simple, double and triple bonds

- options in square brackets, separated by comma

- branches of atoms and bonds within parentheses

The code is fully explained in the LaTeX Cookbook, Chapter 11,
Science and Technology, Drawing molecules.
\end{comment}
\usepackage{chemfig}
\begin{document}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{rl}
  Hydrogen: & \chemfig{H-H} \\
  Oxygen:   & \chemfig{O=O} \\
  Ethyne:   & \chemfig{H-C~C-H}
\end{tabular}
\qquad
Methane: \chemfig{[,0.8]C(-[2]H)(-[4]H)(-[6]H)-H}
\end{document}

