我正在努力获取一个显示chemfig
正确使用聚合过程的反应。
这是我正在使用的代码:
\begin{figure}[htb!]
\centering
\schemestart
\chemfig{R-C(-[2])(-[6])-C(-[2])(-[6])-C(-[2])(-[6])-\lewis{0.,C}(-[2])(-[6])}
\+
\chemfig{[@{left,0.5}]C(-[2])(-[6])=C(-[2])(-[6])[@{right,0.5}]}
%\polymerdelim[delimiters ={[]}, height = 40pt, indice = n]{left}{right}
\arrow
\chemfig{R-C(-[2])(-[6])-C(-[2])(-[6])-[@{left,0.5}]C(-[2])(-[6])-C(-[2])(-[6])-[@{right,0.5}]C(-[2])(-[6])-\lewis{0.,C}(-[2])(-[6])}
\polymerdelim[delimiters ={[]}, height = 40pt, indice = n]{left}{right}
\schemestop
\caption{}
\label{}
\end{figure}
这是目前的结果:
由于某种原因,第二个括号是我想要的,但第一个不是。似乎它没有得到 的规范\polymerdelim
,所以我想我可能还需要在上面添加该行\chemfig
。
如果我激活该线路
%\polymerdelim[delimiters ={[]}, height = 40pt, indice = n]{left}{right}
我收到此错误信息:
! Package pgf Error: No shape named left is known.See the pgf package documentation for explanation.Type H <return> for immediate help.... \chemfig
有人可以帮我吗?
谢谢你!
答案1
根据文档chemfig
第 13 节,该语法@{<name>, <coeff>}
只能在键的可选参数的开头使用。在\chemfig
您的第二个示例中
\chemfig{[@{left,0.5}]C(-[2])(-[6])=C(-[2])(-[6])[@{right,0.5}]}
可选参数[@{left,0.5}]
和[@{right,0.5}]
没有相应的键,因此节点left
和right
永远不会被创建。
选项1
如果你对开始和结束债券没意见,那么使用
\chemfig{C(-[2])(-[6])(-[@{left,0.5}4])=C(-[2])(-[6])-[@{right,0.5}]}
\polymerdelim[delimiters={[]}, height=40pt, depth=, indice=n]{left}{right}
选项 2
如果要保留无键样式,可以使用@{<name>}<atom>
为原子添加节点,并使用\polymerdelim
选项open xshift
和close xshift
调整分隔符的位置。请注意,在这种情况下,左右间距不会自动调整。
\chemfig{@{left}C(-[2])(-[6])=@{right}C(-[2])(-[6])}
\polymerdelim[delimiters={[]}, height=40pt, depth=, indice=n,
open xshift=-8pt, close xshift=]{left}{right}
选项 3
这是选项 1 的变体,其中指定了起始和终止键,但未绘制(通过键选项[,,,draw=none]
)。为了获得更好的水平间距,这两个键也被缩短了(通过键选项[,0.5,,,]) and the position of nodes are adjusted (from
@{left, 0.5} to
@{left, 1}`)。
\chemfig{C(-[2])(-[6])(-[@{left,1}4,.5,,,draw=none])=C(-[2])(-[6])-[@{right,1},.5,,,draw=none]}
\polymerdelim[delimiters={[]}, height=40pt, depth=, indice=n]{left}{right}
完整示例:
\documentclass[margin=20pt]{standalone}
\usepackage{chemfig}
\begin{document}
\schemestart
\chemfig{R-C(-[2])(-[6])-C(-[2])(-[6])-C(-[2])(-[6])-\lewis{0.,C}(-[2])(-[6])}
\+
%% option 1
% \chemfig{C(-[2])(-[6])(-[@{left,0.5}4])=C(-[2])(-[6])-[@{right,0.5}]}
% \polymerdelim[delimiters={[]}, height=40pt, depth=, indice=n]{left}{right}
%
%% option 2
% \chemfig{@{left}C(-[2])(-[6])=@{right}C(-[2])(-[6])}
% \polymerdelim[delimiters={[]}, height=40pt, depth=, indice=n,
% open xshift=-8pt, close xshift=]{left}{right}
%% option 3
\chemfig{C(-[2])(-[6])(-[@{left,1}4,.5,,,draw=none])=C(-[2])(-[6])-[@{right,1},.5,,,draw=none]}
\polymerdelim[delimiters={[]}, height=40pt, depth=, indice=n]{left}{right}
\arrow
\chemfig{R-C(-[2])(-[6])-C(-[2])(-[6])-[@{left,0.5}]C(-[2])(-[6])-C(-[2])(-[6])-[@{right,0.5}]C(-[2])(-[6])-\lewis{0.,C}(-[2])(-[6])}
\polymerdelim[delimiters ={[]}, height=40pt, depth=, indice=n]{left}{right}
\schemestop
\end{document}