简体   繁体   中英

Subscript spacing using knitr and RStudio Markdown

I've created and RMarkdown file in RStudio. I've inserted this code in my RMarkdown file.

$$\begin{align*}
\sum_{k=1}^n c x_k
&=cx_1+cx_2+\cdots+cx_n\\
&=c(x_1+x_2+\cdots+x_n)\\
&=c\sum_{k=1}^nx_k
\end{align*}$$

Compiling with knitHTML, I get the following image.

在此处输入图片说明

Note how the subscript k is crammed too tightly against x. Of course, I can try:

c x_{\\,k}

but then it is a bit too far. I am wondering why the code x_k doesn't work the spacing as it does normally in latex.

Any suggestions?

D.

PS For those wanting the RMarkdown source and resulting html file:

CovarianceAndCorrelation.Rmd

CovarianceAndCorrelation.html

It's quite easy. Take H2O for example. Implement the following code: H~2~o

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM