使用 chemfig 定位电子运动箭头时遇到问题

使用 chemfig 定位电子运动箭头时遇到问题

chemfig我在使用版本定位红色箭头时遇到了麻烦1.52

我的结果

代码返回错误:

line 8: Package pgf Error: No shape named `db2' is known. ...rols +(+180:5mm) and +(+210:5mm) .. (ep2);}

这是我的代码。

\documentclass{article}
\usepackage{chemfig}
\begin{document}
    \setchemfig{atom sep=16pt, bond offset=0.75pt}
    \chemfig{-[::30]([@{db2}::60]=@{ep2}\charge{45=\:,135=\:}{O})-[@{sb2}::-60]=_[@{db1}::+60]-[@{sb1}::-60]@{ep1}\charge{-45=\:,-135=\:}{O}-[::60]}
    \chemmove[blue, shorten <=4pt, shorten >=3pt]{\draw(ep1) .. controls +(-135:5mm) and +(-120:5mm) .. (sb1);}
    \chemmove[blue, shorten <=2pt, shorten >=2pt]{\draw(db1) .. controls +(+120:4mm) and +(+60:4mm)  .. (sb2);}
    \chemmove[red,  shorten <=2pt, shorten >=2pt]{\draw(db2) .. controls +(+180:5mm) and +(+210:5mm) .. (ep2);}
\end{document}

这是预期的结果:

预期结果

这里发生了什么?我是否遗漏了什么?

答案1

您只是将其放在了@{db2}代码中的错误位置。

\documentclass{article}
\usepackage{chemfig}
\begin{document}
    \setchemfig{atom sep=16pt, bond offset=0.75pt}
    \chemfig{-[::30]([::60]@{db2}=@{ep2}\charge{45=\:,135=\:}{O})-[@{sb2}::-60]=_[@{db1}::+60]-[@{sb1}::-60]@{ep1}\charge{-45=\:,-135=\:}{O}-[::60]}
    \chemmove[blue, shorten <=4pt, shorten >=3pt]{\draw(ep1) .. controls +(-135:5mm) and +(-120:5mm) .. (sb1);}
    \chemmove[blue, shorten <=2pt, shorten >=2pt]{\draw(db1) .. controls +(+120:4mm) and +(+60:4mm)  .. (sb2);}
    \chemmove[red,  shorten <=2pt, shorten >=2pt]{\draw(db2) .. controls +(+180:5mm) and +(+210:5mm) .. (ep2);}
\end{document}

在此处输入图片描述

或者,为了标记双线,使用

\documentclass{article}
\usepackage{chemfig}
\begin{document}
    \setchemfig{atom sep=16pt, bond offset=0.75pt}
    \chemfig{-[::30](=[@{db2}::60]@{ep2}\charge{45=\:,135=\:}{O})-[@{sb2}::-60]=_[@{db1}::+60]-[@{sb1}::-60]@{ep1}\charge{-45=\:,-135=\:}{O}-[::60]}
    \chemmove[blue, shorten <=4pt, shorten >=3pt]{\draw(ep1) .. controls +(-135:5mm) and +(-120:5mm) .. (sb1);}
    \chemmove[blue, shorten <=2pt, shorten >=2pt]{\draw(db1) .. controls +(+120:4mm) and +(+60:4mm)  .. (sb2);}
    \chemmove[red,  shorten <=2pt, shorten >=2pt]{\draw(db2) .. controls +(+180:5mm) and +(+210:5mm) .. (ep2);}
\end{document}

在此处输入图片描述

相关内容