Ebook Design

A Linux User’s Guide to Formatting Ebooks (Part II)

Your book has been edited, proofread, and polished within an inch of its life. Which is a good thing, because there’s no point wasting your time doing any of the formatting steps discussed here until your copy is final. As in final final. As in final FINAL final.

Did I say final? I did? Oh good. 🙂

First thing we’re going to do now is strip your document of headers, footers, page numbers, and all those glorious manuscript formatting conventions that mean nothing in the self-publishing world. They gone? Good.

Now let’s get rid of any tabs in your document. I bet you probably start each paragraph with a tab or four spaces, right? Yeah, that’s bad. You want to use styles. You’ll have to for Smashwords, anyway, plus it’s also just The Right Way To Do Things (TM).

Crack open your Search & Replace dialog box in LibreOffice, and search for ‘\t’ with Regular Expressions enabled:



(Regular expressions, or “regexes,” are a programmer’s way of doing searches and substitutions. ‘\t’ is the tab character.)

Now, leaving the “Replace with” text box empty, click Replace All. Bye bye tabs.

Now, are all of your single and double quotes already curly? Or did you create your masterpiece in a plain text editor, or forget to enable AutoCorrect?

Not a problem. Even if you’re sure you’ve already got this sorted, it’s a good idea to check. Curly quotes are typographically necessary, and a mixture of straight and curly quotes will look downright…odd. As in, You Suck I’m Going to Leave a Bad Review Odd.

I’m all for being a rebel, but that’s not the kind of Odd you want to be.

So. LibreOffice AutoCorrect has an infuriating feature/bug: Format –> AutoCorrect –> Apply will only work if your entire text is in Default Style!

Every piece of software has its quirks, Microsoft Office not least among them, so we could bitch and moan about this, or we could just work around it and get on with our lives. So here’s what you have to do.

Select All (Ctrl-A), then in the dropdown style box, select “Default Style”:



Now run Format –> AutoCorrect –> Apply and Edit Changes to make sure you’ve got your smart quotes sorted. This will fix almost of all your quote problems. Be sure to check the changes AutoCorrect makes, however, as some contractions can confuse it: ‘cause (should be ’cause) is something I always search for, just in case. You may also find nested quotes give LibreOffice headaches, for instance “’nested’ quotes” when what you want are “‘nested’ quotes.” Finally, interrupted dialogue with M-dashes can cause quotes to go curly the wrong way:

“Well”–he said–”what about it?”

(Note that WordPress doesn’t like my M-dashes, so you’d want to do a search for –” replacing ‘–‘ with an M-dash (U+2014, see Insert –> Special Character –> General Punctuation.)

In fact, while we’re at it, let’s make sure that we’re using only typographically correct symbols: M-dash instead of two hypens, curly quotes (both single and double), ellipses instead of three periods (search and replace for this), and any currency, trademark, copyright, and anything else your novel might need.

One more step before we leave LibreOffice for the wide open prairies and big sky country of, you guessed, it vim:

Did you use italics at any point during your novel? That formatting will be lost when you save as plaintext. So here’s what we’re going to do: we’re going to wrap <em></em> tags around all your italicized text. Crack open your Search and Replace:



Being sure to click on the Format… button and selecting Italics:



If you’re not already a regex guru, don’t worry too much about what’s going on here. Basically we’re asking LibreOffice to match Italics text, store it in the $0 variable, and then replace $0 with <em> tags wrapped around $0.

UPDATE: Because of a LibreOffice bug, the above search misses some italicized text. Here’s the workaround I discovered: Instead of using Format, click Attributes in the Search & Replace dialogue box. Tick “Font posture.” Keep your search and replace text the same as above. This found all of my italicized text.

Now we’re in done in LibreOffice, and it’s time to move on to the fun part: XHTML!

Of which more in Part III…

Written by: J.M. Porup

Novelist J.M. Porup is An American Dissident in Exile. Read More


Leave a Comment