title: How can I auto-number math equations in RMarkdown?
body: <pre><code>$$
  r  = \frac{1}{n-1} \sum_{i=1}^{n} \frac{(X_i - \bar{X})(Y_i - \bar{Y})}{S_xS_y}
  $$
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/LEiLj.png" rel="noreferrer">The rendered equation is not numbered.</a>
  Using \begin{aligned} and \end{aligned} generates an error. </p>
  
  <p>I am also using knitr in RStudio, knitting to PDF using pandoc and xelatex engine. </p>
  
  <p>Thank you. </p>