Reputation: 2698
My rmarkdown
is failing to compile, and the source of the error is the LaTex command \limits
. I used the tinytex
package to install LaTex
packages. I've tried to track down the right LaTex
package with no success.
The following output was generated via html
.
## Compiles
$$\hat{\beta_1} = \frac{\sum_{i = 1}^{n}(X_1 - \bar{X})(Y_i - \bar{Y})}{\sum_{i = 1}^{n}(X_1 - \bar{X})^2}$$
## Fails to Compile
$$\hat{\beta_1} = \frac{\sum_\limits{i = 1}^{n}(X_1 - \bar{X})(Y_i - \bar{Y})}{\sum_\limits{i = 1}^{n}(X_1 - \bar{X})^2}$$
When I try to knit to pdf
I get the following error:
Upvotes: 0
Views: 164
Reputation: 124
$$\hat{\beta_1} = \frac{\sum\limits_{i = 1}^n (X_1 - \bar{X})(Y_i - \bar{Y})}{\sum\limits_{i = 1}^n (X_1 - \bar{X})^2}$$
Upvotes: 1
Reputation: 38783
Your syntax is wrong. It is not \sum_\limits{}^{}
but \sum\limits_{}^{}
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\hat{\beta_1} = \frac{\sum\limits_{i = 1}^{n}(X_1 - \bar{X})(Y_i - \bar{Y})}{\sum\limits_{i = 1}^{n}(X_1 - \bar{X})^2}
\]
\end{document}
Upvotes: 1