chemfig 中的倒置 -U> 箭头

chemfig 中的倒置 -U> 箭头

我想画这样的东西:

最通用的解决方案是类似于-X>在 chemfig 中写下方箭头(\arrow{-U>})的简单方法?“,这会产生错误。我尝试过的另一个定义是“chemfig 中弯曲箭头的位置标签?“但它缺少弯箭的尖端。

答案1

如果您想使用“在 chemfig 中写下方箭头(\arrow{-U>})的简单方法?",您可以在定义中更改-CF@full为。这对我来说有用。-CF


如果你想使用我的解决方案,我这里有一个改编版(非常简单),来自“chemfig 中弯曲箭头的位置标签?“。我在代码中使用注释中的箭头指出了这一点。

\makeatletter
\definearrow5{-u>}{%
    \CF@arrow@shift@nodes{#3}%
    \expandafter\draw\expandafter[\CF@arrow@current@style](\CF@arrow@start@node)--(\CF@arrow@end@node)node[midway](uarrow@arctangent){};%
    \CF@ifempty{#4}
    {\def\CF@uarrow@radius{0.333}}
    {\def\CF@uarrow@radius{#4}}%
    \CF@ifempty{#5}%
    {\def\CF@uarrow@absangle{60}}
    {\pgfmathsetmacro\CF@uarrow@absangle{abs(#5)}}
    %
    \edef\CF@tmp@str{[\CF@ifempty{#1}{draw=none}{\unexpanded\expandafter{\CF@arrow@current@style}},-]}%
    \expandafter\draw\CF@tmp@str (uarrow@arctangent)%
    arc[radius=\CF@compound@sep*\CF@current@arrow@length*\CF@uarrow@radius,start angle=\CF@arrow@current@angle+90,delta angle=\CF@uarrow@absangle]node(uarrow@start){};
    %
    \edef\CF@tmp@str{[\CF@ifempty{#2}{draw=none}{\unexpanded\expandafter{\CF@arrow@current@style}},-CF]}% <---------- `-CF` instead of `-`
    \expandafter\draw\CF@tmp@str (uarrow@arctangent)%
    arc[radius=\CF@compound@sep*\CF@current@arrow@length*\CF@uarrow@radius,%
    start angle=\CF@arrow@current@angle+90,%
    delta angle=-\CF@uarrow@absangle]%
    node(uarrow@end){};
    \pgfmathsetmacro\CF@tmp@str{\CF@uarrow@radius*cos(\CF@arrow@current@angle)<0?"+":"-"}%
    \ifdim\CF@uarrow@radius pt>\z@
    \CF@arrow@display@label{#1}{0}\CF@tmp@str{uarrow@start}{#2}{1}\CF@tmp@str{uarrow@end}%
    \else
    \CF@arrow@display@label{#2}{0}\CF@tmp@str{uarrow@start}{#1}{1}\CF@tmp@str{uarrow@end}%
    \fi
}
\makeatother

演示:

到达

完整代码:

\documentclass{article}
\usepackage{chemfig}

\makeatletter
\definearrow5{-u>}{%
    \CF@arrow@shift@nodes{#3}%
    \expandafter\draw\expandafter[\CF@arrow@current@style](\CF@arrow@start@node)--(\CF@arrow@end@node)node[midway](uarrow@arctangent){};%
    \CF@ifempty{#4}
    {\def\CF@uarrow@radius{0.333}}
    {\def\CF@uarrow@radius{#4}}%
    \CF@ifempty{#5}%
    {\def\CF@uarrow@absangle{60}}
    {\pgfmathsetmacro\CF@uarrow@absangle{abs(#5)}}
    %
    \edef\CF@tmp@str{[\CF@ifempty{#1}{draw=none}{\unexpanded\expandafter{\CF@arrow@current@style}},-]}%
    \expandafter\draw\CF@tmp@str (uarrow@arctangent)%
    arc[radius=\CF@compound@sep*\CF@current@arrow@length*\CF@uarrow@radius,start angle=\CF@arrow@current@angle+90,delta angle=\CF@uarrow@absangle]node(uarrow@start){};
    %
    \edef\CF@tmp@str{[\CF@ifempty{#2}{draw=none}{\unexpanded\expandafter{\CF@arrow@current@style}},-CF]}%
    \expandafter\draw\CF@tmp@str (uarrow@arctangent)%
    arc[radius=\CF@compound@sep*\CF@current@arrow@length*\CF@uarrow@radius,%
    start angle=\CF@arrow@current@angle+90,%
    delta angle=-\CF@uarrow@absangle]%
    node(uarrow@end){};
    \pgfmathsetmacro\CF@tmp@str{\CF@uarrow@radius*cos(\CF@arrow@current@angle)<0?"+":"-"}%
    \ifdim\CF@uarrow@radius pt>\z@
    \CF@arrow@display@label{#1}{0}\CF@tmp@str{uarrow@start}{#2}{1}\CF@tmp@str{uarrow@end}%
    \else
    \CF@arrow@display@label{#2}{0}\CF@tmp@str{uarrow@start}{#1}{1}\CF@tmp@str{uarrow@end}%
    \fi
}
\makeatother

\begin{document}
    \begin{center}
%       \schemedebug{true} % Activate if you want to see the nodes etc.
        \schemestart
        \arrow{-u>[$x$][$y$][][.5][]}
        \schemestop
    \end{center}
\end{document}

相关内容