MathJax renders equations with preview_chapter but not in the final built

I have an online workbook for my students created using bookdown. The book has several math symbols. When I render a book chapter using preview_chapter() function, the resulting HTML document shows all the math symbols correctly. However, when I build the book, all the math shows up as raw LATEX text. All the math shows up fine in the PDF copy. My _output.yml looks like this:

bookdown::tufte_html_book:
  toc: yes
  toc_depth: 2
  css:
    - toc.css
    - custom.css
  tufte_variant: "envisioned"
  config:
    download: ["pdf", "epub"]
bookdown::pdf_book:
  base_format: pdf_book
  dev: "cairo_pdf"
  includes:
    in_header: preamble.tex
  latex_engine: xelatex
  citation_package: natbib
  keep_tex: yes
bookdown::epub_book: default

Here are the screenshots with preview_chapter() and after built.
13%20AM 04%20AM

All these things have failed:

  1. Using mathjax: local with self_contained: false
  2. Using mathjax: CUSTOM LINK where I used some other CDN host for mathjax.js
  3. Opening the file in different browsers. Safari, Firefox, and Chrome all failed.
  4. Opening the file on a different OS. I use a Mac but I opened the rendered HTML on a Windows 7 machine and the problem persisted.

I will appreciate any help. Thanks!

1 Like

I ended up using gitbook instead of tufte_html_book and it works fine now. Still no idea what went wrong but the equations are back in the rendered book.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.