I'm writing a GitBook style bookdown document consisting of several Rmd files, in which I use the option self_contained = TRUE to make self-contained HTML pages (so that later I could distribute them as HTML files instead of multiple files with the HTML pages separate from the pictures displayed on them). When I tried to put mathematical equations using the $ $ tags, I got something like [WARNING] Could not convert TeX math '\frac{1}{\sum_{i=1}^{S} p_{i}^2}', rendering as TeX and the equations were not rendered correctly.
I saw from here that MathJax may not work when self_contained = TRUE, and from here that MathJax is needed to render math in HTML. Indeed, I always get a warning like MathJax doesn't work with self_contained when not using the rmarkdown "default" template, and the equations were rendered correctly if I use self_contained = FALSE.
So, I wonder if it is possible to render math correctly in GitBook style bookdown document while self_contained = TRUE.