\documentstyle[12pt]{report} \nofiles \def\LATEX{\LaTeX} \let\TEX = \TeX \setcounter{totalnumber}{5} \setcounter{topnumber}{3} \setcounter{bottomnumber}{3} \setlength{\oddsidemargin}{3.9cm} %real measurement 1.5in \setlength{\textwidth}{5.7in} %right margin is now 1in \setlength{\topmargin}{1cm} \setlength{\headheight}{.6cm} \setlength{\textheight}{8.5in} \setlength{\parindent}{1cm} \renewcommand{\baselinestretch}{1.5} \raggedbottom \input{init.tex} \input{hetisix.tex} \input{hetifive.tex} \input{furanose.tex} \input{pyranose.tex} \input{purine.tex} \input{six.tex} \input{fparts.tex} \input{cleft.tex} \input{cto.tex} \begin {document} \setcounter{page}{35} \setcounter{chapter}{5} \textfont1=\tenrm \initial \len=4 \centerline{CHAPTER V} \vspace{\len mm} \centerline{COMBINING STRUCTURES FROM SEVERAL MACROS} \vspace{\len mm} \centerline{1. GENERAL CONSIDERATIONS FOR COMBINING STRUCTURES} \centerline{IN THIS SYSTEM} \vspace{\len mm} Many individual structure diagrams can be typeset using just one of the macros together with condensed, one-line formulas; but often it will be necessary to combine the ring structure or the branched fragment from one macro with a structure part from another. To do this, the separate parts have to be precisely aligned horizontally and vertically. The typesetting of chemical equations containing structure diagrams also requires such alignments and is therefore included in this chapter. For the system of macros described here, alignment consists of moving each of the structure fragments as a whole, either within its picture box or together with the box. In each structure diagram there are many different points to which other fragments can be attached. Similarly, one and the same structure can be aligned in different ways with others to produce a chemical equation. For these reasons, it was not considered feasible to develop a symbolic language for alignment, such as ``attach(sixring) at(1) to(fivering) at(4).'' Instead, this system lets the user manipulate the placement of the structures at a lower level by using some of the numerical coordinates from the macros. While it may be considered a disadvantage that the user has to extract information from the macros, this method also puts a lot more control into the hands of the user. The type of user anticipated for this system will probably prefer this mechanism to an overdose of user-friendliness. Outright manipulation of coordinates is also well suited for the textual method of structure input employed in this system, since it helps the user to visualize the result. The information that is needed from a macro to form a new structure \linebreak from fragments is the coordinate pair for the point of attachment in each fragment. A part of the code for the sixring and the relevant part of the structure is shown in figure 5.1 to illustrate briefly how these coordinate pairs are obtained: If a fragment is to be attached directly to a ring position, for example to position 1, the coordinate pair is found in the unconditional part of the code as the origin of the bondline beginning at position 1. (The code for the bond is located by finding the respective line comment.) The coordinate pair in this case would be (342,200). --- A fragment can also be attached to the end of a bond extending from the ring. These bonds are optional and part of the conditional code. The optional bond extending from position 1 is located through the comment ``substituent on 1.'' The x-coordinate at the end of this bond is $342 + 128 = 470$, since the length of the bond given in the code, 128 units, is the projection on the x-axis. The y increment from ring position 1 to the end of the bond is obtained from the slope of the line and the x increment of 128: ${\rm \Delta x(3\mbox{/}5)=77}$. Thus, the y-coordinate at the end of the bond is $200 + 77 = 277$ units. -- Appendix B lists the coordinates of the more commonly used points of attachment for the system of macros described here. \setlength{\unitlength}{.2pt} \begin{figure}[tb] \hspace{5cm} \begin{picture}(400,530)(0,-200) \put(342,200) {\line(0,-1) {200}} \put(342,0) {\line(-5,-3){171}} \put(171,303) {\line(5,-3) {171}} \put(342,200) {\line(5,3) {128}} \thinlines \put(342,200) {\vector(1,0){128}} \put(470,200) {\vector(-1,0){128}} \put(470,200) {\vector(0,1) {77}} \put(470,277) {\vector(0,-1){77}} \put(320,160) {{\scriptsize 1}} \put(320,0) {{\scriptsize 2}} \put(370,150) {{\scriptsize 128}} \put(490,220) {{\scriptsize 77}} \end{picture} \begin{minipage}{14cm} \begin{verbatim} \begin{picture}(\pw,\pht)(-\xi,-\yi) ..... \put(342,200) {\line(0,-1) {200}} % bond from 1 to 2 \ifx#1Q \else\put(342,200){\line(5,3) {128}} % substituent on 1 \put(475,250){#1} \fi ..... \end{picture} \end{verbatim} \end{minipage} \caption{Finding coordinates of points of attachment} \end{figure} %figure 5.1 \setlength{\unitlength}{.1pt} Two conceptually different methods were used in this thesis to combine structure fragments from different macros. --- One method follows a suggestion in the LaTeX manual (Lamport 86, p. 110) to put subpictures into an encompassing picture with the \verb+\+put command: \\ \centerline{$\backslash $put(x,y)\{$\backslash $begin\{picture\} $\ldots \backslash $end\{picture\} \ \ \}. } The reference point (x,y) is the lower left corner of the subpicture. When this technique is applied to the chemical structure macros, the macro invocation constitutes the subpicture. The user has to set up the encompassing picture and determine the coordinates of the reference points from the coordinates of the points of attachment between structure fragments. The second method is somewhat less versatile; but there are applications for which it is preferable. In this method, the individual picture boxes are put next to one another on one line or on successive lines. The fragments in the separate pictures are aligned by shifting the coordinate system, i. e. by changing the \verb+\+xi and \verb+\+yi values in the picture declaration, in one or more of the pictures. Finally, for the alignment of structures in a chemical equation, it is convenient to use a paragraph box construction (\verb+\+parbox) in addition to coordinate shifting. LaTeX centers a paragraph box vertically on the current line which contains, in the case of the chemical equation, textual items such as plus symbols, condensed formulas, and reaction arrows. Typical applications of all methods of combining structure fragments will be described in the rest of this chapter. \pagebreak \vspace{\len mm} \centerline{2. COMBINING FRAGMENTS TO FORM A NEW STRUCTURE} \vspace{\len mm} \noindent A. \underline{Attachment by the Subpicture Method} A simple example for this technique of structure-building is shown in figure 5.2, where two different heterocycles are fitted together to produce the structure of nicotine. The LaTeX code to be entered by the user for this structure is given underneath the diagram. \begin{figure}[h] % fig. 5.2 \hspace{5cm} \begin{picture}(900,900)(0,0) \put(0,0) {\hetisix{D}{Q}{}{Q}{Q}{Q}{D}{D}{N} } \put(470,277) {\hetifive{$CH_{3}$}{Q}{Q}{Q}{Q}{S}{S}{S}{N} } \put(135,330) {A} \put(605,600) {B} \end{picture} \begin{minipage}{14 cm} \begin{verbatim} \begin{picture}(900,900)(0,0) \put(0,0) {\hetisix{D}{Q}{}{Q}{Q}{Q}{D}{D}{N} } \put(470,277) {\hetifive{$CH_{3}$}{Q}{Q}{Q}{Q}{S}{S}{S}{N}} \end{picture} \end{verbatim} \end{minipage} \caption{Nicotine structure with LaTeX code} \end{figure} The code in figure 5.2 illustrates how the user has to set up the encompassing picture with the \verb+\+begin and \verb+\+end statements and estimated values for the picture width and height, both 900 units (about 3cm) in this example. Then the picture box of the pyridine ring is placed at the origin of the outer picture. Next, the points of attachment are found in the respective macros as ${\rm x_{AB}=470}$, ${\rm y_{AB}=277}$ for pyridine and ${\rm x_{BA}=0}$, ${\rm y_{BA}=0}$ for pyrrolidine. The coordinates of the reference point in the outer picture where the inner picture with the pyrrolidine ring has to be placed then are \\ \centerline{${\rm x=x_{AB}-x_{BA}=470}$, \ ${\rm y=y_{AB}-y_{BA}=277}$.} It is assumed that the lower left corner of both subpictures has the same coordinates, and this is the case when the macros are used. When more than two ring structures are combined one after the other, the calculation of the reference points is appropriately extended. Since the macros for the various acyclic branched fragments also consist of picture boxes, these fragments can be used as subpictures together with ring structures and with other acyclic fragments. Thus the structure of thymol in figure 5.3 is produced from the \verb+\+sixring and the \verb+\+cdown macros. Again, the coordinates for the point of reference for the \verb+\+cdown picture are calculated from the points of attachment:\\ \indent ${\rm x=x_{sixring}-x_{cdown}=\ \ 171-\ \ 33=\ \ 138}$\\ \indent ${\rm y=y_{sixring}-y_{cdown}=-103-220=-323}$.\\ Figure 5.4, the structure of penicillic acid, combines three subpictures, one from the \verb+\+cleft macro and two from the \verb+\+cbranch macro which draws vertical branches. \begin{figure}[h] % fig. 5.3 \hspace{6cm} \begin{picture}(500,1100)(0,-300) \put(0,0) {\sixring{Q}{$OH$}{Q}{Q}{Q}{$CH_{3}$}{S}{S}{C} } \put(138,-323) {\begin{picture}(\pw,\pht)(-\xi,-\yi) \put(33,80) {\line(0,1) {140}} \put(0,0) {$CH$} \put(0,0) {\line(-5,-3){121}} \put(80,0) {\line(5,-3) {121}} \put(-430,-150){\makebox(300,87)[r]{$H_{3}C$}} \put(210,-140) {$CH_{3}$} \end{picture} } \end{picture} \begin{minipage}{14cm} \begin{verbatim} \begin{picture}(500,1100)(0,-300) % estimated dimensions \put(0,0) {\sixring ... } \put(138,-323){\cdown ... } \end{picture} \end{verbatim} \end{minipage} \caption{Combining ring structure and acyclic subpictures} \end{figure} % I did not use the cdown macro, because this chapter needs % several macros and I did not want to run out of Tex memory. % But I tried the structure out with the macro. \yi=200 \begin{figure}[t] % fig. 5.4 \hspace{4.5cm} \begin{picture}(900,600)(0,-100) \put(-405,160) {\makebox(300,87)[r]{$H_{3}C$}} \put(0,70) {\line(-1,1) {100}} \put(-405,-185) {\makebox(300,87)[r]{$H_{2}C$}} \put(-9,9) {\line(-1,-1) {100}} \put(9,-9) {\line(-1,-1) {100}} \put(0,0) {$C$} \put(90,33) {\line(1,0) {140}} \put(240,200) {$O$} \multiput(267,85)(26,0){2} {\line(0,1){100}} \put(240,0) {$C$} \put(330,33) {\line(1,0) {140}} \put(480,200) {$OCH_{3}$} \put(520,85) {\line(0,1) {100}} \put(480,0) {$C$} \multiput(570,20)(0,26){2} {\line(1,0){140}} \put(720,0) {$CHCOOH$} \end{picture} \caption{Combining acyclic subpictures} \end{figure} % Again I did not actually use the macros here, but % I tried it out with them. Many structures contain condensed formula fragments between ring diagrams. The structure of the anesthetic piridocaine is shown as an example in figure 5.5. In such a case one has to estimate the average horizontal space per character and move the second subpicture that much further to the right for each character, including the subscripts, in the condensed formula fragment. In the ten point size, in which the characters in figure 5.5 are printed, the horizontal space per character is 6.8 points or 68 of the picture units. \pht=800 \begin{figure}[h] % fig. 5.5 \hspace{4.5cm} \begin{picture}(1200,800)(0,0) \put(0,0) {\sixring{$NH_{2}$}{$COOCH_{2}CH_{2}$} {Q}{Q}{Q}{Q}{D}{D}{D} } \put(1210,0) {\hetisix{$H$}{Q}{Q}{Q}{Q}{}{Q}{}{$N$} } \end{picture} \caption{Condensed formula fragment between rings} \end{figure} \reinit Other special cases occur where a diagram would become too crowded when the two fragments are put next to one another. (This does not necessarily reflect steric hindrance in the real, three-dimensional chemical structure.) In such cases the user can design a longer bondline and put it into the outer picture between two points of attachment on macro-produced structure fragments. The structure of sucrose, shown in figure 5.6, illustrates this technique. For this structure, it was estimated that the x-offset between the bonding oxygen on glucose and the fructose ring should be at least 200 units to produce a diagram that does not appear crowded. Using this x-offset and a bonding angle of $45^{0}$ (the angle used in the pyranose macro for glucose), the user can then easily calculate the point of reference for the fructose subpicture. \begin{figure} \hspace{3.5cm} \begin{picture}(1200,800)(0,-100) \put(0,0) {\pyranose{$H$}{$O$}{}{$OH$}{$OH$}{}{} {$HO$}{$HO$} } \put(785,200) {\line(1,1){200}} \put(985,100) {\furanose{}{$CH_{2}OH$}{$HO$}{}{}{$OH$}{Q}{$HO$} } \end{picture} \begin{minipage}{14cm} \begin{verbatim} \put(0,0) {\pyranose .... } \put(785,200) {\line(1,1){200}} } % user-designed line \put(985,100) {\furanose ... } \end{verbatim} \end{minipage} \caption{User-designed connecting bond line} \end{figure} An important special case of combining structure fragments is the generation of fused ring systems. In a fused ring system more than one ring atom is shared between rings. --- A simple method for producing such diagrams is to print the shared bondlines from individual ring structures precisely on top of each other. The bond lines have to have the same lengths, which is true in this system of macros for the five- and sixrings, the most frequently occurring ones. The shared lines don't appear to be heavier in the printed picture than other bond lines. Figure 5.7 shows the structure diagram of quinoline produced by this method together with the respective LaTeX code. These fused systems can of course include substituents and multiple bond variations at all positions where the original macros made them possible. --- A relatively small number of single-ring fragments can produce a large number of fused systems in this way, among them the very common fused systems of anthracene, phenanthrene, chrysene, indene, indol, benzimidazole, quinoline, and acridine. \begin{figure} % fig. 5.7 \hspace{6cm} \begin{picture}(900,900)(0,0) \put(0,0) {\sixring{Q}{Q}{Q}{Q}{Q}{Q}{S}{D}{D} } \put(342,0) {\hetisix{D}{Q}{Q}{Q}{Q}{Q}{D}{D}{$N$}} \end{picture} \begin{minipage}{14cm} \begin{verbatim} \begin{picture}(900,900)(0,0) \put(0,0) {\sixring{Q}{Q}{Q}{Q}{Q}{Q}{S}{D}{D} } \put(342,0) {\hetisix{D}{Q}{Q}{Q}{Q}{Q}{D}{D}{N} } \end{picture} \end{verbatim} \end{minipage} \caption{Fusion of fully drawn rings} \end{figure} There are also some macros that draw fragments specifically designed for fusing. The following fragments \\ \[ \fuseiv{Q}{Q}{Q}{Q}{Q}{Q}{Q}{Q}{Q} \hspace{2.6cm} \fuseup{Q}{Q}{Q}{Q}{Q}{Q}{Q}{Q}{Q} \hspace{1.4cm} \fuseiii{Q}{Q}{Q}{Q}{Q}{Q} \] are produced by the \verb+\+fuseiv, \verb+\+fuseup, and \verb+\+fuseiii macros. They can be attached to the five- and sixrings as subpictures. These fragments have the advantage that they can provide more options for double bond locations than a full ring structure within the constraint of nine arguments. \vspace{\len mm} \noindent B. \underline{Attachment by Shifting the Coordinate System} This method is easy to use when a complex structure can be perceived as a series of fragments put next to one another horizontally, although not necessarily on exactly the same level. The structure of nicotine shown in figure 5.2 belongs to this category. As an alternative to the code listed in figure 5.2, the following LaTeX statements can be used to produce the nicotine diagram: \\ \indent \verb+\+pw = 470 \\ \indent \verb+\+hetisix $\ldots$ \\ \indent \verb+\+advance \verb+\+yi by 277 \\ \indent \verb+\+hetifive $\ldots$\ \ \ . \\ The first statement here sets the picture width \verb+\+pw for the pyridine ring so that the rightside end of the picture box is at the x-coordinate of the point of attachment. Now LaTeX will put the next item on the line, in this case the picture box with the pyrrolidine ring, flush next to the pyridine box. When the structure is printed in a math display environment (see chapter II) where no spacing between items on a line is applied, there will be no space between the picture boxes. When the structure is put into a figure environment only, without math display, normal spacing occurs as it would happen between words on a line. The user then has to request negative horizontal space between invoking the pyridine and the pyrrolidine macro to correct for the spacing. A statement \verb+\+hspace\{-11pt\} produced the right correction for the typestyle of this document. The statement \verb+\+advance \verb+\+yi by 277 causes the coordinate-shifting in the pyrrolidine picture. By increasing the y-coordinate, the pyrrolidine structure is shifted upwards so that the points of attachment of the two rings meet. In general, the coordinate shifts $\,\Delta $xi and $\,\Delta $yi applied to the second or any following picture are determined from the points of attachment (${\rm x_{AB}}$,${\rm y_{AB}}$) and (${\rm x_{BA}}$,${\rm y_{BA}}$) (the terminology used for figure 5.2) as follows: \\ \centerline{${\rm \Delta xi=x_{BA} \mbox{,}\; \Delta yi=y_{AB}-y_{BA} }$.} For vertical attachment, connecting one fragment to the lower end of another by coordinate shifting, the following steps are necessary: The points of attachment of the upper and the lower fragment are shifted to the bottom and to the top of their respective picture boxes and the x-coordinates of attachment are aligned. The new \verb+\+xi and \verb+\+yi values are then \\ \indent $\backslash {\rm yi_{upper}=-y_{upper} }$ \\ \indent $\backslash {\rm xi_{lower}=x_{upper}-x_{lower} }$ \\ \indent $\backslash {\rm yi_{lower}=\backslash pht_{lower}- y_{lower}+14}$(correction for vertical spacing). \\ \indent For the structure of adenosine shown in figure 5.8 the points of attachment on purine (at the bottom of N-9) and on deoxyribose (at the top of the long bond) have the coordinates (513,-130) and (448,380), respectively. Thus the structure was produced by the code given underneath the diagram. The horizontal space is used here instead of the centering option. The blank lines \newpage \noindent after each ring structure code are necessary to inform LaTeX that the next item should not be printed on the same line. \begin{figure} \hspace{5cm} \yi=130 \purine{Q}{D}{Q}{D}{Q}{$NH_2$}{Q}{D}{Q} \hspace{5cm} \xi=65 \yi=534 \furanose{N}{}{}{$OH$}{}{$OH$}{}{$HO$} \begin{minipage}{14cm} \begin{verbatim} \hspace{5cm} \yi=130 \purine{ ... } (blank line) \hspace{5cm} \xi=65 \yi=534 \furanose{ ... } (blank line) \caption{ ... } \end{verbatim} \end{minipage} \caption{Vertical attachment by coordinate shifting} \end{figure} \vspace{\len mm} \centerline{3. ALIGNING STRUCTURES IN AN EQUATION} \vspace{\len mm} In a chemical equation containing structure diagrams the various constituents of the equation have to be horizontally aligned. The equation is typeset in LaTeX's horizontal mode on one line, the current printline. Text items such as condensed formulas and plus symbols are put on the line as usual, their (imaginary) baseline determining the position of the line. The structure diagrams, as drawn by the macros, will not be vertically centered on the current line. They are drawn in picture boxes which are typeset on the line with the lower end of the (imaginary) box at the baseline of the current line. The picture boxes are positioned at this height without regard to the coordinates declared for the lower left corner of the box. To line up the vertical middle of the diagram in the box with the text of the line, one would have to shift the diagram downwards beyond the bottom of the declared picture. While this can be done, it might result in a lack of space under the equation, since LaTeX reserves space only according to the declared dimensions of the picture. Paragraph boxes on the other hand are normally centered on the vertical center of the current line. Paragraph boxes containing the macros are positioned somewhat differently, with a point one third up from the bottom of the picture at the base of the current line. Thus there is one third of the declared picture below the base of the current line which yields enough vertical space to set off the equation from the succeeding text. The equation in figure 5.9 was typeset by putting each macro-drawn diagram into a \verb+\+parbox. The y-coordinate of the lower end of the pictures is -300 as usual, which puts position 2 of the sixring and the CHOH part from the \verb+\+cleft macro at the base of the current line. The LaTeX code for the equation is shown underneath it in the figure. The y-coordinates of the structures and of the reaction arrow, in this case drawn by a macro, could be shifted individually as well to change the alignment. The TeX control sequence \verb+\+to ($\to $) can be used instead of the special reaction arrow for chemistry; ($\,\to $) is always centered on the line. Getting good-looking horizontal spacings within the equation usually requires some experimenting. As previously mentioned, there is no inter-item spacing in math mode. Therefore more explicit horizontal space has to be added when chemical equations are typeset in the math display environment. \begin{figure} \hspace{1.5cm} \parbox{40pt}{\sixring{Q}{$R^{2}$}{Q}{Q}{Q}{Q}{S}{S}{C} } \hspace{1cm} $+$ \hspace{1.5cm} \parbox{40pt}{\cleft{$CH_{3}$}{S}{$CHOH$}{S} {$CH_{3}$}{Q}{} } \parbox{40pt}{\cto{BF_{3}}{60^{0}}{3} } \hspace{3mm} \parbox{40pt}{\sixring{$CH{(CH_3)}_2$}{$R^{2}$}{Q}{Q}{Q}{Q}{S}{S}{C} } \begin{minipage}{14cm} \begin{verbatim} \hspace{1.5cm} \parbox{40pt}{\sixring{Q}{$R^{2}$}{Q}{Q}{Q}{Q}{S}{S}{C} } \hspace{1cm} $+$ \hspace{1.5cm} \parbox{40pt}{\cleft{$CH_{3}$}{S}{$CHOH$}{S} {$CH_{3}$}{Q}{} } \parbox{40pt}{\cto{BF_{3}}{60_{0}}{3} } \hspace{3mm} \parbox{40pt}{\sixring{$CH{(CH_3)}_2$}{$R_{2}$}{Q}{Q}{Q}{Q} {S}{S}{C} } \end{verbatim} \end{minipage} \caption{Alignment in a chemical equation} \end{figure} \end{document}