Converting Scribble-generated single HTML to EPUB via Pandoc

Greetings, friiends.

I've been trying to use Pandoc to create a readable EPUB from a Scribble-generated single HTML page. It works fine for everything except the math bits, which show up as verbatim LaTeX source inthe EPUB.

My pandoc call is:

pandoc --mathjax=pathname/of/MathJax.js book.html -o book.epub

Does someone have a workaround they could share? (If there is a more canonical to derive EPUB from Scribble, that'd be OK too.)

Thanks,
--d

1 Like

Are you using scribble-math to typeset equations? That library defaults to MathJax or KaTeX for rendering the equations in HTML, and both of those are javascript libraries. Pandoc is likely not including those javascript libraries in your ePub for you, so nothing is parsing the TeX-like equation code when the book is opened.

You could go about this two ways. (Keep in mind that I have not tried either method.) Either try to include one of those libraries in your ePub file; or, you could try outputting the equations as images, such as by using use-tex2svg to tell scribble-math to create SVG files for each equation.

1 Like

Did you try the math options for the pandoc command?

1 Like

In addition to the options mentioned above, you might also try using calibre. I use it for generating PDFs/epubs/mobis from HTML and it works brilliantly, although I've never tried it with *TeX code.