简体   繁体   English

使用Knitr和RStudio Markdown的下标间距

[英]Subscript spacing using knitr and RStudio Markdown

I've created and RMarkdown file in RStudio. 我已经在RStudio中创建了RMarkdown文件。 I've inserted this code in my RMarkdown file. 我已将此代码插入RMarkdown文件中。

$$\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. 使用knitHTML进行编译,我得到以下图像。

在此处输入图片说明

Note how the subscript k is crammed too tightly against x. 请注意,下标k如何相对于x太紧塞。 Of course, I can try: 当然,我可以尝试:

c x_{\\,k} 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. 我想知道为什么代码x_k不能像乳胶中那样正常工作。

Any suggestions? 有什么建议么?

D. D.

PS For those wanting the RMarkdown source and resulting html file: PS对于那些想要RMarkdown源和生成的html文件的人:

CovarianceAndCorrelation.Rmd 协方差和相关性

CovarianceAndCorrelation.html CovarianceAndCorrelation.html

It's quite easy. 这很容易。 Take H2O for example. 以水为例。 Implement the following code: H~2~o 执行以下代码: H~2~o

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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