4

First post, sorry if I get the formatting wrong. I am attempting to produce a Display Formula for Poly Styrene, but have not been able to get the benzene ring to place properly. This is my current attempt:

I want to create a Benzene ring with Carbon atoms placed at the six nodes of the ring. I am using chemfig package to achieve this. But it so happens that the bond is actually going into the Carbon atom at one of the sites.

MWE and is appended below. Along with the desired output

\documentclass{article}
\usepackage{chemfig}

\begin{document}

\chemfig{-[@{op,.5}]C(-[2]([:-30]*6(=-=-=-)))(-[6]H)-C(-[2]H)(-[6]H)-[@{cl,.5}]}

\end{document}

This is the output I am aiming for

3
  • 1
    Welcome to TeX.SX! It is actually a good first post :)
    – TeXnician
    Commented Oct 27, 2018 at 11:40
  • @Fran I think the picture signals the requested output (as stated now)(en.wikipedia.org/wiki/Polystyrene) and OP gets something different.
    – albert
    Commented Oct 27, 2018 at 12:35
  • @Albert Now I see it. I will delete the comment. Thanks
    – Fran
    Commented Oct 28, 2018 at 7:17

1 Answer 1

2

You should write with the code setpolymerdelim in the chemfig manual

\documentclass{article}
\usepackage{chemfig}

\begin{document}
\newcommand\setpolymerdelim[2]{\def\delimleft{#1}\def\delimright{#2}}
\def\makebraces[#1,#2]#3#4#5{%
\edef\delimhalfdim{\the\dimexpr(#1+#2)/2}%
\edef\delimvshift{\the\dimexpr(#1-#2)/2}%
\chemmove{%
\node[at=(#4),yshift=(\delimvshift)]
{$\left\delimleft\vrule height\delimhalfdim depth\delimhalfdim
width0pt\right.$};%
\node[at=(#5),yshift=(\delimvshift)]
{$\left.\vrule height\delimhalfdim depth\delimhalfdim
width0pt\right\delimright_{\rlap{$\scriptstyle#3$}}$};}}
\setpolymerdelim[]
\chemfig{-[@{left,0.3},1.5]C(-[:90]*6(=-=-=-))(-[6]H)-C(-[2]H)(-[6]H)-[@{right,0.8}]}
\makebraces[90pt,30pt]{n}{left}{right}
\end{document}
3
  • Thank you very much; don't think I would have got there myself any time soon.
    – Hugo F
    Commented Oct 27, 2018 at 13:13
  • 1
    @HugoF if GézàLaTeX's answer has solved your problem, the usage is to accept it, read : tex.stackexchange.com/help/someone-answers
    – AndréC
    Commented Oct 27, 2018 at 13:36
  • I think it would be fair to mention that the entire code chunk for \setpolymerdelim (lines 5 to 16) is taken from the chemfig manual, section 12.4 Draw a ploymer element (p. 43). And yes, currently there is a typo in the section title so it's tricky to find the answer by searching the manual:)
    – andselisk
    Commented Oct 27, 2018 at 15:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .