1

Is it possible to \definearrow to just put a + sign ?

I would like to cross reactions, to draw this chemical pathway (whose source code is at bottom of this question):

enter image description here

I have overlapped plus signs over invisible links, and I wonder if there are better solutions.

Here is a smaller example where I used overlaps:

\documentclass{standalone}
\usepackage{chemfig}
\setatomsep{2em}
\setdoublesep{.3em}
\definearrow1{p}{+}
\begin{document}
%   \schemedebug{true} % for debugging only
    \schemestart
A \arrow(--DPPH){p}[,0.3] \llap{+ }
\chemfig{DPPH^o}\arrow{<=>[1][2]}
DPPHH\rlap{ +}\arrow{p}[,0.3]
\chemfig{*6(=(-CH=[::90]CH-[::90]COOH)-=(-OCH3)-(-OH)=(^o\kern2mm)-)} \arrow(--cc){<->}[-90,0.7]
C \arrow(--AO){p}[180,0.3]
longC\rlap{ +} \arrow(--HH){->[4]}[180]
HH  \arrow{p}[-90,0.1]
\chemfig{\mathop{DPPH^o}\limits^{\mathop+\limits_{\,}}}  \arrow{<=>[5][6]}[-90]
\chemfig{\mathop{DPPHH}\limits_{\mathop+\limits^{\,}}}\arrow{p}[-90,0.1]
Hp \arrow{p}[,0.3]
\llap{ +}\chemfig{DPPH^o} \arrow{->[7]}
DPPHH + OO
% ramifications.
\arrow(@AO--){p}[-90,0.1] \chemfig{\mathop{DPPH^o}\limits^{\mathop+\limits_{\,}}} \arrow{->[3]}[-90] aduit
\arrow(@DPPH--){->[8]}[-90] DPPHH
       \schemestop
\end{document}

which gives that:

enter image description here

I used invisible arrows also used on chemfig: vertical alignment of coefficient Is it possible to \definearrow to just put a + sign ?

\documentclass{standalone}
\usepackage{chemfig}
\setatomsep{2em}
\setdoublesep{.3em}
% \definearrow1{0}{+} % implicite ...
\begin{document}
\def\AO#1#2#3#4{\chemfig{*6(=(-=[::#160]-[::#260]COOH)-=(-O-[::60])-(-O#3)=#4-)}}
\def\AOAO#1#2#3{\chemfig{*6(=(-=[::60]-[::-60]COOH)-=(-O-[::60])-(-O#1)=(-*6(-=(-=[::60]-[::-60]COOH)-=(-O-[::60])-(-O#2)=))-)}}
%   \schemedebug{true} % for debugging only
    \schemestart
DPPHH \arrow{<-[*{0}8]}[-90]
\chemfig{DPPH^o}\rlap{ +} \arrow{0}[,0.3]
\AO{}-H{} \arrow{<=>[*{0}1][*{0}2]}
DPPHH\rlap{ +}\arrow{0}[,0.3]
\AO{}-{^o}{} \arrow(--cc){<->}[-90,0.7]
\AO{}-H{(^o\kern2mm)}  \arrow{0}[180,0.3]
\AO{}-H{(^o\kern2mm)}\rlap{ +} \arrow(AO--AOAO){0}[180]% blank, see below.
\AOAO{H}H{}  \arrow{0}[-90,0.1]
\chemfig{\mathop{DPPH^o}\limits^{\mathop+\limits_{\,}}}  \arrow{<=>[*{0}5][*{0}6]}[-90]
\chemfig{\mathop{DPPHH}\limits_{\mathop+\limits^{\,}}}\arrow{0}[-90,0.1]
\AOAO{^o}{H}- \arrow{0}[,0.3] \arrow{0}[-90,0.6]% le second arrow de cette ligne pour faire de la place l'aduit.
\llap{ +}\chemfig{DPPH^o} \arrow{->[*{0}7]}
DPPHH\rlap{ +}\arrow{0}[90,0.6]\arrow{0}[,0.9] % le premier arrow de cette ligne pour faire de la place l'aduit.
\chemfig{*6(=(-=[::60]-[::-60]COOH)-=(-O-[::60])-(=O)-(=*6(-=(-=[::60]-[::-60]COOH)-=(-O-[::60])-(=O)-))-)}
%
% ramifications
% aduit
\arrow(@AO--){0}[-90,0.1] \chemfig{\mathop{DPPH^o}\limits^{\mathop+\limits_{\,}}} \arrow{->[*{0}3]}[-90]
\AO-{}H{(-DPPH)}
% autoruction:
       % to have displayed above the arrow, don't use \arrow(AO--AOAO){->[][*{0}4]}[180]
