有没有办法将chemarr的乳胶表达式用于bookdown包的`gitbook`格式?

Sun*_*Han 7 latex r mathjax gitbook bookdown

我想使用 chemarr 的乳胶表达式gitbook作为 bookdown 包的格式。

\begin{equation}
  [C] + [R] 
  \xrightleftharpoons[k_{-1}]{k_1}
  [CR] + [C] 
  \xrightleftharpoons[k_{-2}]{k_2}
  [C2R]
(\#eq:multiplebinding)
\end{equation}
Run Code Online (Sandbox Code Playgroud)

对于 PDF 格式,显示方程没有问题。

PDF-乳胶

另一方面,对于 gitbook 格式,有一条错误消息。

gitbook-乳胶

这主要是因为我无法为gitbook格式定义以下 yaml 标头。

header-includes:
  - \usepackage{chemarr}
Run Code Online (Sandbox Code Playgroud)

有没有办法将 chemarr 的乳胶表达式用于gitbookbookdown 包的格式?如果不可能,有没有办法使用include_graphics函数并添加方程编号(例如,在本例中为 19.16)?

sta*_*007 7

谢一辉已经给出了很好的解决方案:

将此代码放入您的文档(您希望方程式出现的位置):

$$
\require{mhchem}
\begin{equation}
  [C] + [R] 
  \xrightleftharpoons[k_{-1}]{k_1}
  [CR] + [C] 
  \xrightleftharpoons[k_{-2}]{k_2}
  [C2R]
(\#eq:multiplebinding)
\end{equation}
$$
Run Code Online (Sandbox Code Playgroud)

需要使用箭头mhchem代替,chemarr因为只有第一个是 MathJax 的一部分。但我认为无论如何它应该基本相同。

此方法适用于 MathJax ( http://docs.mathjax.org/en/latest/input/tex/macros/index.html )支持的所有 Latex 命令。