1

You can choose to convert R markdown to html (limited latex support with mathjax) or pdf output (full latex support) when using the package knitr, by respectively specifying in the preamble:

---
output:
html_document:
    mathjax: local
    self_contained: false
% other preamble
---

vs

---
output:
pdf_document:
header-includes: % lets you use full functionality of latex packages
   - \usepackage{amsmath,amssymb,amsthm,amscd}
   - \usepackage{graphicx}
% other preamble
---

Unfortunately as MathJax is not latex, packages cannot be added when publishing into html using the first method. Are there any alternatives that can typeset equations with full latex functionality in a html document? For example, is it possible to knit all equations on a separate line into an image, and then include the image automatically in the html?

Community
  • 1
  • 1
Alex
  • 15,186
  • 15
  • 73
  • 127

0 Answers0