【问题标题】:Is there a way to use latex expression of chemarr for `gitbook` format of bookdown package?有没有办法将 chemarr 的乳胶表达式用于 bookdown 包的 `gitbook` 格式?
【发布时间】:2020-12-10 10:57:19
【问题描述】:

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

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

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

另一方面,对于 gitbook 格式,有一个错误信息。

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

header-includes:
  - \usepackage{chemarr}

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

【问题讨论】:

标签: r latex mathjax bookdown gitbook


【解决方案1】:

谢一辉已经给出了很好的解决办法:

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

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

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

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

【讨论】:

  • 谢谢,史蒂芬。这是完美的答案。
  • @SungpilHan 我还在等你提供你的赏金,这样我就可以开始提供我的了:)
猜你喜欢
  • 2015-10-16
  • 2021-12-10
  • 1970-01-01
  • 2020-01-05
  • 1970-01-01
  • 1970-01-01
  • 2014-03-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多