我想在chemmacros
的reactions
环境中(也与其他反应方案一起)包含一个反应图片(png/pdf),以便跟上其余反应的数字。假设光栅/矢量图像是必要的,我不能用chemfig
它tikz
来绘制它。
当我运行以下 MWE 时
\documentclass{article}
\usepackage{graphicx}
\graphicspath{ {graphics/} }
\usepackage{chemmacros}
\chemsetup{modules=all}
\begin{document}
\begin{reactions}
2 H2O <=>[ $K_\mathrm{eq}$ ] H3O+ + OH-
\includegraphics[width=0.8\linewidth]{Diels-Alder_rxn}
\end{reactions}
\end{document}
我收到大量错误消息:
line 14: Missing \endcsname inserted. \end
line 14: Missing number, treated as zero. \end
line 14: Illegal unit of measure (pt inserted). \end
line 14: Extra \endcsname. \end
line 14: Missing \endcsname inserted. \end
line 14: Missing number, treated as zero. \end
line 14: Illegal unit of measure (pt inserted). \end
line 14: Extra \endcsname. \end
line 14: File `Diels\chemformula_single_bond: Alder\chemformula_subscript:n rxn' not found. \end
line 14: Missing \endcsname inserted. \end
line 14: Missing number, treated as zero. \end
line 14: Illegal unit of measure (pt inserted). \end
line 14: Extra \endcsname. \end
line 14: Missing \endcsname inserted. \end
line 14: Missing number, treated as zero. \end
line 14: Illegal unit of measure (pt inserted). \end
line 14: Extra \endcsname. \end
line 14: Missing \endcsname inserted. \end
line 14: Missing number, treated as zero. \end
line 14: Illegal unit of measure (pt inserted). \end
line 14: Extra \endcsname. \end
line 14: Missing \endcsname inserted. \end
line 14: Missing number, treated as zero. \end
line 14: Illegal unit of measure (pt inserted). \end
line 14: Extra \endcsname. \end
line 14: Missing \endcsname inserted. \end
line 14: Missing number, treated as zero. \end
line 14: Illegal unit of measure (pt inserted). \end
line 14: Extra \endcsname. \end
line 14: Missing \endcsname inserted. \end
line 14: Missing number, treated as zero. \end
line 14: Illegal unit of measure (pt inserted). \end
line 14: Extra \endcsname. \end
line 14: Missing \endcsname inserted. \end
line 14: Missing number, treated as zero. \end
line 14: Illegal unit of measure (pt inserted). \end
line 14: Extra \endcsname. \end
line 14: Missing \endcsname inserted. \end
line 14: Missing number, treated as zero. \end
line 14: Illegal unit of measure (pt inserted). \end
line 14: Extra \endcsname. \end
line 14: File `Diels\chemformula_single_bond: Alder\chemformula_subscript:n rxn' not found. \end
line 14: Missing \endcsname inserted. \end
line 14: Missing number, treated as zero. \end
line 14: Illegal unit of measure (pt inserted). \end
line 14: Extra \endcsname. \end
line 14: Missing \endcsname inserted. \end
line 14: Missing number, treated as zero. \end
line 14: Illegal unit of measure (pt inserted). \end
line 14: Extra \endcsname. \end
line 14: Missing \endcsname inserted. \end
line 14: Missing number, treated as zero. \end
line 14: Illegal unit of measure (pt inserted). \end
line 14: Extra \endcsname. \end
line 14: Missing \endcsname inserted. \end
line 14: Missing number, treated as zero. \end
line 14: Illegal unit of measure (pt inserted). \end
line 14: Extra \endcsname. \end
line 14: Missing \endcsname inserted. \end
line 14: Missing number, treated as zero. \end
line 14: Illegal unit of measure (pt inserted). \end
line 14: Extra \endcsname. \end
line 14: Missing \endcsname inserted. \end
line 14: Missing number, treated as zero. \end
line 14: Illegal unit of measure (pt inserted). \end
line 14: Extra \endcsname. \end
line 14: Overfull \hbox (4692.08719pt too wide) in paragraph
reaction
那么将图形对象纳入/reactions
环境并进行相应编号的正确方法是什么?
答案1
chemmacros
默认情况下用于chemformula
反应。如果chemformula
数字(此处0.8
)出现在非空格标记之间的某个位置,则将其视为化合物的下标。但它为用户提供了一种转义机制:"..."
。此外,您缺少\\
:
\documentclass{article}
\usepackage{graphicx}
\graphicspath{ {graphics/} }
\usepackage{chemmacros}
\chemsetup{modules=all}
\begin{document}
\begin{reactions}
2 H2O <=>[ $K_\mathrm{eq}$ ] H3O+ + OH- \\
"\includegraphics[width=0.8\linewidth]{Diels-Alder_rxn}"
\end{reactions}
\end{document}