Math & Sciencechemfig | Custom Arrows in Reaction Schemes

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
niteshs
Posts: 45
Joined: Wed Jun 06, 2012 9:57 pm

chemfig | Custom Arrows in Reaction Schemes

Post by niteshs »

Hi,

I am trying to produce a reaction scheme with curved arrows as shown in this example (the structures are purely for example):
react1.png
react1.png (8.41 KiB) Viewed 13529 times
I have been able to create the basic scheme with the following code:

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{chemfig}
\begin{document}
%\schemedebug{true}
\schemestart
\tiny\chemname{\chemfig{*6(-=-(-R2)=-*6(-(-R1)=-(-*5(-----))--)=)}}{\small Some structure}
\arrow(.-10--){->[Text]}[,3]
\tiny\chemname{\chemfig{*6(=-*6(-=-=-)=-=-)}}{\small Another structure}
\arrow{0}[,0.5]
+\arrow{0}[,0.5]
\tiny\chemname{\chemfig{[:20]*5(-----)}}{\small And another}
\schemestop
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
which produces the following result:
react2.png
react2.png (3.79 KiB) Viewed 13529 times
I don't know how to add the curved arrows.
Can someone help me with this please?
Last edited by niteshs on Fri Sep 07, 2012 5:42 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
niteshs
Posts: 45
Joined: Wed Jun 06, 2012 9:57 pm

chemfig | Custom Arrows in Reaction Schemes

Post by niteshs »

I guess I could have made the MWE much more simpler as follows:

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{chemfig}
\begin{document}
\schemestart
A\arrow{->[Text]}[,3]
B\arrow{0}[,0.5]+\arrow{0}[,0.5]
C
\schemestop
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

chemfig | Custom Arrows in Reaction Schemes

Post by cgnieder »

The following is a quick solution so I guess there are probably better ones. ChemFig provides the command \definearrow and some others (see section 10 of part V in the manual). The code below adapts the definition of the -U> arrow made by ChemFig:

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{chemfig}
\makeatletter
\definearrow5{-n>}{% #4=coeff du rayon de l'arc de cercle #5=1/2 angle
\CF@arrow@shift@nodes{#3}%
\expandafter\draw\expandafter[\CF@arrow@current@style,-CF@full](\CF@arrow@start@node)--(\CF@arrow@end@node)node[pos=.2](narrow@arctangent@i){} node[pos=.5](narrow@arctangent@ii){};%
\edef\CF@tmp@str{[\ifx\@empty#1\@empty draw=none,\fi-CF@full]}%
\expandafter\draw\CF@tmp@str (narrow@arctangent@i)%
arc[radius=\CF@compound@sep*\CF@current@arrow@length*\ifx\@empty#4\@empty0.333\else#4\fi,start angle=\CF@arrow@current@angle+90,%
delta angle=-\ifx\@empty#5\@empty60\else#5\fi]node(narrow@start){};
\edef\CF@tmp@str{[\ifx\@empty#2\@empty draw=none,\fi-CF@full]}%
\expandafter\draw\CF@tmp@str (narrow@arctangent@ii)%
arc[radius=\CF@compound@sep*\CF@current@arrow@length*\ifx\@empty#4\@empty0.333\else#4\fi,start angle=\CF@arrow@current@angle+90,%
delta angle=-\ifx\@empty#5\@empty60\else#5\fi]node(narrow@end){};
\edef\CF@tmp@str{\if\string-\expandafter\@car\detokenize{#4.}\@nil+\else-\fi}%
\CF@arrow@display@label{#1}{0}\CF@tmp@str{narrow@start}{#2}{1}\CF@tmp@str{narrow@end}%
}
\makeatother
\begin{document}
\schemestart
A \arrow{-n>[1][2]}[,2] B
\schemestop
\schemestart
\subscheme{A \arrow{-n>[1][2]}[,2] B}
\arrow{0}[90,0]text
\schemestop
\schemestart
A \arrow{-n>[*01][*02]}[-90,2] B
\schemestop
\end{document}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
customarrow.png
customarrow.png (7.88 KiB) Viewed 13519 times
Regards
site moderator & package author
niteshs
Posts: 45
Joined: Wed Jun 06, 2012 9:57 pm

Re: chemfig | Custom Arrows in Reaction Schemes

Post by niteshs »

Excellent! Thank you cgnieder!
Post Reply