Code:
\documentclass[parskip]{scrartcl}
\usepackage{chemfig}
\usepackage[version=3]{mhchem} %write chemical formula nicely
\setdoublesep{0.25 em} % 'Bond Spacing'
\setatomsep{1.6 em} % 'Fixed Length'
\setbondoffset{0.16 em} % 'Margin Width'
\newcommand{\bondwidth}{0.06642 em} % 'Line Width'
\setbondstyle{line width = \bondwidth}
\makeatletter
\CF@def\setangincr{\def\CF@angle@increment}
\setangincr{30}% default value
\def\CF@set@bondangle#1#2{% le code de la direction est contenu dans #1, en sortie, #2 contient l'angle
\ifx\@empty#1\@empty%
\let#2\CF@default@angle
\else
\if:\expandafter\noexpand\@car#1\@nil
\if:\expandafter\expandafter\expandafter\noexpand\expandafter\@car\@gobble#1\@nil
\pgfmathsetmacro#2{\CF@previous@angle+\expandafter\@gobble\@gobble#1}%
\else
\expandafter\def\expandafter#2\expandafter{\@gobble#1}%
\fi
\else
\pgfmathsetmacro#2{#1*\CF@angle@increment}%
\fi% puis normalise l'angle entre 0 et 360
\ifdim\ifdim#2pt<\z@-\fi#2pt>360pt \pgfmathsetmacro #2{#2-360*floor(#2/360)}\fi% si |#2|>360
\fi
}
\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$}}$};}}
\begin{document}
\setpolymerdelim[]
\chemfig{-[1,,,,dash pattern=on 2pt off 1.2pt](=[3,,,,red]\textcolor{red}{O})-[@{op,.4}-1,,,,red](=[9,,,,red]\textcolor{red}{O})-[@{cl,0.6}1,,,,red](=[3,,,,red]\textcolor{red}{O})-[-1,,,,dash pattern=on 2pt off 1.2pt]}
\makebraces[5pt,25pt]{\!n}{op}{cl}
\par
\setpolymerdelim[]
\chemfig{-[1,,,,dash pattern=on 2pt off 1.2pt](=[3,,,,red]\textcolor{red}{O})-[@{op,.5}-1,,,,red]=_[1,,,,red]-[@{cl,0.5}-1,,,,red](-[1,,,,dash pattern=on 2pt off 1.2pt])=[9,,,,red]\textcolor{red}{O}}
\makebraces[5pt,25pt]{\!n}{op}{cl}
\par
\setpolymerdelim[]
\chemfig{-[1,,,,dash pattern=on 2pt off 1.2pt](=[3,,,,red]\textcolor{red}{O})-[@{op,.5}-1,,,,red]=_[1,,,,red]-[@{cl,0.5}-1,,,,red](=[9,,,,red]\textcolor{red}{O})-[1,,,,dash pattern=on 2pt off 1.2pt]}
\makebraces[5pt,25pt]{\!n}{op}{cl}
\par
\setpolymerdelim[]
\chemfig{-[1,,,,dash pattern=on 2pt off 1.2pt](-[3,,,,red,dash pattern=on 2pt off 1.2pt]\textcolor{red}{O}|\textcolor{red}{\ce{NO2}})-[-1,,,,red]
(-[9,,,,red,dash pattern=on 2pt off 1.2pt]\textcolor{red}{O}|\textcolor{red}{\ce{NO2}})
-[@{op,0.5}1,,,,red](-[3,,,,red,dash pattern=on 2pt off 1.2pt]\textcolor{red}{O}|\textcolor{red}{\ce{NO2}})
=_[-1,,,,red](-[9,,,,red,dash pattern=on 2pt off 1.2pt]\textcolor{red}{O}|\textcolor{red}{\ce{NO2}})
-[@{cl,0.5}1,,,,red](-[3,,,,red,dash pattern=on 2pt off 1.2pt]\textcolor{red}{O}|\textcolor{red}{\ce{NO2}})
-[-1,,,,red](-[9,,,,red,dash pattern=on 2pt off 1.2pt]\textcolor{red}{O}|\textcolor{red}{\ce{NO2}})
-[1,,,,dash pattern=on 2pt off 1.2pt]}
\makebraces[5pt,25pt]{\!n}{op}{cl}
\end{document}
Vielen Dank für Eure Hilfe!
Lesezeichen