简体   繁体   English

有没有办法使用 chemarr 的 latex 表达式用于 gitbook 格式的 bookdown package?

[英]Is there a way to use latex expression of chemarr for `gitbook` format of bookdown package?

I would like to use latex expression of chemarr for gitbook format of bookdown package.我想使用 chemarr 的 latex 表达式用于gitbook格式的 bookdown package。

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

For PDF format, there is no problem of displaying the equation.对于 PDF 格式,显示方程没有问题。

PDF-乳胶

On the other hand, for gitbook format there is an error message.另一方面,对于 gitbook 格式,有一条错误消息。

gitbook-乳胶

It's mainly because I cannot define the following yaml header for gitbook format.这主要是因为我无法为gitbook格式定义以下yaml header。

header-includes:
  - \usepackage{chemarr}

Is there a way to use latex expression of chemarr for gitbook format of bookdown package?有没有办法使用 chemarr 的 latex 表达式用于gitbook格式的 bookdown package? If it's impossible, is there a way to use include_graphics function and add equation numbering (say, 19.16 in this example)?如果不可能,有没有办法使用include_graphics function 并添加方程式编号(例如,本例中的 19.16)?

Yihui Xie already gave a good hint to the solution:谢一辉已经给出了很好的解决方案提示:

Put this code into your document (where you want the equation to appear):将此代码放入您的文档中(您希望等式出现的位置):

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

Needs to use the arrow of mhchem instead of chemarr since only the first is part of MathJax.需要使用mhchem的箭头而不是chemarr ,因为只有第一个是 MathJax 的一部分。 But I think it should anyway be basically the same.但我认为无论如何它应该基本相同。

This method should work for all Latex commands supported by MathJax ( http://docs.mathjax.org/en/latest/input/tex/macros/index.html ).此方法适用于 MathJax 支持的所有 Latex 命令( http://docs.mathjax.org/en/latest/input/tex/macros/index.ZFC35FDC70D5FC69D2639883A822C7A )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM