我如何绘制红色弧(例如在 HO 中)和红线(例如在 C=C 中)。
我已经开始了:
\documentclass{standalone}
\usepackage{chemfig}
\setatomsep{2em}
\setbondstyle{line width=1pt}
\setlewis{}{}{line width=1pt}
\usepackage{chemmacros}
\begin{document}
\schemestart
\chemfig{@{a1}C(-[2]H)(-[4]H)(-[6]H)-@{a2}C(-[0]H)(-[2]H)(-[6]H)}
\chemmove{\draw[thick,green,-] ([shift=(65:15pt)]a1) arc (65:115:17pt);}
\chemmove{\draw[thick,green,-] ([shift=(155:15pt)]a1) arc (155:205:17pt);}
\chemmove{\draw[thick,green,-] ([shift=(245:15pt)]a1) arc (245:295:17pt);}
\chemmove{\draw[thick,green,-] ([shift=(-25:15pt)]a2) arc (-25:25:17pt);}
\chemmove{\draw[thick,green,-] ([shift=(65:15pt)]a2) arc (65:115:17pt);}
\chemmove{\draw[thick,green,-] ([shift=(245:15pt)]a2) arc (245:295:17pt);}
\schemestop
\end{document}
我怎样才能同质分割 CC 键,也就是画一条垂直于键的线,像这样 C-|-C
此外:我对我的解决方案没有信心:如果我更改“setatomsep”,我必须调整 chemmove 命令中的所有值。有没有更优雅的解决方案?
答案1
您是否考虑过使用一些简单的样式和箭头?
例如,
\documentclass[border=10pt]{standalone}
\usepackage{chemfig}
\setchemfig{
atom sep=2em,
bond style={line width=1pt},
lewis style={line width=1pt},
}
\usetikzlibrary{arrows.meta,decorations.markings}
\usepackage{chemmacros}
\tikzset{
my arc/.tip={Arc Barb[green,arc=60,length=1.5em]},
my split/.style={postaction=decorate,decoration={markings, mark=at position .5 with {\arrow[red]{Bar[width=1em]}}}}
}
\begin{document}
\schemestart
\chemfig{[,,,,-my arc]
@{a1}C(-[2]H)(-[4]H)(-[6]H)-[,,,,my split]@{a2}C(-[0]H)(-[2]H)(-[6]H)
}
\schemestop
\end{document}
请注意,根据手册,我更新了您的过时语法,这会在编译时生成警告并最终生成错误。