\documentclass[12pt,a4paper]{report}
\usepackage{chemfig}
\usepackage[version=4]{mhchem}
\begin{document}
\title{mechanism}
\maketitle
\newpage
\begin{center}
\section*{addition of \ce{HX} to alkene}
\end{center}
\begin{center}
\schemestart
\chemfig{-[:-60]C(-[:240])=_[@{a1}]C(-[:60])(-[:-60])}
\arrow{0}[,0]\+
\chemfig{@{a2}H-_[@{a3}]@{b1}X@{z}}
\arrow(@{z}--[yshift=5pt]){->[][][2pt]}
\chemfig{-C(-[:90]H)(-[:-90])-\chemabove{C}{\oplus}(-[:-90])(-)}
\arrow{0}[,0]\+
\chemfig{\charge{180=\:}{X}\chemright{X}{\ominus}}
\schemestop
\chemmove{\draw(a1)..controls +(100:5mm) and +(145:5mm)..(a2);\draw(a3)..controls +(100:5mm) and +(145:5mm).. (b1):}
\end{center}
\end{document}
我的 TeX 文件突然无法编译成 PDF 文件。有人能帮我修复吗?
答案1
在 \draw 命令的最后一行末尾,有一个“:”而不是“;”。
要查找错误,请禁用错误出现前输入的最后一行“%”,然后进行编译。如果没有错误,则上一个错误位于禁用的行“%”上
将每个 \draw 命令放在不同的行上以便于查看和理解。
\documentclass[12pt,a4paper]{report}
\usepackage{chemfig}
\usepackage[version=4]{mhchem}
\begin{document}
\title{mechanism}
\maketitle
\newpage
\begin{center}
\section*{addition of \ce{HX} to alkene}
\end{center}
\begin{center}
\schemestart
\chemfig{-[:-60]C(-[:240])=_[@{a1}]C(-[:60])(-[:-60])}
\arrow{0}[,0]\+
\chemfig{@{a2}H-[@{a3}]@{b1}X@{z}}
\arrow(@{z}--[yshift=5pt]){->[][][2pt]}
\chemfig{-C(-[:90]H)(-[:-90])-\chemabove{C}{\oplus}(-[:-90])(-)}
\arrow{0}[,0]\+
\chemfig{\charge{180=\:}{X}\chemright{X}{\ominus}}
\schemestop
\chemmove{
\draw(a1)..controls +(100:5mm) and +(145:5mm)..(a2);
\draw(a3)..controls +(100:5mm) and +(145:5mm).. (b1);
}
\end{center}
\end{document}