Creating ebooks with a Mac

I have some out-of-print books that I wanted to read on my Kindle. In some cases, either a Kindle version isn’t available for sale, or the Kindle version is so full of mistakes that I can’t stand to read it. Sometimes a book is available in PDF, but PDFs aren’t very fun to read. I want an ebook that functions well and looks good on the Kindle. I decided to try making one of my own.

Download the Calibre software

I used Calibre because it’s a free download and I like how it works.

The ebook files from the Calibre application get placed into the Calibre Library at root of your user directory. Each book gets placed in its own directory. The directory can contain various ebook formats such as azw3, mobi, and epub. Images and metadata are also stored in the directory.

A new book gets added to https://calibre-ebook.com/Calibre with the “Add books” link. Note that the Calibre program is not the ebook editor. It is more of a reader than an editor, but it links to the editor. The editor is a separate program.

When Calibre opens, it should show the Calibre library, and a list of books, if there are any to display.

Find or create a source file

I start with a text file, and it can come from several sources. Sometimes I find the book as a PDF file, or as a webpage online. These can be good starting points, but in my experience the text will always a fair amount of cleaning up. Unless the file has very clean HTML code it may be better to copy and paste the text directly into your editor from the web page or PDF rather than trying to fix the HTML.

Sometimes I scan the book and use Adobe Acrobat to turn the scanned letters into computer text (OCR or optical character recognition). This has hazards of its own. The scans must be of good quality or conversion to text will require too much fixing.

Paste into a Text editor

Once I have my source file, I use a text editor to clean it up. I use search/replace to clean up extra spaces, extra returns, and unnecessary tags and styles. I have used TextWrangler, BBEdit, Atom, Brackets, etc. I prefer TextWrangler (free) and BBEdit because they have really good search and replace tools. They can handle very large documents that other editors, like Brackets, will choke on. TextWrangler is free while BBedit is around $50.

Create the markdown

Markdown is a way of formatting text so it can later be exported to HTML. It’s useful if you are starting with plain text that has been converted from a scan and needs formatting. It can also be good for text that has been copied and pasted from a PDF document or a website–just the text without any HTML code.

For this task I used MacDown, a standalone markdown editor. Another option is dillinger.io an online markdown generator.

So, once the text is cleaned up and tags have been removed (unless they are correct already), it is time to use markdown to put the tags back. A preview shows how the formatting looks.

MacDown cheat sheet:

  • ### in front of line creates H1 tag
  • ## creates H2
  • ** before and after a passage creates bolded text
  • *italics*
  • > block quote
  • <center></center> is required to center
  • <hr/> and <br/> need closing slash to avoid errors
  • 1. 2. 3. makes numbered list items
  • hyphen space makes bullet item

The above is not a comprehensive list. There are other shorthand codes for other markup.

Finish the markdown

This is a good time to check spelling, as well as looking the document over to make sure there aren’t any problems. Once I am satisfied with the text, I Export as HTML . MacDown adds “toc” (table of contents) IDs to Headings automatically. This is nice for linking to chapters.

Ebook Edit

Ebook Edit is a program that comes with Calibre. Creating a new book is done with the ebook editor, not the library. In “Edit book”, choose FILE > Create new empty book.
I cut and paste the markdown into the ebook editor and look it over for formatting problems.
Next I run check for problems and make any corrections that are suggested.
The output is saved into the Documents folder

Table of Contents

Having a table of contents is really nice. It keeps you from having to scroll through the whole book to find the chapters. Here is how to add it:

  1. Right-click on ToC area and choose “Edit Table of Contents”
  2. “Generate ToC from major headings” may work if the headings are well organized
  3. If the generate options aren’t working, choose “Create new entry”. Name to the entry and select a location. A green bar shows where it aligns with the top of the window
  4. Create a new entry for each chapter

Create a cover

Having a cover is optional, but it looks nice when you are scrolling through the book in the Kindle. I have used images 450 pixels wide by 700 pixels high with good results. To add a cover, use Tools > Add cover

Back to Calibre

Once the editing is done in the editor, move to the Calibre app and choose “+Add books”. Existing books can be edited with right-click on the title and “Edit book”. A separate window will opens with a number of panels.

The HTML can be edited in the editor, or moved to a different editor and pasted back in in later. Photos can be added in Calibre, including a cover photo (450×700 for example). Once I’m ready to create the ebook, I choose
Convert books > choose MOBI output.
This puts the files in the Calibre Library directory under rusty scratchy

Upload to Amazon

The last step is up load the MOBI file to Amazon using a Kindle address. Amazon assigns email addresses to your devices. The address are similar in format to “yourname_1234@kindle.com. To find the address, log into Amazon and under “Accounts & Lists” then “Your Account” find the option to “Manage Your Content and Devices”. If you choose the Devices tab and click on the Actions icon next to a device, it should show you the email address to send the file to.

It’s important to upload from an approved email address. I use the one associated with my Amazon account. If I send from a different email, the document will never show up. To check the uploaded files, on Amazon, go to Accounts & Lists > Your Account > Manage Your Content and Devices > Show: Docs. Once the files show up there, you should be able to view them on your Kindle, iPhone, etc.