markdown乳胶显示方程

rmakrdown latex display equation

我无法让 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,例如,都是最新的。)

只需使用 $$ 而不是 \begin 和 \end 等式:

$$\sqrt{(x_{i}-x_{j})^2+(y_{i}-y_{j})^2}$$