Chemfig:包 pgfkeys 错误:我不知道密钥“/tikz/CF”

Chemfig:包 pgfkeys 错误:我不知道密钥“/tikz/CF”

我正在尝试使用 chemfig 包重新绘制反应方案。除了应该连接 2 个非邻居节点的曲线外,其他所有方法都有效。正如 chemfig 手册中所述,我在序言中添加了以下内容(文档中的其他方案需要其他 tikz 库):

\documentclass{report}
\usepackage[T2A]{fontenc}
\usepackage[cp1251]{inputenc}
\usepackage[english,russian]{babel} 
\usepackage{chemfig}
\usepackage{tikz}
\usetikzlibrary{decorations,arrows,shapes,snakes,automata,positioning}


\makeatletter
\definearrow1{s>}{%
\ifx\@empty#1\@empty
\expandafter\draw\expandafter[\CF@arrow@current@style,CF](\
CF@arrow@start@node)(\
CF@arrow@end@node);%
\else
\def\curvedarrow@style{shorten <=\CF@arrow@offset,shorten >=\CF@arrow@offset,}%
\CF@expadd@tocs\curvedarrow@style\CF@arrow@current@style
\expandafter\draw\expandafter[\curvedarrow@style,CF](\
CF@arrow@start@name)..controls#1..(\CF@arrow@end@name);
\fi
}
\makeatother

\begin{document}
\setchemfig{scheme debug=false}

\pgfdeclaredecoration{ddbond}{initial}{%
\state{initial}[width=2pt]{%
\pgfpathlineto{\pgfpoint{2pt}{0pt}}%
\pgfpathmoveto{\pgfpoint{1.5pt}{2pt}}%
\pgfpathlineto{\pgfpoint{2pt}{2pt}}%
\pgfpathmoveto{\pgfpoint{2pt}{0pt}}%
 }%
\state{final}{%
\pgfpathlineto{\pgfpointdecoratedpathlast}%
 }%
 }%
\tikzset{lddbond/.style={decorate,decoration=ddbond}}%
\tikzset{rddbond/.style={decorate,decoration={ddbond,mirror}}}

