如何调整定义的多向箭头{-X>}的水平箭头长度?

如何调整定义的多向箭头{-X>}的水平箭头长度?

所以我用这段代码成立因为我正在整理一些反应方案,所以箭头指向不同的方向。我已经能够调整不同标签的内部字体大小,但不确定如何定义或调整主水平箭头的长度。由于反应中去除的气体量很大,箭头相对于标签的长度来说相当小 - 因此,箭头的末端距离产品有数英里远。

原始代码:

\makeatletter
% Arguments:
% #1, #2, #3, #4, #5, #6: Labels as shown in the output figure
% #7: yshift for the arrow, positive for upwards shift, vice versa
% #8: radius of arc (default 0.333)
% #9: angle for arc (default 60)
\definearrow9{-X>}{%
    \CF@arrow@shift@nodes{#7}%
    \expandafter\draw\expandafter[\CF@arrow@current@style](\CF@arrow@start@node)--(\CF@arrow@end@node)node[midway](Xarrow@arctangent){};%
    \CF@ifempty{#8}
    {\def\CF@Xarrow@radius{0.333}}
    {\def\CF@Xarrow@radius{#8}}%
    \CF@ifempty{#9}%
    {\def\CF@Xarrow@absangle{60}}
    {\pgfmathsetmacro\CF@Xarrow@absangle{abs(#9)}}
    % Draw top arrow (start)
    \edef\CF@tmp@str{[\CF@ifempty{#1}{draw=none}{\unexpanded\expandafter{\CF@arrow@current@style}},-]}%
    \expandafter\draw\CF@tmp@str (Xarrow@arctangent)%
    arc[radius=\CF@compound@sep*\CF@current@arrow@length*\CF@Xarrow@radius,start angle=\CF@arrow@current@angle-90,delta angle=-\CF@Xarrow@absangle]node(Xarrow1@start){};
    % Draw bottom arrow (end)
    \edef\CF@tmp@str{[\CF@ifempty{#2}{draw=none}{\unexpanded\expandafter{\CF@arrow@current@style}},-CF]}%
    \expandafter\draw\CF@tmp@str (Xarrow@arctangent)%
    arc[radius=\CF@compound@sep*\CF@current@arrow@length*\CF@Xarrow@radius,%
    start angle=\CF@arrow@current@angle-90,%
    delta angle=\CF@Xarrow@absangle]%
    node(Xarrow1@end){};
    % Draw bottom arrow (start)
    \edef\CF@tmp@str{[\CF@ifempty{#4}{draw=none}{\unexpanded\expandafter{\CF@arrow@current@style}},-]}%
    \expandafter\draw\CF@tmp@str (Xarrow@arctangent)%
    arc[radius=\CF@compound@sep*\CF@current@arrow@length*\CF@Xarrow@radius,start angle=\CF@arrow@current@angle+90,delta angle=\CF@Xarrow@absangle]node(Xarrow2@start){};
    % Draw bottom arrow (end)
    \edef\CF@tmp@str{[\CF@ifempty{#5}{draw=none}{\unexpanded\expandafter{\CF@arrow@current@style}},-CF]}%
    \expandafter\draw\CF@tmp@str (Xarrow@arctangent)%
    arc[radius=\CF@compound@sep*\CF@current@arrow@length*\CF@Xarrow@radius,%
    start angle=\CF@arrow@current@angle+90,%
    delta angle=-\CF@Xarrow@absangle]%
    node(Xarrow2@end){};
    % Insert labels
    \pgfmathsetmacro\CF@tmp@stra{\CF@Xarrow@radius*cos(\CF@arrow@current@angle)<0?"-":"+"}%
    \pgfmathsetmacro\CF@tmp@strb{\CF@Xarrow@radius*cos(\CF@arrow@current@angle)<0?"+":"-"}%
    \ifdim\CF@Xarrow@radius pt>\z@
        \CF@arrow@display@label{#1}{0}\CF@tmp@stra{Xarrow1@start}{#2}{1}\CF@tmp@stra{Xarrow1@end}%
        \CF@arrow@display@label{#4}{0}\CF@tmp@strb{Xarrow2@start}{#5}{1}\CF@tmp@strb{Xarrow2@end}%
        \CF@arrow@display@label{#3}{0.5}\CF@tmp@stra\CF@arrow@start@node{}{}{}\CF@arrow@end@node%
        \CF@arrow@display@label{#6}{0.5}\CF@tmp@strb\CF@arrow@start@node{}{}{}\CF@arrow@end@node%
    \else
        \CF@arrow@display@label{#2}{0}\CF@tmp@stra{Xarrow1@start}{#1}{1}\CF@tmp@stra{Xarrow1@end}%
        \CF@arrow@display@label{#5}{0}\CF@tmp@strb{Xarrow2@start}{#4}{1}\CF@tmp@strb{Xarrow2@end}%
        \CF@arrow@display@label{#3}{0.5}\CF@tmp@stra\CF@arrow@start@node{}{}{}\CF@arrow@end@node%
        \CF@arrow@display@label{#6}{0.5}\CF@tmp@strb\CF@arrow@start@node{}{}{}\CF@arrow@end@node%
    \fi
}
\makeatother

我的问题:

\documentclass{article}
\usepackage{chemfig}
\usepackage{chemist}
% <paste def. of -X> here>
\begin{document}
    \begin{center}
     \begin{chemmath}
        2VOC_{2}O_{4} + \text{3-x}Na_{2}SO_{4} + xK_{2}SO_{4} + 3(NH_{4})_{2}SO_{4}
        \schemestart
    \arrow{-X>[][{\fontsize{8}{8}$6NH_{3}+3H_{2}O+2CO+2CO_{2}$}][][][][{\fontsize{10}{10}$350 \degree C, Ar$}][5pt][0.333][80]}
        \schemestop
        2Na_{\text{3-x}}K_{x}V(SO_{4})_{3}
        \label{fig:reaction_scheme}
        \end{chemmath}
    \end{center}
\end{document}

答案1

最终找到了解决办法:

箭头的长度可以通过在角度后添加乘数来设置:

\arrow{-X>[][$6NH_{3}+3H_{2}O+2CO+2CO_{2}$][][][][$350 \degree C, Ar$][5pt][0.333][80]}[0, 2]

其中2是箭头尺寸的乘数,即标准长度的两倍,0是线的角度。

因此示例如下:

\documentclass{article}
\usepackage{chemfig}
\usepackage{chemist}
% <paste def. of -X> here>
\begin{document}
    \begin{center}
     \begin{chemmath}
        2VOC_{2}O_{4} + \text{3-x}Na_{2}SO_{4} + xK_{2}SO_{4} + 3(NH_{4})_{2}SO_{4}
        \schemestart
    \arrow{-X>[][$6NH_{3}+3H_{2}O+2CO+2CO_{2}$][][][][$350 \degree C, Ar$][5pt][0.333][80]}[0, 2]
        \schemestop
        2Na_{\text{3-x}}K_{x}V(SO_{4})_{3}
        \label{fig:reaction_scheme}
        \end{chemmath}
    \end{center}
\end{document}

此外,\hspace{-3em}箭头后的文本前的(或适合问题的长度)将最大限度地减少卷曲箭头上的文本产生的大间隙。

相关内容