在xaringan幻灯片中禁用MathJax方程参考链接

时间:2018-05-17 06:36:49

标签: mathjax xaringan

我已将MathJax等式编号添加到我的xaringan幻灯片中,但\eqref{}(或\ref{})链接将我带回第一张幻灯片。我想禁用链接并从引用中删除链接着色。

我的.Rmd

---
title: "MathJax test"
output:
  xaringan::moon_reader:
    includes:
      in_header: "mathjax-equation-numbers.html"
    lib_dir: libs
---

\begin{align}
\bar{x} = \frac{1}{n}\sum_{i=1}^{10} x_i \label{my-eq}
\end{align}

An example of an equation is \eqref{my-eq}. Or \ref{my-eq}. 

我在mathjax-equation-numbers.html文件中尝试解决方案(不工作):

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    TeX: { equationNumbers: { autoNumber: "AMS" } },
  "HTML-CSS": {
    styles: {
      ".MathJax a": { color: "black",
                      "pointer-events": "none",
                      cursor: "default",
                      "text-decoration": "none"
      },
      ".MathJax_Preview a": { color: "black",
                      "pointer-events": "none",
                      cursor: "default",
                      "text-decoration": "none"
      },
    }
  }
  });
</script>

1 个答案:

答案 0 :(得分:4)

尝试用下面的内容替换mathjax-equation-numbers.html的内容。

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    TeX: { equationNumbers: { autoNumber: "AMS" } },
  });
</script>
<style>
.mjx-mrow a {
  color: black;
  pointer-events: none;
  cursor: default;
}
</style>