Drawing molecules
In the previous example, we practiced writing molecular formulas. Now, let’s delve into visualizing them. We’ll create a visual representation of a cluster of atoms interconnected by various types of lines.
How to do it...
This seemingly complex task becomes much simpler with the chemfig package developed by Christian Tellechea. It offers a concise syntax for rendering molecular structures. Let’s create a few:
- Start with any document class and load the chemfig package:
\documentclass{article} \usepackage{chemfig}
- Let’s organize molecules in a table. To do this, widen the rows slightly and initiate a tabular environment with a column aligned to the right and another to the left:
\renewcommand{\arraystretch}{1.5} \begin{tabular}{rl}
- For molecules, use the \chemfig command. Represent atoms as letters and depict a single bond using a dash:
Hydrogen: & \chemfig{H-H} \\
- Depict a double bond using an equal...