# How can I draw styrene using xymtex?

How can I draw styrene using xymtex?

-
Suggest you look at the package chemfig, which is built on top of the Tikz package instead of using xyfig. For the chemist, you are not required to know anything about tikz, but you do need to know chemistry to understand how to use the package. Lots of very nice examples. –  R. Schumacher Nov 14 '12 at 21:12
Quite apart from the tool chosen, I'd tidy up the angles a bit! Either the phenyl group or the double bond should be angled so everything stays 'ideal'. –  Joseph Wright Nov 14 '12 at 21:14

This is my first use of the package xymtex.

\documentclass{article}
\usepackage{xymtex}
\begin{document}
\sbox4{%
\begin{picture}(0,0)(343,502)%
\put(0,0){\bzdrh[c]{}}%
\end{picture}%
}
\bzdrv[c]{1==CH=CH$_2$}
\ethylene{1==C;2==C}{1==H;2==H;3==\box4;4==H}
\end{document}


-

This isn't a direct answer to your question (and as such, you should accept Heiko's answer), but as R. Schumacher suggested, you can also accomplish this with the newer (and more robust) chemfig package.

\documentclass{article}
\usepackage{chemfig}
\begin{document}
\chemfig{*6(-=-=(-CH=[::-90]CH_2)-=)}
\end{document}


-
You should use CH_2 instead of CH2 –  Lionel MANSUY Nov 15 '12 at 12:22
Despite the fact that I also think that chemfig is the better choice: this doesn't answer the question at all... –  cgnieder Nov 15 '12 at 16:18
LionelMANSUY: Thanks. cgnieder: True. I should have said this to begin with. –  user2473 Nov 15 '12 at 20:17

To complete the answer from @cfair this code will draw "exactly" your representation of the styrene molecule, including the annotation:

\documentclass{article}
\usepackage{chemfig}
\begin{document}
\chemname{\chemfig{C(-[::120]H)(-[::-120]H)=C(-[::60]H)(-[::-60]**6(------))}}
{\textbf{Styrene}}
\end{document}


There is an option to control the length of the bonds

-

XyMTeX supports the (yl) function for nested substitution. The following examples show (1) changing font sizes, (2) changing formula sizes, (3) changing fonts, and (4) selection of basis skeletons (\bzdrv, \bzdrh, or \tetramethylenei).

The code adopts the PostScript mode of the XyMTeX system, which presumes the processing with dvips(k). The other modes commented out are possible to be applied.

\documentclass{article}
%\usepackage{xymtex}%XyMTeX plain
%\usepackage{xymtexpdf}%XyMTeX for PDF ... dvipdfmx ... .pdf
\usepackage{xymtexps}%XyMTeX for PostScript ... dvips(k) ... .ps
\usepackage{txfonts}%Times Roman
\usepackage[scaled]{helvet}%Helvetica 95%
\pagestyle{empty}
\begin{document}
\begin{center}
\let\substfontsize=\small%changing font size
\bzdrh{2==\ethylene{1==C;2==C}{1==H;2==H;3==(yl);4==H}}
\end{center}

\begin{center}
\changeunitlength{0.07pt}%changing formula size
\bzdrv{1==\tetramethylenei[b]{1==H;2==C;3==C;4==H}{2==(yl);3==H}}
\bzdrv{1==\tetramethylenei[b]{1==H;4==H}{2==(yl);3==H}} \\
\let\substfont=\sf%changing font: san serif
\tetramethylenei[b]{1==H;2==C;3==C;4==H}{2==\bzdrv[c]{1==(yl)};3==H}
\tetramethylenei[b]{1==H;4==H}{2==\bzdrv[c]{1==(yl)};3==H}
\end{center}
\end{document}


-
the author of xymtex was persuaded to upload a copy to ctan when he had a paper in tugboat. unfortunately he never followed this up, so (a) the copy on ctan is pathetially old, and (b) the procedure for getting a current version used to change every time i looked. my advice is to use chemfig, as others have suggested. –  wasteofspace Feb 4 '13 at 9:13
The latest version of XyMTeX is available from the XyMTeX homepage (xymtex.com): xymtex.com/fujitas3/xymtex/indexe.html –  Fujita Feb 5 '13 at 2:12
For further information on topics discussed once in Web, please see XyMTeX-tips of the XyMTeX homepage (xymtex.com): xymtex.com/fujitas3/xymtex-tips/indexe.html The present topic has been deposited as 130204a.pdf. –  Fujita Feb 6 '13 at 3:31
I believe that the selection of tools for drawing chemical structures depends on what one is aiming at now and in the future. XyMTeX is based on the XyM notation (S. Fujita and N. Tanaka, J. Chem. Inf. Comput. Sci., 39, 903-914 (1999)), which has been extended into a markup language named XyMML (XyM markup language, S. Fujita, J. Chem. Inf. Comput. Sci., 39, 915-927 (1999)). –  Fujita Feb 6 '13 at 3:45