\section{A few examples} \label{sec:example} The following is a \smiles representation of caffeine, contained in the file \texttt{caffeine.smi}: \lstinputlisting{caffeine.smi} We can turn this into \chf code with the following command:% % \footnote{The examples in this document assume that you have installed the local version of \mcf. If you installed the web client version, you must use \lstinline!mol2chemfig.lua! wherever the listed example commands use \lstinline!mol2chemfig!.} \lstinputlisting{caffeine-from-smiles.sh} This writes the following \chf code to the target file: \lstinputlisting{caffeine-smi.tex} If we load this file with \lstinline!\input{caffeine-smi.tex}!, we get the following result% % \footnote{The appearance of the chemical formulas in this document has been tweaked using some settings that are provided by the \texttt{chemfig} package. The settings used here are listed in Section \ref{sec:ChemfigSettings}.} \cfpic{caffeine-smi.tex} which is almost what we want. We adjust the rotation of the molecule and also tweak its appearance a little: \lstinputlisting{caffeine-from-smiles-rotated.sh} With these modifications, the structure looks as follows: \cfpic{caffeine-smi2.tex} Small molecules like caffeine are fairly easy to create with \chf alone. Hand-written \chf code will look cleaner and more concise than the code generated by \mcf. For example, here is the hand-coded \chf version for caffeine that will produce the exact same graphic as the last \mcf command: \lstinputlisting{hand-coded-tex/caffeine} % In particular, the syntax for specifying rings and ring substituents in \chf is remarkably powerful and elegant. With a little practice, molecules such as this one can be hand-written with little effort, and I sincerely recommend that you learn this skill. However, if you need to depict many small molecules, or fairly large ones, a tool like \mcf will come in handy. Take, for example, the lipopeptide antibiotic daptomycin, which we in this case load from a molfile: \lstinputlisting{daptomycin1.sh} \cfpic{daptomycin} This molecule might take a little longer to code by hand \ldots