【发布时间】:2015-05-31 07:15:05
【问题描述】:
我无法让 rmarkdown 在 .docx 输出中生成乳胶显示公式,即使相同的代码生成正确的 .pdf(带有公式)。
这是一些产生问题的示例 .Rmd 代码:
# Stuff
Blah blah blah.
```{r blurb_1}
test.xy <- matrix(c(runif(10,10,30),runif(10,70,90)),ncol=2,byrow=T)
plot(test.xy)
```
As the data are a set of points
$p_{1 \cdots n}=(x_{1} \cdots x_{n},y_{1} \cdots
y_{n})$, a measure of difference is the distance
between any two points,$p_{i},p_{j}$,
\begin{equation}
\sqrt{(x_{i}-x_{j})^2+(y_{i}-y_{j})^2}
\end{equation}
```{r blurb_2}
di <- dist.mat(test.xy[,1],test.xy[,2]) # a distance matrix
dim(di)
```
Of course, blah blah.
在 R 中运行时
rmarkdown::render(file.choose(),"pdf_document")
生成方程但是
rmarkdown::render(file.choose(),"word_document")
没有!谁能指导我如何使乳胶方程出现在 .docx 输出中?
任何解决我必须是基本错误的帮助将不胜感激! (我使用的是 R 3.1.1,rmarkdown 包 0.5.1 和 pandoc 1.13.2,例如,所有都是最新的。)
【问题讨论】:
-
word 使用自己的公式编辑器。 google 上有几个在 word 中使用 latex 的资源,但它并不完全支持 tex out-of-the-box afaik。
标签: r latex equation r-markdown