请考虑以下代码
\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}
在第二个和第三个分子中,我想显示 N 上的电子,但我尝试使用宏 \lewis{...} 失败了。每次我在 N 附近插入 \lewis 时,我总是得到一个混乱的分子。我怀疑我没有在正确的位置写括号。
另外,我想把两个氢写在 N 上。我尝试使用“幻影”键(手册中名为“&”),但我无法弄清楚如何缩短该键。
答案1
\chemabove
并\chembelow
可能有帮助:
\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}
编辑:另一个解决方案,对\chemabove
和进行了稍微修改\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}