# How can I place H_2 on top of a N ? (aspartic and glutammic metal complexes)

\documentclass{article}
\usepackage{chemfig}
\newcommand*\circleatom[1]{\tikz\node[circle,draw,fill=green!30]{\printatom{#1}};}

\begin{document}
\definesubmol{&}{-[:90,,,,draw=none]}
\definesubmol{8anta}{-[:-80,,,,draw=none]}

\setlewisdist{4pt}
\definesubmol{Gly}{
H_{2}
-[:-90]\lewis{0:,N}
-[:225]H_{2}C
-[:-45]C(=[:-90]O)
-[:13]\lewis{3:1:7:,O}!&\circleatom{Me}}
\definesubmol{Aspartic}{
O=[:-90]C(-[:-25]\lewis{1:5:7:,O}!{8anta}\circleatom{Me})
-[:230]H_{2}C
-[:-90,,2,2]HC(-[:30,,,2]H_{2}N)
-[:-50]C(=[:-90]O)
-[:25]\lewis{1:3:7:,O}}
\definesubmol{Glutammic}{
O=[:-90]C(-[:-25]\lewis{1:5:7:,O}!{8anta}\circleatom{Me})
-[:230]H_{2}C
-[:-90,,2,2]H_{2}C
-[:-90,,2,2]HC(-[:30,,,2]H_{2}N)
-[:-50]C(=[:-90]O)
-[:25]\lewis{1:3:7:,O}}

\schemestart
\chemname{\chemfig{!{Gly}}}{Glycine}
\arrow{0}
\chemname{\chemfig{!{Aspartic}}}{Aspartic  acid}
\arrow{0}
\chemname{\chemfig{!{Glutammic}}}{Glutammic acid}
\schemestop
\end{document}


In the second and third molecules, I would like to show the electrons on N, but my attempts with the macro \lewis{...} were unsuccessful. Each time I insert \lewis near N, I always get a messed up molecule. I suspect I'm not writing the parentheses in the right place.

Also, I would like to write the two hydrogens over the N. I tried with a "phantom" bond (those named "&" in the manual) but I cannot figure out how to shorten only that bond.

-

\chemabove and \chembelow may help :

\documentclass{article}
\usepackage{chemfig}
\newcommand*\circleatom[1]{\tikz\node[circle,draw,fill=green!30]{\printatom{#1}};}
\begin{document}
\setlewisdist{4pt}
\schemestart
\chemname{%
\chemfig{%
H_{2}
-[:-90]\lewis{0:,N}
-[:225]H_{2}C
-[:-45]C(=[:-90]O)
-[:13]\lewis{3:1:7:,O}-[:90,1,,,draw=none]\circleatom{Me}
}%
}
{Glycine}
\arrow{0}
\chemname{%
\chemfig{%
O=[:-90]C(-[:-25]\lewis{1:5:7:,O}-[:-80,.8,,,draw=none]\circleatom{Me})
-[:230]H_{2}C
-[:-90,,2,2]HC(-[:30]\chemabove[3pt]{\lewis{0:,N}}{H\kern1.5pt H})
-[:-50]C(=[:-90]O)
-[:30]\lewis{1:3:7:,O}
}%
}
{Aspartic  acid}
\arrow{0}
\chemname{%
\chemfig{%
O=[:-90]C(-[:-25]\lewis{1:5:7:,O}-[:-80,,,,draw=none]\circleatom{Me})
-[:230]H_{2}C
-[:-90,,2,2]H_{2}C
-[:-90,,2,2]HC(-[:30]\chembelow[3pt]{\lewis{0:,N}}{H\kern1.5pt H})
-[:-50]C(=[:-90]O)
-[:25]\lewis{1:3:7:,O}
}%
}
{Glutammic acid}
\schemestop
\end{document}


EDIT: another solution with a slightly modifed version of \chemabove and \chembelow :

\documentclass{article}
\usepackage{chemfig}
\newcommand*\circleatom[1]{\tikz\node[circle,draw,fill=green!30]{\printatom{#1}};}
\newcommand\stackabove[3][3pt]{\vbox{\offinterlineskip\vbox to0pt{\vss\hbox{\printatom{#2}}\kern#1}\hbox{#3}}}
\newcommand\stackbelow[3][3pt]{\vtop{\offinterlineskip\hbox{#3}\vbox to0pt{\kern#1\hbox{\printatom{#2}}\vss}}}
\begin{document}
\setlewisdist{4pt}
\schemestart
\chemname{%
\chemfig{%
H_{2}
-[:-90]\lewis{0:,N}
-[:225]H_{2}C
-[:-45]C(=[:-90]O)
-[:13]\lewis{3:1:7:,O}-[:90,1,,,draw=none]\circleatom{Me}
}%
}
{Glycine}
\arrow{0}
\chemname{%
\chemfig{%
O=[:-90]C(-[:-25]\lewis{1:5:7:,O}-[:-80,.8,,,draw=none]\circleatom{Me})
-[:230]H_{2}C
-[:-90,,2,2]HC(-[:30]\stackabove{H_2}{\lewis{0:,N}})
-[:-50]C(=[:-90]O)
-[:30]\lewis{1:3:7:,O}
}%
}
{Aspartic  acid}
\arrow{0}
\chemname{%
\chemfig{%
O=[:-90]C(-[:-25]\lewis{1:5:7:,O}-[:-80,,,,draw=none]\circleatom{Me})
-[:230]H_{2}C
-[:-90,,2,2]H_{2}C
-[:-90,,2,2]HC(-[:30]\stackbelow{H_2}{\lewis{0:,N}})
-[:-50]C(=[:-90]O)
-[:25]\lewis{1:3:7:,O}
}%
}
{Glutammic acid}
\schemestop
\end{document}


-
Fine, thanks. I didn't noticed the "Stacking characters" in the manual. BTW, another question. I see that, for centering purposes, you are using \kern1.5pt between the two hydrogen. I would rather like to have in the figure an H_2. If I write it directly in the code, the H_2 is the non aligned with the N. I tried \,\,\,\, H_{2} so brute force, to obtain the desired results (\quad was too much). Any other more elegant solution ? –  Ottorino Mar 24 '13 at 23:07
Yes but you have to write your own macro to stack elements. See my edit. –  unbonpetit Mar 25 '13 at 18:37