Thread: epub to pdf
View Single Post
Old 10-24-2015, 12:40 PM   #11
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
If you know how to write some simple shell scripts, I'd recommend starting in the opposite direction, writing the content in DocBook XML. From there, you can use dblatex to create LaTeX content for print, and use dbtoepub to create the EPUB. Or if you prefer, it is fairly straightforward to write a custom XML to (X)HTML translator.

Then, write a little script that replaces the equations with SVG images. To generate the SVG images, put each equation in a separate LaTeX file (and include it from your main LaTeX file so you don't have to have two copies lying around). Then:

1. Run pdftex/pdflatex to create a PDF from the single-equation .tex file.
2. Use Inkscape to convert the PDF to SVG.

You may have to do some fiddling to get the page size right. I've only done this with full-page content, so I have no idea what would be needed there—probably just replacing the bounding boxes in the SVG with whatever is appropriate for that particular equation.
dgatwood is offline   Reply With Quote