Figuring Out How To Make An Epub From LibreOffice

I do my writing in LibreOffice. Each chapter is built off a common style Text document (*.odt). The chapters are accumulated into a Master document (*.odm). The Book cover, Title page, etc. non-chapter preamble are in the Master doc. The Chapters and postamble stuff are Text document. The table of contents is hand rolled in the Master documents. The links are bookmarked to the Text document’s chapter title. The text of the title is a Property called Chapter. This lets me bang out chapters without having to bother much with the technical aspect of the layout, at least for producing a PDF product.


The awkward bit was creating the EPUB e-book. I sorted that out with trial and error- wash, rinse, repeat.

The Error bit was in naively trying to allow an e-book creation tool to spew out a polished bit of work. Days were wasted playing with the eccentricities of Calibre. Frustrating. Followed up grazing for alternatives. Read through threads from people tortured by Smashword’s Meat-grinder. OK. I got it. This direction was a pass.

I decided to use my skills instead.

What worked out for me was doing the default conversion in Calibre, then editing the hell out of the spew. Hand roll the style sheet and TOC.

For the coarse conversion, Emacs was used, because that’s my go-to editor for software development. Unless you are a journeyman already familiar with this editor, you'd probably be better off elsewhere- the learning curve is steep and not for the meek.

Tame the XML noise, verify and beautify the XML with XML Copy Editor.

Fine refinements with Calibre WYSIWYG. The Calibre generated style sheet was a baseline I highly refined. I like how Calibre will edit through the files to reconcile file and link name changes. The Check Book verify tool is really nice.

Calibre has a dark side. The viewer drops a bookmark turd within the EPUB. The bookmark isn’t in the content.opf manifest section, thus making your nice refined EPUB invalid. Take care as a post-processing step to run the Check Book verify tool to remove the bookmark file before publishing.

To remove Calibre, this might do it for you as well, if you are UNIX command line handy. Run from a parent directory where the *.epub files reside.

find . -name "*.epub" -exec zip -d {} 'META-INF/calibre_bookmarks.txt'  \;


Really unfortunate Calibre lacks the option to turn off this behavior. I wonder about the thought of writing into an e-book file for e-reader's artifacts. Wouldn't a sidecar file be appropriate, and non-default to optionally write within the e-book?