Skip to main content

Section 30.2 Converting and validating

First we will describe how to convert to epub or kindle using the CLI. Assuming you have added a target with name “ebook” and format “epub”, simply run:

pretext build ebook -g

If instead, you wish to use the pretext/pretext script, make sure to first generate images into the correct format (SVG for regular EPUB and PNG for kindle). Converting to EPUB with SVG math (used everywhere other than Kindle), run as a single command-line

/path/to/mathbook/pretext/pretext -c all -f epub-svg
    -p publication.xml -d /path/to/output
    /path/to/yourmainfile.ptx

For an EPUB file destined for Kindle, use the single command-line

/path/to/mathbook/pretext/pretext -c all -f epub-kindle
    -p publication.xml -d /path/to/output
    /path/to/yourmainfile.ptx

If you would like to name your output file something other than the name inferred from the root xml:id, you can use -o path/to/output/filename.epub instead of the -d option.

For the standard EPUB conversion, any standard EPUB reader should work. MacOS users will find the Apple Book app is likely their default. Calibre is useful for an alternative view and works on Windows and Linux as well. For the Kindle conversion, you will need to get Amazon's Kindle Previewer app 1  (macOS and Windows only). For reasons we do not understand, some books crash the Kindle Previewer app, in which case you should try loading the EPUB file into the Amazon KDP web interface, which also offers a preview. (This preview is the only option for Linux users.)

Many EPUB marketplaces are strict about requiring that your EPUB file pass validation by the open source epubcheck validation tool. You may be able to install a command-line version of epubcheck using your operating system's package management tool. A free Java-based GUI version released by Pagina 2  might be useful. There is also a (slow, limited) online version. More pointers can be found at the W3 EPUBCheck 3  site. Please report validation errors and oddly-formatted electronic book output to the pretext-support Google group. Some aspects of PreTeXt have not yet been fully implemented for EPUB, but we will endeavor to support them as demand arises.

www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765261
www.pagina.gmbh/produkte/epub-checker/
www.w3.org/publishing/epubcheck/