我想创建一种这样的聚合物。
这是我目前得到的。
\documentclass{article}
\usepackage{chemfig}
\usepackage{mhchem}
\makeatletter
\newcommand*\setpolymerdelim[2]{\def\polymer@delimleft{#1}\def\polymer@delimright{#2}}
\newcommand*\makepolymerbraces[5]{%
\edef\polymer@delimhalfdim{\the\dimexpr(#1+#2)/2}%
\edef\polymer@delimvshift{\the\dimexpr(#1-#2)/2}%
\chemmove{
\node[at=(#4),yshift=(\polymer@delimvshift)]
{$
\left\polymer@delimleft
\vrule height\polymer@delimhalfdim depth\polymer@delimhalfdim width0pt
\right.
$};
\node[at=(#5),yshift=(\polymer@delimvshift)]
{$
\left.
\vrule height\polymer@delimhalfdim depth\polymer@delimhalfdim width0pt
\right\polymer@delimright_{\rlap{#3}}
$};
}%
}
\makeatother
\begin{document}
\schemestart
\setpolymerdelim[]
\chemfig{-[@{b1},0.4]-[,.8]Si(-[:90,.5,,,white]\ce{R})-[@{b3},0.2]-O-[@{b4},0.3][@{b2},0.6]}
\makepolymerbraces{30pt}{30pt}{$n$}{b1}{b2}
\setpolymerdelim()
\makepolymerbraces{30pt}{30pt}{$1.5$}{b3}{b4}
\schemestop
\end{document}
[@{b3},0.2]
所以问题是:如何正确定位支架?用这四个点排列它们并在数千次之后更改数字@{bx},xx
直到看起来不错并不是那么好 。
有没有更好的方法来构建这样的聚合物?
谢谢,弗朗兹
答案1
我会做这样的事情:
\documentclass{article}
\usepackage{chemfig}
\usepackage{chemmacros}
\chemsetup{
modules = {polymers}
}
\begin{document}
\chemfig{-[@{a}]\chemabove{Si}{R}-[@{b,.75}]O-[@{c,.25}]-[@{d,.25},.5]}
\makepolymerdelims{10pt}{a}{d}
\makepolymerdelims[subscript=$\scriptstyle\!1.5$,delimiters=()]{10pt}{b}{c}
\end{document}
该示例使用包\makepolymerdelims
中的定义,chemmacros
但其思想与手册中建议的宏相同chemfig
。