簡體   English   中英

有沒有辦法使用 chemarr 的 latex 表達式用於 gitbook 格式的 bookdown package?

[英]Is there a way 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}

對於 PDF 格式,顯示方程沒有問題。

PDF-乳膠

另一方面,對於 gitbook 格式,有一條錯誤消息。

gitbook-乳膠

這主要是因為我無法為gitbook格式定義以下yaml header。

header-includes:
  - \usepackage{chemarr}

有沒有辦法使用 chemarr 的 latex 表達式用於gitbook格式的 bookdown package? 如果不可能,有沒有辦法使用include_graphics function 並添加方程式編號(例如,本例中的 19.16)?

謝一輝已經給出了很好的解決方案提示:

將此代碼放入您的文檔中(您希望等式出現的位置):

$$
\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 支持的所有 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