有没有办法将chemarr的乳胶表达式用于bookdown包的`gitbook`格式? [英] Is there a way to use latex expression of chemarr for `gitbook` format of bookdown package?
问题描述
我想对bookdown包的 gitbook
格式使用chemarr的乳胶表达式.
I would like to use latex expression of chemarr for gitbook
format of bookdown package.
\begin{equation}
[C] + [R]
\xrightleftharpoons[k_{-1}]{k_1}
[CR] + [C]
\xrightleftharpoons[k_{-2}]{k_2}
[C2R]
(\#eq:multiplebinding)
\end{equation}
对于PDF格式,显示等式没有问题.
For PDF format, there is no problem of displaying the equation.
另一方面,对于gitbook格式,会出现错误消息.
On the other hand, for gitbook format there is an error message.
主要是因为我无法为 gitbook
格式定义以下yaml标头.
It's mainly because I cannot define the following yaml header for gitbook
format.
header-includes:
- \usepackage{chemarr}
有没有一种方法可以将chemarr的乳胶表达用于bookdown软件包的 gitbook
格式?如果不可能,是否可以使用 include_graphics
函数并添加方程式编号(在此示例中为19.16)?
Is there a way to use latex expression of chemarr for gitbook
format of 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)?
推荐答案
谢一慧(Yihui Xie)已为解决方案提供了很好的提示:
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}
$$
需要使用 mhchem
的箭头而不是 chemarr
的箭头,因为只有第一个是MathJax的一部分.但我认为它应该基本上是相同的.
Needs to use the arrow of mhchem
instead of chemarr
since only the first is part of MathJax. But I think it should anyway be basically the same.
此方法应适用于MathJax支持的所有Latex命令(http://docs.mathjax.org/en/latest/input/tex/macros/index.html ).
This method should work for all Latex commands supported by MathJax (http://docs.mathjax.org/en/latest/input/tex/macros/index.html).
这篇关于有没有办法将chemarr的乳胶表达式用于bookdown包的`gitbook`格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!