我一直在尝试使用以下代码绘制化学图:
\schemestart
{\scriptsize \chemfig{
H-[:30]C(-[:90]H)(-[:-90]H)-[:-30]\Lewis{2:,N}(-[:-90]H)-[:30]C(-[:90]H)(-[:-90]H)-[:-30]C(-[:90]H)(-[:-90]N\rlap{${}^+$}(-[:-150]H)(-[:-90]H)-[:-30]H)-[:30]C(=[:90]\Lewis{1:3:,O})-[:-30]\Lewis{1:5:7:,O}^\rlap{${}^-$}
}}
\arrow{<=>}
{\scriptsize \chemfig{
H-[:30]C(-[:90]H)(-[:-90]H)-[:-30]N\rlap{${}^+$}(-[:-90]H)(-[:90]H)-[:30]C(-[:90]H)(-[:-90]H)-[:-30]C(-[:90]H)(-[:-90]N(-[:-150]H)-[:-30]H)-[:30]C(=[:90]\Lewis{1:3:,O})-[:-30]\Lewis{1:5:7:,O}\rlap{${}^-$}
}}
\arrow{<=>[$+$\chemfig{H^+}]}
{\scriptsize \chemfig{
H-[:30]C(-[:90]H)(-[:-90]H)-[:-30]N\rlap{${}^+$}(-[:-90]H)(-[:90]H)-[:30]C(-[:90]H)(-[:-90]H)-[:-30]C(-[:90]H)(-[:-90]N\rlap{${}^+$}(-[:-150]H)(-[:-90]H)-[:-30]H)-[:30]C(=[:90]\Lewis{1:3:,O})-[:-30]\Lewis{1:5:7:,O}\rlap{${}^-$}
}}
\schemestop
不幸的是,出现了以下错误。
! Missing { inserted.<to be read again>\hbox {
! Missing { inserted.<inserted text>{
错误与第二个分子有关,即{\scriptsize \chemfig{
第二次出现的行。我该如何修复此错误?
答案1
你刚才^
在 前面有多余的东西\rlap
。
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{chemfig}
\begin{document}
\schemestart
{\scriptsize \chemfig{
H-[:30]C(-[:90]H)(-[:-90]H)-[:-30]\Lewis{2:,N}(-[:-90]H)-[:30]C(-[:90]H)(-[:-90]H)-[:-30]C(-[:90]H)(-[:-90]N\rlap{${}^+$}(-[:-150]H)(-[:-90]H)-[:-30]H)-[:30]C(=[:90]\Lewis{1:3:,O})-[:-30]\Lewis{1:5:7:,O}\rlap{${}^-$}
}}
\arrow{<=>}
{\scriptsize \chemfig{
H-[:30]C(-[:90]H)(-[:-90]H)-[:-30]N\rlap{${}^+$}(-[:-90]H)(-[:90]H)-[:30]C(-[:90]H)(-[:-90]H)-[:-30]C(-[:90]H)(-[:-90]N(-[:-150]H)-[:-30]H)-[:30]C(=[:90]\Lewis{1:3:,O})-[:-30]\Lewis{1:5:7:,O}\rlap{${}^-$}
}}
\arrow{<=>[$+$\chemfig{H^+}]}
{\scriptsize \chemfig{
H-[:30]C(-[:90]H)(-[:-90]H)-[:-30]N\rlap{${}^+$}(-[:-90]H)(-[:90]H)-[:30]C(-[:90]H)(-[:-90]H)-[:-30]C(-[:90]H)(-[:-90]N\rlap{${}^+$}(-[:-150]H)(-[:-90]H)-[:-30]H)-[:30]C(=[:90]\Lewis{1:3:,O})-[:-30]\Lewis{1:5:7:,O}\rlap{${}^-$}
}}
\schemestop
\end{document}