title: Xaringan: Export slides to PDF while preserving formatting
body: <p>I have a Xaringan slide that looks like this:</p>
  
  <pre><code>---
  title: "Xaringan test"
  output: 
    xaringan::moon_reader:
      self_contained: false
      chakra: 'assets/remark-latest.min.js'
      css: 'assets/presentation.css'
  ---
  
  ### This is a heading
  
  This is some text and numbers 01235.
  
  `Here is some inline code`.
  
  ```
  block code
  ```
  
  ```{r}
  cat("Some R code")
  ```
  
  $e^{i\pi} + 1 = 0$
  </code></pre>
  
  <hr>
  
  <p>The rendered HTML looks like below. Custom font, CSS styles and mathjax all render well. This is how it is intended to look.</p>
  
  <p><a href="https://i.stack.imgur.com/1AeEK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1AeEK.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p>Exporting to PDF using Pagedown.</p>
  
  <pre><code>pagedown::chrome_print("test.html",output="test.pdf")
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Coysy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Coysy.png" alt="enter image description here"></a></p>
  
  <p>The custom font and css styles are preserved. The default code font has changed and the mathjax expression is not displayed. Apart from the missing mathjax, it is doing a pretty good job.</p>
  
  <hr>
  
  <p>Exporting to PDF using webshot.</p>
  
  <pre><code>webshot("test.html","test.pdf")
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/vS2pK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vS2pK.png" alt="enter image description here"></a></p>
  
  <p>Custom font and css styles are not preserved. The default code font and mathjax is preserved.</p>
  
  <hr>
  
  <p>Anyone got any tips on how to preserve fonts, CSS style and mathjax while exporting to PDF through function?</p>
  
  <pre><code>R version 3.5.2 (2018-12-20)
  Platform: x86_64-pc-linux-gnu (64-bit)
  Running under: Ubuntu 18.04.2 LTS
  webshot_0.5.1      
  pagedown_0.1
  xaringan_0.8
  </code></pre>