# How to put atom on top in chemfig and change position of arrow

I have provided two starting points to solve my problem:

# Option 1

I am trying to move the arrow head to a higher point (somewhere in the middle of the upper love of the p orbital) and make the boron atom come on top of the p orbital not underneath in the following figure:

My code so far is:

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}

\makeatletter
\usepackage{chemfig}
\usepackage{tikz}
\usepackage{chemmacros}
\usechemmodule{orbital}

\makeatother

\usepackage{babel}
\begin{document}
\setchemfig{cram width=3pt}
\chemsetup[orbital]{
overlay ,
opacity = .55,
}
\schemestart
\chemfig{H>:[:40,0.8]@{N}\Lewis{2:,N}(<[:-110,0.8]H)-[:-40]H}
\+
\chemfig{F-@{B}B(-[2,0.1,,,draw=none]{{\orbital[phase=-]{p}}})(<[:-20]F)<:[:20]F}
\arrow{->}
\chemfig{H>:[:-40,0.8]\chembelow[0.5pt]{N}{\scriptstyle\hspace{4.5mm}\oplus}(<[:110,0.8]H)(-[:40]H)-[:-90]\chemabove[0.5pt]{B}{\scriptstyle\hspace{4.5mm}\ominus}(<:[:-40,0.8]F)(<[:-70,0.8]F)-[:-140]F}
\schemestop
\chemmove[shorten <=2pt]{
\draw (N) ..controls +(90:1cm)and+(90:2cm)..(B);
}
\end{document}


How would I do the things I suggested above:

(1) Change the position of the arrow to the middle of the upper lobe of the p orbital

(2) Put the Boron atom on top of the P orbital

# Option 2

Alternatively instead of the chemmacro orbital I would be happy with placing the following tikz picture where the boron is:

\begin{tikzpicture}[scale=1]
\node (B) at (0,0) {B};
\draw (-0.1,0.2) ..controls +(120:1) and +(60:1).. (0.1,0.2);
\draw[fill=black!10] (-0.1,-0.2) ..controls +(-120:1) and +(-60:1).. (0.1,-0.2);
\end{tikzpicture}


Unfortunately, when I try to include it in the compound, the reaction scheme arrow goes to the bottom left corner of the page and the tikzpicture covers most of the compound. I would like for the compound to appear normally and the arrow to again go into somewhere in the middle of the upper lobe of the p orbital (the shape defined by \draw (-0.1,0.2) ..controls +(120:1) and +(60:1).. (0.1,0.2);)

As such I would like the final product to be somewhat like this (the red is my annotations):

It is fairly easy to move the orbital wherever you like: place an invisible B in the chemfig and draw the orbital and then the real B per overlay.

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[outline]{contour}
\usepackage{chemfig}
\usepackage{tikz}
\usepackage{chemmacros}
\usechemmodule{orbital}

\usepackage{babel}

\newsavebox\Orbital
\begin{lrbox}{\Orbital}
\orbital[phase=-,color=gray!70]{p}
\end{lrbox}
\begin{document}
\setchemfig{cram width=3pt}
\chemsetup[orbital]{
overlay ,
opacity = .55,
}
\schemestart
\chemfig{H>:[:40,0.8]@{N}\Lewis{2:,N}(<[:-110,0.8]H)-[:-40]H}
\+
\chemfig{F-@{B}{\phantom{B}}(-[2,0.1,,,draw=none]{})(<[:-20]F)<:[:20]F}
\arrow{->}
\chemfig{H>:[:-40,0.8]\chembelow[0.5pt]{N}{\scriptstyle\hspace{4.5mm}\oplus}(<[:110,0.8]H)(-[:40]H)-[:-90]\chemabove[0.5pt]{B}{\scriptstyle\hspace{4.5mm}\ominus}(<:[:-40,0.8]F)(<[:-70,0.8]F)-[:-140]F}
\schemestop
\chemmove[shorten <=2pt,shorten >=7pt]{
\node (B') at (B) {\usebox\Orbital};
\node (B'') at (B) {\contour{white}{B}};
\draw (N) ..controls +(90:1cm)and+(90:2cm)..(B);
}
\end{document}


\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[outline]{contour}
\usepackage{chemfig}
\usepackage{tikz}
\usepackage{chemmacros}
\usechemmodule{orbital}

\usepackage{babel}

\begin{document}
\setchemfig{cram width=3pt}
\chemsetup[orbital]{
overlay ,
opacity = .55,
}
\schemestart
\chemfig{H>:[:40,0.8]@{N}\Lewis{2:,N}(<[:-110,0.8]H)-[:-40]H}
\+
\chemfig{F-@{B}{\phantom{B}}(-[2,0.1,,,draw=none]{})(<[:-20]F)<:[:20]F}
\arrow{->}
\chemfig{H>:[:-40,0.8]\chembelow[0.5pt]{N}{\scriptstyle\hspace{4.5mm}\oplus}(<[:110,0.8]H)(-[:40]H)-[:-90]\chemabove[0.5pt]{B}{\scriptstyle\hspace{4.5mm}\ominus}(<:[:-40,0.8]F)(<[:-70,0.8]F)-[:-140]F}
\schemestop
\tikz[overlay,remember picture]{
\begin{scope}[overlay,shift={(B)}]
\draw[-] (-0.1,0.2) ..controls +(120:1) and +(60:1) .. (0.1,0.2);
\draw[-,fill=black!10] (-0.1,-0.2) ..controls +(-120:1) and +(-60:1) ..
+(0.2,0);
\end{scope}
\node[fill=white,inner sep=1pt] at (B){B};
\draw[-latex,shorten <=2pt] (N) ..controls +(90:1cm)and+(90:2cm)..
([yshift=8pt]B.north);
}
\end{document}


• Maybe the question was a bit vague, I would like for the B to be where it is but on top of the orbital in terms of placement. As in in my question it is underneath and hence some parts are grey. I would like for the arrow to point to a part in the middle of the upper lobe of the orbital. I can draw a diagram to make it more clear if you would like – sab hoque Oct 9 '18 at 13:27
• @sabhoque Sorry, is it better now? I still do not know if I understand it better. (BTW, I am not absolutely sure, but to me it seems that the \orbital command is not 100% harmless. If I am not mistaken, it invites one to nest tikzpictures, which part of the reason why I had to specify the color.) – user121799 Oct 9 '18 at 14:17
• please see the drawing I have included. – sab hoque Oct 9 '18 at 14:27
• @sabhoque I made another attempt, in which I also use a contour to increase the visibility of the B – user121799 Oct 9 '18 at 14:37
• @sabhoque Yes: \node[fill=white,inner sep=1pt] (B'') at (B) {B};. And I will add the TikZ drawn orbital. – user121799 Oct 9 '18 at 14:43