gpt4 book ai didi

latex - RMarkdown : Auto Number Equations

转载 作者:行者123 更新时间:2023-12-04 15:37:25 24 4
gpt4 key购买 nike

如何在 Rmarkdown 文档中自动编号方程式?

我试过在标题中包含“\usepackage{mathajax}”,但方程不会自动编号。我相信我需要配置 mathjax,但不知道如何配置。

我愿意接受任何解决方案。

请注意,此 post 中的解决方案不起作用。

编辑:

下面是所需输出的简化示例。

enter image description here

上图的代码如下。我尝试使用\begin{equation} 和\end{equation} 代替“对齐”;但是,HTML 文档没有正确输出公式。

---
header-includes:
- \usepackage{amsmath}
output:
html_document: default
---

\begin{align}
2+2 = 4 \tag{1} \\
3+2 = 5 \tag{2} \\
4+2 = 6 \tag{3} \\
5+2=7 \tag{4} \\
\end{align}

最佳答案

您可以通过使用 bookdown::html_document2 获得非常接近的结果,c.f. the documentation :

---
output:
bookdown::html_document2: default
---

\begin{align}
2+2 &= 4 \\
3+2 &= 5 (\#eq:three) \\
4+2 &= 6 (\#eq:four) \\
5+2 &= 7 (\#eq:five)
\end{align}

结果:

enter image description here

对于放置标签的每个方程式,您都会得到一个方程式编号。我省略了第一个等式上的标签以显示此效果。这与 LaTeX 的行为略有不同,您必须在 align 环境中使用 \notag 才能获得方程编号。

关于latex - RMarkdown : Auto Number Equations,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59315976/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com