\arrow(@AOAO--@AO){<-[\strut][*{0}4]}
\schemestop
\end{document}
  • Also, I am not satisfied of the placement of "4" in fourth arrow of my complete example, but this is a different question. – user2987828 Dec 14 '17 at 10:47
2

You can \definearrow a + sign: the following simple modification of the example in Section 10.1 of the Chemfig manual achieves this:

\makeatletter
\definearrow{2}{p}{%
    \expandafter\path\expandafter[\CF@arrow@current@style,-CF](\CF@arrow@start@node)--(\CF@arrow@end@node)
    node[midway, anchor=center]{+};
    \CF@arrow@display@label{#1}{0.5}{+}{\CF@arrow@start@node}{#2}{0.5}{-}{\CF@arrow@end@node}
}
\makeatother

You can use it like this:

\arrow{p}

It draws an invisible arrow, and places a node with a + sign in the middle. For some reason, naming the arrow + gave errors, so I named it p. The code also allows you to place labels on top and below the + sign, in case you might want to do that. Here is the complete code:

\documentclass{standalone}
\usepackage{chemfig}
\setatomsep{2em}
\setdoublesep{.3em}

\makeatletter
\definearrow{2}{p}{%
    \expandafter\path\expandafter[\CF@arrow@current@style,-CF](\CF@arrow@start@node)--(\CF@arrow@end@node)
    node[midway, anchor=center]{+};
    \CF@arrow@display@label{#1}{0.5}{+}{\CF@arrow@start@node}{#2}{0.5}{-}{\CF@arrow@end@node}
}
\makeatother

\begin{document}
    \def\AO#1#2#3#4{\chemfig{*6(=(-=[::#160]-[::#260]COOH)-=(-O-[::60])-(-O#3)=#4-)}}
    \def\AOAO#1#2#3{\chemfig{*6(=(-=[::60]-[::-60]COOH)-=(-O-[::60])-(-O#1)=(-*6(-=(-=[::60]-[::-60]COOH)-=(-O-[::60])-(-O#2)=))-)}}
    %   \schemedebug{true} % for debugging only
    \schemestart
    DPPHH \arrow{<-[*{0}8]}[-90]
    \chemfig{DPPH^o} \arrow{p}[,0.3]
    \AO{}-H{} \arrow{<=>[*{0}1][*{0}2]}
    DPPHH\arrow{p}[,0.3]
    \AO{}-{^o}{} \arrow(--cc){<->}[-90,0.7]
    \AO{}-H{(^o\kern2mm)}  \arrow{0}[180,0.3]
    \AO{}-H{(^o\kern2mm)} \arrow(AO--AOAO){0}[180]% blank, see below.
    \AOAO{H}H{}  \arrow{p}[-90,0.3]
    \chemfig{DPPH^o}  \arrow{<=>[*{0}5][*{0}6]}[-90]
    \chemfig{DPPHH}\arrow{p}[-90,0.3]
    \AOAO{^o}{H}- \arrow(AOAO2.340--){p}[,0.3] % le second arrow de cette ligne pour faire de la place l'aduit.
    \chemfig{DPPH^o} \arrow{->[*{0}7]}
    DPPHH\arrow{p}[,0.9] % le premier arrow de cette ligne pour faire de la place l'aduit.
    \chemfig{*6(=(-=[::60]-[::-60]COOH)-=(-O-[::60])-(=O)-(=*6(-=(-=[::60]-[::-60]COOH)-=(-O-[::60])-(=O)-))-)}
    %
    % ramifications
    % aduit
    \arrow(@AO--){p}[-90,0.3] \chemfig{DPPH^o} \arrow{->[*{0}3]}[-90]
    \AO-{}H{(-DPPH)}
    % autoruction:
    % to have displayed above the arrow, don't use \arrow(AO--AOAO){->[][*{0}4]}[180]
    \arrow(@AOAO--@AO){<-[\strut][*{0}4]}
    \schemestop
\end{document}
  • 1
    Thanks it worked very well! I just edited your answer to use \arrow{p} in two vertical reactions, which made ugly \mathop and \limits no more necessary. – user2987828 Dec 15 '17 at 8:42
  • 1
    @user2987828 True, I missed those! I also fixed the line where you comment "% le second arrow de cette ligne pour faire de la place l'aduit". Instead of drawing two invisible arrows, you can use anchors to make your arrow start at a different point of your compound. The statement \arrow(AOAO2.340--){p}[,0.3] draws an arrow that does not start at the middle of the right boundary of your compound, but at a point below that. The number 340 is an angle measured in degrees w.r.t the horizontal line, see tex.stackexchange.com/a/199827/150114 . – javi_gg1 Dec 15 '17 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.