r - Rmarkdown中的方程式编号-用于导出到Word

标签 r rstudio r-markdown

将Rmarkdown文件编织到MS Word时,是否有一种方法可以使方程式带有冲刷到右侧的数字呢?

例如:

在Rmarkdown中输入以下内容时:
$$a + b = c$$
我需要它以Word结尾:

a + b = c(1)

我在其他地方看到了下面的代码,但是编织到Word时似乎无法使用...
\begin{equation} \label{eq-abc} a + b = c \end{equation}
谢谢!

最佳答案

@Sholom的有关pandoc-crossref的评论激发了我的阅读兴趣,我以前没有意识到这一点,并且当前无法将其作为rmarkdown的扩展。

用这个“滤波器”完全有可能实现基本的方程式编号。

Markdown

---
output:
  word_document:
    pandoc_args: ["-Fpandoc-crossref"]
---


$$a^2 + b^2 = c^2$$ {#eq:eqn1}

$$\log xy = \log x + \log y$$ {#eq:eqn2}

$$\frac{df}{dt} = \lim_{h\to0}\frac{f(t+h)-f(t)}{h}$$ {#eq:eqn3}

输出

enter image description here

潘多克交叉引用

该代码的二进制发布位于here。在Windows机器上,我将pandoc-crossref.exepandoc.exe一起放到了Pandoc安装文件夹中,这足以允许我的markdown呈现。

N.B. I did this with a standalone install of Pandoc, if you are using the version bundled with RStudio you may need to install differently.

关于r - Rmarkdown中的方程式编号-用于导出到Word,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47985267/

相关文章:

r - 对多个列名称使用 $ 符号 : RStudio Autocompletion

R Shiny : how to save input data to the server or access input variables globally?

yaml - 使用 YAML header 在 Markdown 中使用自定义引用样式

r - R Markdown 中的内联 dplyr

根据因子级别重新格式化标签/保留 ggplot2::facet_wrap() 中多因子构面的顺序

r - 将 coxph 摘要从 R 导出到 csv

R - 根据在下拉列表 (ttkcombobox) 中选择的值更新文本输入框 (tkentry)

r - 我如何预测在 R 中使用带有生存包的 AFT 模型?

Rstudio 自动完成变量

Rmarkdown、bookdown、texreg 和交叉引用