\len=4 \newcommand{\ri}{No action is taken for any other value of the argument} \chapter{The complete system of macros---its design and its use} \label{ch:macros} \section{General design criteria} \LaTeX\ code can be written to typeset a structure diagram for any chemical compound in such a way that the diagram conforms to accepted practices in chemistry publications. The purpose of the macros in this thesis is to reduce the amount of low-level, bond-by-bond coding necessary to typeset a particular structure. The problem of designing a generally useful system of macros for this purpose has to be seen in the context of the large number of possible structures: More than 7~million chemical compounds are registered with the Chemical Abstracts Service, including 60,000 different ring systems, and innumerable additional structures are possible. The fragments to be typeset by the macros in this thesis were selected such that they could be helpful in producing the more common types of structures. The arguments of each macro in turn were selected with the goal of making the respective fragment as flexible as possible, such that the more common known structures of this type can be typeset by a particular macro. The selection criteria were informal, using the ``expert knowledge'' of the writer. Where a related approach to displaying chemical structure diagrams was taken in previous work, a similar selection of fragments was made (Zimmerman~84)(Bendall~80,85). Both authors are chemists and present a collection of fragments without any attempt to justify their choices. For more flexibility, the user of the system of macros presented in this thesis can effect many structural variations by defining an outer picture and placing supplemental lines and atomic symbols into it in addition to the fragment(s) produced by the macros. It is estimated that the macros can provide shortcuts to the drawing of more than 50\% of the structures shown in the widely used textbook by Solomons (Solomons~84). The next section lists the individual macros in this system, each with a typical generic structure and directions for the use of all arguments. Specific selection criteria for the fragment as such and the arguments are mentioned in many cases. The fragments are listed in the traditional categories of organic chemistry: acyclic structures, alicyclic structures (rings where all ring members are carbon atoms), and heterocyclic structures. The number of arguments is given in brackets behind the macro name. \section{Macros of the system} \subsection{Macros for acyclic fragments} \subsubsection{Macro {\tt\char"5C{}cbranch}[9]} This macro typesets structural fragments with vertical branches: $$\pht=700 \cbranch{$R^{1}$}{S}{$R^{3}$}{S}{$Z$}{S}{$R^{7}$}{S}{$R^{9}$} $$ \begin{description} \item[{\rm Arguments 1,~3,~7,~9:}] The substituent formulas for ${\rm R^1}$, ${\rm R^3}$, ${\rm R^7}$, and ${\rm R^9}$. \item[{\rm Argument 2:}] The bond between ${\rm R^1}$ and Z, ``S'' for a single bond and ``D'' for a double bond. No action is taken for any other value of the argument. \item[{\rm Argument 4:}] The bond between ${\rm R^3}$ and Z, ``S'' for a single bond and ``D'' for a double bond. When the argument is ``Q'', no bond is drawn and ${\rm R^3}$ is moved next to Z. \item[{\rm Argument 5:}] The center atom(s), Z. When the argument is a string of more than one character, argument~6 should not be ``S'' or ``D,'' and argument~7 should be an empty set. \item[{\rm Argument 6:}] The bond between Z and ${\rm R^7}$, ``S'' for a single bond and ``D'' for a double bond. No action is taken for any other value of the argument. \item[{\rm Argument 8:}] The bond between Z and ${\rm R^9}$, ``S'' for a single bond and ``D'' for a double bond. No action is taken for any other value of the argument. \end{description} \subsubsection{Macro {\tt\char"5C{}tbranch}[7]} This macro typesets structural fragments with vertical branches similar to \verb+\cbranch+. The main reason for including \verb+\tbranch+ is to show the use of the \LaTeX\ tabbing mechanism for printing structural fragments. Macro \verb+\cbranch+ is the preferred macro for structures of this type. In contrast to the other macros, \verb+\tbranch+ provides the math mode for the substituent formulas in the macro code. Therefore substituent formula arguments do not have to be enclosed by \verb-$- symbols. \[ \tbranch{R^1}{S}{R^3-}{Z-}{S}{R^6}{1} \] \begin{description} \item[{\rm Arguments 1 and 6:}] The substituent formulas for ${\rm R^1}$ and ${\rm R^6}$. \item[{\rm Argument 2:}] The bond between ${\rm R^1}$ and Z, ``S'' for a single bond and ``D'' for a double bond. No action is taken for any other value of the argument. \item[{\rm Argument 3:}] Atom symbols and bonds to the left of Z. Single bonds have to be typed in as hyphens, double bonds as equal signs. \item[{\rm Argument 4:}] The center atom Z and any bonds and atom symbols to its right. Single bonds have to be typed in as hyphens, double bonds as equal signs. \item[{\rm Argument 5:}] The bond between Z and ${\rm R^6}$, ``S'' for a single bond and ``D'' for a double bond. No action is taken for any other value of the argument. \item[{\rm Argument 7:}] An integer number which is interpreted as printer points of negative space between lines. The correct number for a document with double spacing is 13. \end{description} \subsubsection{Macro {\tt\char"5C{}ethene}[4]} This macro typesets an ethene fragment with four variable substituents: \[ \ethene{$R^1$}{$R^2$}{$R^3$}{$R^4$} \] Arguments 1--4 are the substituent formulas represented by ${\rm R^1}$, ${\rm R^2}$, ${\rm R^3}$, and ${\rm R^4}$. \subsubsection{Macro {\tt\char"5C{}upethene}[4]} This macro is similar to \verb+\ethene+, but it draws the ethene double bond vertically: \[ \upethene{$R^1$}{$R^2$}{$R^3$}{$R^4$} \] The arguments have the same meaning as they do for \verb+\ethene+. \subsubsection{Macro {\tt\char"5C{}cright}[7]} This macro typesets the following fragment which is often used for carboxylic acids and their derivatives: \[ \cright{$R^1$}{S}{$Z$}{S}{$R^5$}{S}{$R^7$} \] \begin{description} \item[{\rm Arguments 1,5,7:}] The substituent formulas ${\rm R^1}$, ${\rm R^5}$, and ${\rm R^7}$. \item[{\rm Argument 2:}] The bond between ${\rm R^1}$ and Z, ``S'' for a single bond and ``D'' for a double bond. For an argument of ``Q'', no bond is drawn and ${\rm R^1}$ is moved next to Z. \item[{\rm Argument 3:}] The center atom(s) Z. \item[{\rm Argument 4:}] The bond between Z and ${\rm R^5}$, ``S'' for a single bond and ``D'' for a double bond. \ri . \item[{\rm Argument 6:}] The bond between Z and ${\rm R^7}$, ``S'' for a single bond and ``D'' for a double bond. \ri . \end{description} \subsubsection{Macro {\tt\char"5C{}cleft}[7]} This macro typesets a fragment similar to the one produced by \verb+\cright+, but opening to the left: \[ \cleft{$R^1$}{S}{$Z$}{S}{$R^5$}{S}{$R^7$} \] \begin{description} \item[{\rm Arguments 1, 5, 7:}] The substituent formulas ${\rm R^1}$, ${\rm R^5}$, and ${\rm R^7}$. \item[{\rm Argument 2:}] The bond between ${\rm R^1}$ and Z, ``S'' for a single bond and ``D'' for a double bond. \ri . \item[{\rm Argument 3:}] The center atom(s) Z. When the argument is a string of more than one character, argument~6 should not be ``S'' or ``D'', and argument~7 should be an empty set. \item[{\rm Argument 4:}] The bond between ${\rm R^5}$ and Z, ``S'' for a single bond and ``D'' for a double bond. \ri . \item[{\rm Argument 6:}] The bond between Z and ${\rm R^7}$, ``S''for a single bond and ``D'' for a double bond. \ri . \end{description} \subsubsection{Macro {\tt\char"5C{}chemup}[7]} This macro typesets the following fragment which can be used for small molecules with trigonal geometry: \[ \chemup{$R^1$}{S}{$Z$}{S}{$R^5$}{S}{$R^7$} \] \begin{description} \item[{\rm Arguments 1, 5, 7:}] The substituent formulas ${\rm R^1}$, ${\rm R^5}$, and ${\rm R^7}$. \item[{\rm Argument 2:}] The bond between ${\rm R^1}$ and Z, ``S'' for a single bond and ``D'' for a double bond. \ri . \item[{\rm Argument 3:}] The center atom Z. \item[{\rm Argument 4:}] The bond between Z and ${\rm R^5}$, ``S'' for a single bond and ``D'' for a double bond. \ri . \item[{\rm Argument 6:}] The bond between Z and ${\rm R^7}$, ``S'' for a single bond and ``D'' for a double bond. \ri . \end{description} \subsubsection{Macro{\tt\char"5C{}cdown}[7]} This macro typesets a fragment similar to the one produced by \verb+\chemup+, but opening downwards: \[ \cdown{$R^1$}{S}{$Z$}{S}{$R^5$}{S}{$R^7$} \] The arguments have the same meaning as they do for \verb+\chemup+. \subsubsection{Macro {\tt\char"5C{}csquare}[5]} This macro typesets a fragment that is sometimes used when all four substituents on a center atom have to be shown explicitly: \[ \csquare{$R^1$}{$R^2$}{$Z$}{$R^4$}{$R^5$} \] \begin{description} \item[{\rm Arguments 1--4:}] The substituent formulas ${\rm R^1}$, ${\rm R^2}$, ${\rm R^4}$, and ${\rm R^5}$. \item[{\rm Argument 3:}] The center atom Z. \end{description} \subsubsection{Macro {\tt\char"5C{}ccirc}[4]}. This macro typesets a fragment used to show the actual configuration at a tetrahedral atom. The tetrahedral atom itself is not shown and is assumed to be in the middle of the sphere represented by the circle. The bonds typeset as heavier lines and intersecting the circle are directed out of the plane of the paper, towards the viewer. \[ \ccirc{$R^1$}{$R^2$}{$R^3$}{$R^4$} \] The arguments 1--4 are the substituent formulas ${\rm R^1}$, ${\rm R^2}$, ${\rm R^3}$, and ${\rm R^4}$.