[Tex/LaTex] Getting double headed arrows with curly arrow above

arrowschemistry

I'm looking for a way to draw a double-headed arrow with a curly arrow above to depict a reversible chemical reaction with addition of another reagent.

The script I'm working with at the moment is as follows:

\documentclass[11pt]{article}
\usepackage{mychemistry}
\begin{document}
\setarrowlength{3em}
\large
\begin{rxn}
\reactant[,a]{E}
\chemand
\reactant[,a]{\ch{S1}}
\arrow[0,<=>]{}{}
\reactant[,a]{\ch{ES1}}
\arrow[0,<=>]{}{}
\reactant[,a]{\ch{E'P1}}
\arrow[0,<=>]{}{\arrow{P1}}
\reactant{\ch{E'}}
\arrow[0,-+>]{\ch{S2}}{}
\reactant[,a]{\ch{E'S2}}
\arrow[0,-+>]{}{\ch{P2}}
\reactant[,a]{\ch{E}}
\end{rxn}
\end{document}

Giving me the following output:
Reaction

Ideally, I'd like to amend this so that the 2 arrows from the right-hand side are double sided arrows, while still preserving the curly arrows above.

Best Answer

This is not easy to do with mychemistry. I recommend to use chemfig (which is loaded by mychemistry). It is more far more flexible and I believe the input is more convenient, too. chemfig lets you define own arrow types which can be used here. On texwelt I suggested the following solution for exactly this kind of arrow with chemfig.

enter image description here

Here is how it goes. The code may look a bit complicated but it's basically a copy of existing arrow definitions in chemfig. I added a few comments for explanation. It defines an arrow type <y> with several optional arguments:

% define new arrow `<y>' with 7 optional arguments:
% syntax:
% \arrow{-y>[<label arc begin>]%
%           [<label arc end>]%
%           [<label below>]%
%           [<ratio equilibrium arrows>]%
%           [<offset>]%
%           [<ratio arc radius/arrow length>]% default: 0.333
%           [<half angle of arc>]% default: 60
% }

The scheme itself is then created rather easy:

\schemestart
 \ch{E}
 \arrow{<=>}
 \ch{S1}
 \arrow{<=>}
 \ch{ES1}
 \arrow{<=>}
 \ch{E'P1}
 \arrow{<=>[][\ch{P1}]}
 \ch{E'}
 \arrow{<y>[\ch{S2}]}
 \ch{E'S2}
 \arrow{<y>[][\ch{P2}]}
 \ch{E}
\schemestop

The complete example

\documentclass[11pt]{article}
\usepackage{chemfig,chemformula}

\makeatletter
% define new arrow `<y>' with 7 optional arguments:
% syntax:
% \arrow{-y>[<label arc begin>]%
%           [<label arc end>]%
%           [<label below>]%
%           [<ratio equilibrium arrows>]%
%           [<offset>]%
%           [<ratio arc radius/arrow length>]% default: 0.333
%           [<half angle of arc>]% default: 60
% }
% this code is a combination of chemfig's arrow types `<=>' and `-U>'
%
\definearrow{7}{<y>}{%
    % offset:
    \CF@arrow@shift@nodes{#5}%
    % coordinates for equilibrium arrows:
    \ifx\@empty#4\@empty
    \else
      \pgfmathsetmacro\CF@tmp@stra{(1-#4)/2}%
      \pgfmathsetmacro\CF@tmp@strb{(1-#4)/2+#4}%
    \fi
    \edef\CF@tmp@str{%
      \noexpand\path[allow upside down](\CF@arrow@start@node)--(\CF@arrow@end@node)
        node[pos=0,sloped,yshift=1pt](\CF@arrow@start@node @u0){}
        node[pos=\ifx\@empty#4\@empty0\else\CF@tmp@stra\fi,sloped,yshift=-1pt]
          (\CF@arrow@start@node @d0){}
        node[pos=1,sloped,yshift=1pt](\CF@arrow@start@node @u1){}
        node[pos=\ifx\@empty#4\@empty1\else\CF@tmp@strb\fi,sloped,yshift=-1pt]
        (\CF@arrow@start@node @d1){};%
    }\CF@tmp@str
    % draw main arrows:
    \expandafter\draw\expandafter[\CF@arrow@current@style,-CF@half]
      (\CF@arrow@start@node @u0)--(\CF@arrow@start@node @u1)node[midway](yarrow@arctangent){};%
    \expandafter\draw\expandafter[\CF@arrow@current@style,CF@half-]
      (\CF@arrow@start@node @d0)--(\CF@arrow@start@node @d1);% is there label #1?
    \edef\CF@tmp@str{\ifx\@empty#1\@empty[draw=none]\fi}%
    % if yes draw left half of arc:
    \expandafter\draw\CF@tmp@str (yarrow@arctangent)%
        arc[
          radius=\CF@compound@sep*\CF@current@arrow@length*\ifx\@empty#6\@empty0.333\else#6\fi,
          start angle=\CF@arrow@current@angle-90,
          delta angle=-\ifx\@empty#7\@empty60\else#7\fi
        ]
        node(yarrow@start){};
    % is there label #2?
    \edef\CF@tmp@str{[\ifx\@empty#2\@empty draw=none,\fi-CF@full]}%
    % if yes draw secon half of arc:
    \expandafter\draw\CF@tmp@str (yarrow@arctangent)%
        arc[
          radius=\CF@compound@sep*\CF@current@arrow@length*\ifx\@empty#6\@empty0.333\else#6\fi,
          start angle=\CF@arrow@current@angle-90,
          delta angle=\ifx\@empty#7\@empty60\else#7\fi
        ]
        node(yarrow@end){};
    % place the labels - we need to no the sign of the offset here:
    \edef\CF@tmp@str{\if\string-\expandafter\@car\detokenize{#5.}\@nil-\else+\fi}%
    % place the labels #1 and #2:
    \CF@arrow@display@label{#1}{0}{\CF@tmp@str}{yarrow@start}{#2}{1}{\CF@tmp@str}{yarrow@end}%
    % place label #3:
    \CF@arrow@display@label{#3}{0.5}{-}{\CF@arrow@start@node}{}{}{}{\CF@arrow@end@node}%
}
\makeatother

\begin{document}

\schemestart
 \ch{E}
 \arrow{<=>}
 \ch{S1}
 \arrow{<=>}
 \ch{ES1}
 \arrow{<=>}
 \ch{E'P1}
 \arrow{<=>[][\ch{P1}]}
 \ch{E'}
 \arrow{<y>[\ch{S2}]}
 \ch{E'S2}
 \arrow{<y>[][\ch{P2}]}
 \ch{E}
\schemestop

\end{document}