对 定义的子分子进行着色的正确方法是什么\definesubmol
?
平均能量损失
\documentclass[12pt]{article}
\usepackage{float}
\usepackage{chemfig}
\usepackage{chemmacros}
\chemsetup{
modules = all,
}
\begin{document}
\begin{figure}[H]
\centering
\definesubmol{pvc}{CH_2-CH(-[:90]Cl)}
\chemfig{-!{pvc}- \color{green}{!{pvc}} -!{pvc}-}
\end{figure}
\end{document}
答案1
根据以下帖子回答这里
\documentclass[12pt]{article}
\usepackage{float}
\usepackage{chemfig}
\usepackage{chemmacros}
\chemsetup{
modules = all,
}
\begin{document}
\def\GREEN{\gdef\printatom##1{\color{green}\ensuremath{\mathrm{##1}}}}
\def\BLACK{\gdef\printatom##1{\color{black}\ensuremath{\mathrm{##1}}}}
\begin{figure}[H]
\centering
\definesubmol{pvc}{CH_2-CH(-[:90]Cl)}
\chemfig{-!{pvc}(-[,,,,draw=none]\GREEN)([,,,,green]-!{pvc}-)\BLACK!{pvc}-}
\end{figure}
\end{document}