无法正确运行 chemfig 模块

无法正确运行 chemfig 模块

我以前用乳胶做过结构公式,但现在我想用电子运动箭头和一切来构造反应机制。我使用了一些示例代码来尝试了解原理,但它不起作用。有些命令显然不起作用,箭头指向任何地方,但不是我想要它们去的地方。这是我的文件:

\documentclass[a4paper,10pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{chemfig}
\usepackage{chemmacros}

\begin{document}

\chemsetup[chemformula]{format=\sffamily}
\renewcommand*\printatom[1]{\ensuremath{\mathsf{#1}}}
\setatomsep{2em}
\setdoublesep{.6ex}
\setbondstyle{semithick}

\section{A}

\setatomsep{7mm}
\setchemrel{}{}{5mm}
\chemfig{R-@{dnl}\lewis{26,O}-H}
\chemsign{+}
\chemfig{R-@{atoc}C([6]-OH)=[@{db}]O}
\chemrel[\chemfig{@{atoh}\chemabove{H}{\scriptstyle\oplus}}]{<>}
\chemmove[->,shorten <=2pt]{
\draw[shorten >=2pt](dnl)..controls +(90:1cm)and+(north:1cm)..(atoc);
\draw[shorten >=6pt](db)..controls +(north:5mm)and+(100:1cm)..(atoh);}

\bigskip

\end{document}

命令“ \chemrel”、“ \chemsign”和“ \setchemrel”有误。我是不是漏掉了什么?

答案1

是的,你确实错过了一些东西:\setchemreletc 自从chemfig功能完整方案(自 v1.0 2011/06/15 以来)以来已被弃用。它们已在 v1.2 2015/10/08 中删除。只需使用\schemestart ... \arrow ... \schemestop

\documentclass[a4paper,10pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{chemfig}
\usepackage{chemmacros}

\renewcommand*\printatom[1]{\ensuremath{\mathsf{#1}}}
\setatomsep{2em}
\setdoublesep{.6ex}
\setbondstyle{semithick}

\begin{document}

\section{A}

\schemestart
  \chemfig{R-@{dnl}\lewis{26,O}-H}
  \+
  \chemfig{R-@{atoc}C([6]-OH)=[@{db}]O}
  \arrow(.10--){<=>[\chemfig{@{atoh}\chemabove{H}{\scriptstyle\fplus}}]}
  \chemfig{R-C([6]-OH)(-[2]\chemabove{O}{\scriptstyle\fplus}(-[4]R)-[0]H)-O-H}
\schemestop

\chemmove[->,shorten <=2pt]{
  \draw[shorten >=2pt](dnl)..controls +(90:1cm)and+(north:1cm)..(atoc);
  \draw[shorten >=6pt](db)..controls +(north:5mm)and+(100:1cm)..(atoh);
}

\end{document}

在此处输入图片描述

相关内容