\scalebox{.7}{
\schemestart
\chemfig{H_3C-[:-30]CH_2-[:30]C(=[:90]O)-[:-30]OH}
\arrow(str1.south west--str21.north east[yshift=2mm])[-150,1.71]
\chemfig{H_3C-[:-30]CH_2-[:30]\chembelow{C}{*}=[:90]O}
\arrow(@str1.south--str22.north)[-135]
\chemfig{H_3C-[:-30]\chemabove{C}{*}H-[:30]C(=[:90]O)-[:-30]OH}
\arrow(str22.east--str23.west)[,0.5]
\chemfig{H_3C-[:-30]\chembelow{C}{**}H}
\arrow(@str1.south east--str24.north west[yshift=0mm])[-30,1.71]
\chemfig{H_3C-[:-30]CH_2-[:30]C(-[:75,,,,rddbond]O)(-[,0.5,,,draw=none]\chemabove{\hphantom{H}}{*})-[:-45,,,,lddbond]O}
\arrow(@str21.south west--str31.north east[yshift=-4mm])[-135,1.41]
\chemfig{H_3C-[:-45]\chembelow{C}{*}H_2}
\arrow(@str21.south west--str32.north)[-90]
\chemfig{H_3C-[:-45]\chemabove{C}{*}H-[:30]\chembelow{C}{*}=[:90]O}
\arrow(@[email protected] east)[-135,1.41]
\arrow(@str22.south--str33.north)[-140, 1.45]
\chemfig{H_2C=[:-30]CH-[:30]C(=[:90]O)-[:-30]OH}
\arrow(@str22.south--str34.north)[-40,1.45]
\chemfig{H_3C-[:-30]\chembelow{C}{**}-[:30]C(=[:90]O)-[:-30]OH}
\arrow(@str22.south--str35.north west[yshift=2mm])[-22.5,3]
\chemfig{H_3C-[:-30]\chembelow{C}{*}H-[:30]C(-[:75,,,,rddbond]O)(-[,0.5,,,draw=none]\chemabove{\hphantom{H}}{*})-[:-45,,,,lddbond]O}
\arrow(@[email protected])
\arrow(@str24.south--str36.north[yshift=-4mm])[-45, 1.41]
\chemfig{H_3C-[:-30]\chembelow{C}{*}H_2}
\arrow(@str31.south west--str41.north[yshift=-6mm])[-135, 1.41]
\chemfig{H_3C-[:-30]CH_3}
\arrow(@str32.south--str42.north east[yshift=-2mm])[-135, 1.41]
\chemfig{H_3C-[:-30]\chembelow{C}{**}H}
\arrow(@[email protected])
\arrow(@str32.south--str43.north)[-90]
\chemfig{H_3C-[:-45]\chemabove{C}{*}=[:30]C=[:90]O}
\arrow(@str33.south--str44.north)[-120,1.2]
\chemfig{H_2C=[:-30]CH-[:30]\chembelow{C}{*}=[:90]O}
\arrow(@[email protected] west)
\arrow(@str33.south--str45.north[yshift=-3mm])[-30,1.6]
\chemfig{H\chemabove{C}{*}=[:-30]CH-[:30]C(=[:90]O)-[:-30]OH}
\arrow(@str35.south--str46.north[yshift=3mm])[-135,1.41]
\chemfig{H_3C-[:-30]\chembelow{C}{**}-[:30]C(-[:75,,,,rddbond]O)(-[,0.5,,,draw=none]\chemabove{\hphantom{H}}{*})-[:-45,,,,lddbond]O}
\arrow(@[email protected])
\arrow(@str35.south--str47.north)[-45,1.41]
\chemfig{H_3C-[:-30]\chembelow{C}{**}H}
\arrow(@str43.south--str51.north east[yshift=-2mm])[-135, 1.41]
\chemfig{H_3C-[:-30]\chembelow{C}{***}}
\arrow(@[email protected])
\arrow(@str44.south--str52.north[yshift=-2mm])[-90]
\chemfig{H_2C=[:-45]\chembelow{C}{*}H}
%\arrow(@[email protected] east){s>[+(-45:1cm)and+(45:1cm)]}
\arrow(@str45.south--str53.north[yshift=3mm])[-90]
\chemfig{H\chemabove{C}{*}=[:-30]CH-[:30]\chembelow{C}{*}=[:90]O}
\arrow(@[email protected] west[yshift=2mm])
\arrow(@str46.south--str54.north[yshift=-2mm])[-90]
\chemfig{H_3C-[:-30]\chembelow{C}{***}}
\arrow(@str52.south--str62.north[yshift=-2mm])[-90]
\chemfig{H_2C=[:-45]CH_2}
\arrow(@str62.west--str61.east)[180]
\chemfig{H_3C-[:-45]\chembelow{C}{*}H_2}
\arrow(@str53.south--str63.north)[-90]
\chemfig{HC~[:-45]CH}
\arrow(@str63.north [email protected] east)
\schemestop}

\end{document}

当我尝试将缺失的箭头添加到工作方案中(取消注释此字符串)时:

\arrow(@[email protected] east){s>[+(-45:1cm)and+(45:1cm)]}

我收到以下错误消息:

软件包 pgfkeys 错误:我不知道密钥“/tikz/CF”,我将忽略它。也许你拼错了。

我究竟做错了什么?

答案1

这是由于您没有正确复制s>箭头的定义文档

之前的换行符CF会导致问题,使用,CF, 而不是 也会导致问题,-CF

您可以用以下内容替换您的定义:

\makeatletter
\definearrow1{s>}{%
\ifx\@empty#1\@empty
\expandafter\draw\expandafter[\CF@arrow@current@style,-CF](\CF@arrow@start@node)(\CF@arrow@end@node);%
\else
\def\curvedarrow@style{shorten <=\CF@arrow@offset,shorten >=\CF@arrow@offset,}%
\CF@expadd@tocs\curvedarrow@style\CF@arrow@current@style
\expandafter\draw\expandafter[\curvedarrow@style,-CF](\CF@arrow@start@name)..controls#1..(\CF@arrow@end@name);
\fi
}
\makeatother

这将解决编译错误。但是,您需要修改此箭头的使用,以确保其弯曲度适当。

相关内容