\definearrow
只放一个 + 号可以吗?
我想进行交叉反应,绘制这条化学途径(其源代码位于本问题的底部):
我已经将加号与隐形链接重叠,想知道是否有更好的解决方案。
下面是一个我使用重叠的较小的例子:
\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}
得出:
我使用了隐形箭,也用在chemfig:系数的垂直对齐\definearrow
只放一个 + 号 可以吗?
\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}
答案1
您\definearrow
可以+
:下面对第 10.1 节中的示例进行简单的修改Chemfig 手册实现这一点:
\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
你可以像这样使用它:
\arrow{p}
它绘制一个不可见的箭头,并+
在中间放置一个带符号的节点。出于某种原因,命名箭头+
会出现错误,所以我将其命名为p
。代码还允许您在 + 号的上方和下方放置标签,以防万一您想要这样做。以下是完整代码:
\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}