title: Problems with Math in R blogdown package in .md files with HUGO
body: <p>I was wondering if anyone can help me fix the following problem with math rendering in the R blogdown package for Hugo static websites?</p>
  
  <p>I made a screenshot showing the Latex code and below the output I get.</p>
  
  <p>The formulas render fine in Atom Markdown-Preview-Plus. The font-size of the formulas also seems to be to large, but that is more a stylistic problem I guess:)</p>
  
  <p><strong>Update 1:</strong>
  I narrowed the problem down to some issue with Math rendering in the Hugo Academic theme (thx @bethanyP for the link)</p>
  
  <p>The code renders fine if I use the default RStudio huge-lithium theme. </p>
  
  <p><strong>Update 2:</strong></p>
  
  <p>Adding the script below to the file head_custom.html makes the formulas work in Hugo Academic if you write math like <code>$$ math expression$$</code> with backticks before and after the dollar signs:</p>
  
  <pre><code>&lt;script type="text/x-mathjax-config"&gt;
  MathJax.Hub.Config({
    tex2jax: {
      skipTags: ['script', 'noscript', 'style', 'textarea', 'pre']
    }
  });
  &lt;/script&gt;
  &lt;script async type="text/javascript"
    src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Update 3:</strong></p>
  
  <p>So, I finally solved all problems. Add the following code to huge-academic.css or follow the hugo academic instructions to add a custom css file:</p>
  
  <pre><code>code .MathJax {
    color: black;
    background-color: white;
  }
  </code></pre>
  
  <p>Now all formulas are rendered properly and in black:)</p>
  
  <p>Code for copy/paste:</p>
  
  <p>1:</p>
  
  <pre><code>$$\begin{align}
  \alpha &amp; = 1 \\
  \alpha &amp; = 2 \\
  \end{align}$$
  </code></pre>
  
  <p>2:</p>
  
  <pre><code>$$\underbrace{P(Jar~1 | Nut~Cookie)}_{\text{posterior}} = \frac{\overbrace{P(Nut~Cookie | Jar~1)}^{\text{likelihood}}\overbrace{P(Jar~1)}^{\text{prior}}}{\underbrace{P(Nut~Cookie)}_{\text{normalizing constant}}}$$
  </code></pre>
  
  <p>Screenshot:</p>
  
  <p><a href="https://i.stack.imgur.com/naE69.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/naE69.jpg" alt="blogdown math problems"></a></p>