[Tex/LaTex] How do we mirror a reversible reaction arrow in chemfig

arrowschemfig

In Chemfig, the reversible reactions are represented with a double harpoon. The top one goes from the left to the right, the bottom from the right to the left. One can rotate this double arrow. But I could not find a way to mirror it, like \leftrighharpoon in the package mathrel. This seems silly, but my reactions diagrams are very big and intricated, so the relative position of forward and reverse matter.

I am sorry if I missed something in the manual or in the previous questions asked on this forum.

Best Answer

The best way is to define a new arrow. You can do it like this:

\documentclass{article}
\usepackage{chemfig}

\makeatletter
    \pgfarrowsdeclare{revhalf}{revhalf}%
    {\CF@arrow@size\dimexpr2.5pt+2.5\pgflinewidth\relax
    \pgfarrowsleftextend{-\CF@arrow@size}\pgfarrowsrightextend{.5\pgflinewidth}}%
    {\CF@arrow@size\dimexpr2.5pt+2.5\pgflinewidth\relax
    \pgfsetdash{}\z@\pgfsetroundjoin\pgfsetroundcap
    \pgfpathmoveto{\pgfpoint\z@\z@}%
    \pgfpathlineto{\pgfpoint{-\CF@arrow@size}{-.5\CF@arrow@size}}%
    \pgfpathlineto{\pgfpoint{-.5\CF@arrow@size}\z@}%
    \pgfpathlineto{\pgfpoint\z@\z@}%
    \pgfusepathqfillstroke}

\definearrow3{<==>}{%
    \CF@arrow@shift@nodes{#3}%
    \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=0,sloped,yshift=-1pt](\CF@arrow@start@node @d0){}%
            node[pos=1,sloped,yshift=1pt](\CF@arrow@start@node @u1){}%
            node[pos=1,sloped,yshift=-1pt](\CF@arrow@start@node @d1){};%
        }%
    \CF@tmp@str
    \expandafter\draw\expandafter[\CF@arrow@current@style,revhalf-](\CF@arrow@start@node @u0)--(\CF@arrow@start@node @u1);%
\expandafter\draw\expandafter[\CF@arrow@current@style,-revhalf](\CF@arrow@start@node @d0)--(\CF@arrow@start@node @d1);%
    \CF@arrow@display@label{#1}{0.5}+\CF@arrow@start@node{#2}{0.5}-\CF@arrow@end@node%
}
\makeatother


\begin{document}

Normal:

\schemestart
\chemfig{A}
\arrow{<=>}[45]
\chemfig{B}
\arrow{<=>}
\chemfig{C}
\schemestop

Reversed:

\schemestart
\chemfig{A}
\arrow{<==>}[45]
\chemfig{B}
\arrow{<==>}
\chemfig{C}
\schemestop

\end{document}

enter image description here

I know it can be probably done better and easier, but it should do the work.

Related Question