Equations do not render in EPUB version

To make sure that this is not something wrong with my code, I have used the code shown in Links in epub and epubcheck · Issue #766 · rstudio/bookdown · GitHub

library(git2r)
library(bookdown)
local_path = "bookdown-demo"
git2r::clone("https://github.com/rstudio/bookdown-demo.git",
             local_path = local_path)
epub_file = bookdown::render_book(
  "index.Rmd",
  bookdown::epub_book())

It generates the same Warning that I have in my own code:

[WARNING] Could not convert TeX math 
  SE = \sqrt(\frac{p(1-p)}{n}) \approx \sqrt{\frac{1/3 (1 - 1/3)} {300}} = 0.027
  , rendering as TeX
[WARNING] Could not convert TeX math p = \frac{a}{b}, rendering as TeX
[WARNING] Could not convert TeX math 
  SE = \sqrt(\frac{p(1-p)}{n}) \approx \sqrt{\frac{1/3 (1 - 1/3)} {300}} = 0.027
  , rendering as TeX

Any suggestions on how to fix it?
Thanks
TS

Either something has changed, or the example never worked with epub strangely.... :thinking:

Math support needs to be activated explicitly.

bookdown::epub_book:
  pandoc_args: "--mathml"

This makes the example working. Also, things to know: EPUB and Math are tricky (Pandoc - Creating an ebook with pandoc) and several math argument (Pandoc - Pandoc User’s Guide)

I'll update in the website of bookdown demo (and look about what has changed too... :thinking:)

Thanks for the report

I have opened an issue to fix this - we missed a change in Pandoc 2.19 were it requires now to set --mathml explicitly

Thanks, adding the ... pandoc_args: "--mathml" solved the problem.

1 Like

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.