# Converting Scribble-generated single HTML to EPUB via Pandoc

**URL:** <https://racket.discourse.group/t/converting-scribble-generated-single-html-to-epub-via-pandoc/1188>\
**Category:** Questions & Answers\
**Created:** [July 26, 2022, 12:44pm UTC](https://racket.discourse.group/t/converting-scribble-generated-single-html-to-epub-via-pandoc/1188 "2022-07-26T12:44:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ds26gte](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/ds26gte/32/645_2.png) [@ds26gte](https://racket.discourse.group/u/ds26gte)\
**Post date:** [July 26, 2022, 12:44pm UTC](https://racket.discourse.group/t/converting-scribble-generated-single-html-to-epub-via-pandoc/1188/1 "2022-07-26T12:44:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joeld](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/joeld/32/38_2.png) [@joeld](https://racket.discourse.group/u/joeld)\
**Post date:** [July 26, 2022, 2:35pm UTC](https://racket.discourse.group/t/converting-scribble-generated-single-html-to-epub-via-pandoc/1188/2 "2022-07-26T14:35:16Z")

</div>

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](https://www.peterkrautzberger.org/0129/); or, you could try outputting the equations as images, such as by using [`use-tex2svg`](https://docs.racket-lang.org/scribble-math/index.html#%28def._%28%28lib._scribble-math%2Fdollar..rkt%29._use-tex2svg%29%29) to tell `scribble-math` to create SVG files for each equation.

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [July 26, 2022, 2:49pm UTC](https://racket.discourse.group/t/converting-scribble-generated-single-html-to-epub-via-pandoc/1188/3 "2022-07-26T14:49:31Z")

</div>

Did you try the math options for the `pandoc` command?

 ![image](https://global.discourse-cdn.com/free1/uploads/racket/original/1X/7b8b52606a09a7d500c448c3e301e928cba7e8c6.png)

---

<div class="post-metadata">

**Author:** ![dstorrs](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@dstorrs](https://racket.discourse.group/u/dstorrs)\
**Post date:** [July 27, 2022, 3:29pm UTC](https://racket.discourse.group/t/converting-scribble-generated-single-html-to-epub-via-pandoc/1188/4 "2022-07-27T15:29:04Z")

</div>

In addition to the options mentioned above, you might also try using [calibre](https://calibre-ebook.com/). I use it for generating PDFs/epubs/mobis from HTML and it works brilliantly, although I've never tried it with \*TeX code.
