化学反应作为图形对象和化学宏

化学反应作为图形对象和化学宏

我想在chemmacrosreactions环境中(也与其他反应方案一起)包含一个反应图片(png/pdf),以便跟上其余反应的数字。假设光栅/矢量图像是必要的,我不能用chemfigtikz来绘制它。

当我运行以下 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}

相关内容