1

So I'm using this piece of code I found for having arrows going off in different directions as part of some reaction schemes I'm putting together. I have been able to adjust the internal font sizes of different labels but am unsure as to how to define or adjust the length of the main horizontal arrow. Due to the quantity of gases being removed as part of the reaction, the arrow is fairly small comparatively to the length of the labels - hence, the end of the arrow is miles away from the products.

Original code:

\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

My problem:

\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 Answer 1

1

Found a fix in the end:

The length of an arrow can be set by adding a multiplier after the angle:

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

whereby the 2 is the multiplier of the arrow's size, so twice standard length and the 0 is the angle of the line.

So the example would be:

\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}

Additionally, a \hspace{-3em} (or appropriate length for problem) before the text after the arrow would minimise the large gap produced by the text on the curled arrow.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .