3

I am trying to redraw reaction scheme using chemfig package. All works except curved line that should connect 2 nodes those are not neighbours. As it's described in chemfig manual, I added the following to the preamble (other tikz libraries are required to other schemes in document):

\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(@str22.south--@str32.north 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(@str24.south--@str35.north)
\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(@str42.north--@str31.south)
\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(@str32.south--@str44.north 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(@str34.south--@str46.north)
\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(@str51.north--@str42.south)
\arrow(@str44.south--str52.north[yshift=-2mm])[-90]
\chemfig{H_2C=[:-45]\chembelow{C}{*}H}
%\arrow(@str33.south--@str52.north 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(@str44.south--@str53.north 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 west--@str52.south east)
\schemestop}

\end{document}

When I try to add the missing arrow into working scheme (uncomment this string):

\arrow(@str33.south--@str52.north east){s>[+(-45:1cm)and+(45:1cm)]}

I get the following error message:

Package pgfkeys Error: I do not know the key '/tikz/CF' and I am going to ign ore it. Perhaps you misspelled it.

What am I doing wrong?

2

This is due to your not correctly copying the definition of the s> arrow from the documentation.

The line breaks before CF cause problems, as does the use of ,CF, instead of ,-CF.

You can replace your definition with the following:

\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

This will resolve the compilation error. You will, however, need to modify your use of this arrow to ensure that it is appropriately curved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.