Ben Crowder

Blog: #ebooks

22 posts :: tag feed :: about the blog :: archive

I’m getting a bit of a nostalgia kick reading through the Standard Ebooks process. I haven’t made anything with them (though they do good work and I’m reading two of their editions right now), but years ago — in a former life, it seems — I used to make ebook editions of old books.

As far as I can tell, the first ebook I made was Chesterton’s The Ball and the Cross, which I typed up by hand and posted to Project Gutenberg. Around that time I worked on a handful of other books for PG, including Henry Sweet’s An Icelandic Primer, which was much more involved (Old Icelandic characters, tables, etc.) and incredibly fun.

After that I worked on several more books as part of the Mormon Texts Project and also started making EPUB and Kindle editions of other books (like the 1812/1815 edition of Grimms’ fairy tales and George MacDonald’s The Light Princess). Those were quite fun, too.

Somewhere around five or so years ago I stopped, partly from working on other things, partly from repetitive strain injuries. (Even with Vim macros to help, there’s still a multitude of repetitive keystrokes in cleaning up texts, at least for me.) With reading about Standard Ebooks and writing this post, though, I’m tempted to get back into it. I built Fledge years ago as an attempt to script away more of the repetitive work, and I suspect wiser use of both it and Vim might be enough to minimize the RSI.

On a related note, I’ve been wanting to rewrite md2epub. It’s a decent-enough Python script that takes Markdown files and turns them into an EPUB, and it’s worked well. But it’s an old codebase, and I don’t like the name anymore, and it could be faster, and I have a few ideas on how to make it more ergonomic, so I’m planning to dub it Caxton and rewrite it in Go or Rust. (Primarily so I’ll have an easier way to make EPUB editions of my fiction.) This part is the most likely to actually happen, I think.


Reply via email or via office hours

On ebooks

For a long time I couldn’t really get into ebooks (in spite of publishing dozens), primarily for nitpicky typographic reasons and because of availability/selection. Over the last few years, however, things changed, and my reading is now pretty much all ebooks.

For EPUBs, I use Marvin on my iPhone and couldn’t be happier with it. (Also, I’ve written a personal-use Python script that replaces f-bombs and other strong profanity in EPUBs with bullet points. Came in handy for Worm, Ra, and UNSONG, all of which I really enjoyed.) In fact, as near as I can remember, reading HPMOR on Marvin was what convinced me ebooks were great. HPMOR also convinced me that fanfiction done well can be amazing. (I liked it better than the originals.)

I’ve also been reading loads of books on Libby, and it’s been great — my public library has a fairly good selection of books on it, and the app itself is far better than the old Overdrive app.

To my surprise, I’ve also started buying books on Kindle. I used to be hesitant to do that (walled garden and all), but I’ve come to terms with it. (To the point that I’ve bought around, uh, 300 books since the beginning of the year. I may have a problem.) (Also, it’s crazy how many books go on sale for a couple dollars. I use eReaderIQ to watch for those sales.) While I do have an old Kindle, I use the app on my phone, since I always have my phone with me. Oh, and the Prime reading library usually has some interesting books, too.

Last but not least, for print books (primarily nonfiction), I tend to scan a chunk of forty to fifty pages using my camera app, turn it into a PDF with Readdle’s Scanner Pro app, and read it using Readdle’s Documents app. That way I can make an “ebook” out of pretty much any print book, letting me read it anywhere without having to lug the physical book around. This method catapulted my nonfiction reading forward, and it’s been great. The only downside is that the scanning takes time, but it’s been worth it. I estimate I’ve read at least 15,000+ pages this way over the past five years.

Overall, I love ebooks. Having them with me all the time is unbeatable. In fact, I just checked and it looks like I haven’t read a print book in over six months. I still love print, but ebooks are the future, at least for me.


Reply via email or via office hours

Reader’s editions 2.0

I’m pleased to announce version 2.0 of my reader’s editions of the Book of Mormon, Doctrine and Covenants, and Pearl of Great Price.

Like the study edition, this versions now use the licensed text of the scriptures from the Church. They’re available in EPUB and Kindle for now, with PDF and print editions forthcoming.


Reply via email or via office hours

Recommended: Standard Ebooks. They’re doing the same kind of thing I’ve done — making nice EPUB/Kindle editions of Project Gutenberg (though my efforts have of course been at a much smaller scale, and far more sporadic). Even better, Standard Ebooks has good typography standards and they’re proofing the books against original scans. This is a good project.


Reply via email or via office hours

A slightly different kind of ebook

Turns out reading PDFs of old books (from Google Books, Internet Archive, etc.) on my iPhone works out reasonably well. For example:

iPhonePDF-1.jpg

On the left is the fully zoomed out page. Indoors, I’m able to read it without too much difficulty, though my eyes do thank me when I zoom in (as on the right). The problem with zooming, however, is that navigating to the next page then requires more swiping, and, at least in iBooks, you have to zoom in again every time you turn the page.

After a bit of this, I got to wondering what it would be like to typeset an iPhone-sized PDF, designed specifically to be read on a phone. Here’s how it turned out (and this is a proof of concept, nothing too polished):

iPhonePDF-2.jpg

The pages are set at 7.573×4.267″, which I arrived at by taking 1136×640 (iPhone screen dimensions in pixels) and dividing by 150. Arbitrary, but it worked out well enough. And the text is at 16 points on the left and 18 on the right. (Also arbitrary, but dependent on the page size, of course.)

The PDFs:

The main advantage to a foolhardy scheme like this is full typographic control — margins, fonts, layout (important for poetry), tracking, etc., all without worrying about limitations of ebook readers. I could try to do something about widows and orphans, for instance, though I didn’t do that with this proof of concept.

The downside is that it’s custom-tailored to the dimensions of the iPhone 5S, and on other devices it wouldn’t fit as perfectly. Not necessarily a dealbreaker, though.

Is it worth pursuing? No idea. One of these days I’ll set a full book this way and try reading it on my phone to see how it compares.


Reply via email or via office hours

Book of Mormon reader’s edition updated

I don’t know why I didn’t do this sooner, but I’ve released the Kindle version of my Book of Mormon reader’s edition. I’ve also updated the formatting on the EPUB version so it’s nicer (indented paragraphs and all that). Kindle versions and updated EPUBs of the D&C and Pearl of Great Price will come in the near future.


Reply via email or via office hours

The Iliad

Today’s release: Ἰλιάς, an EPUB/Kindle edition of Homer’s Iliad in ancient Greek (as part of my Originals series). The EPUB edition looks better than the Kindle edition, at least in iBooks and Digital Editions, but the Kindle edition is pretty usable as well. Enjoy.


Reply via email or via office hours

The Wanderer

New release: The Wanderer (part of the Old English Texts Series)


Reply via email or via office hours

Dream of the Rood

Today’s release of Dream of the Rood (in EPUB and Kindle formats) also marks the beginning of my Old English Texts series. I’ll be releasing nice EPUB/Kindle editions of Old English texts, using the Labyrinth Library editions as a base. (They’ve been kind enough to grant me permission to do this.)


Reply via email or via office hours

Formatting poetry for EPUB and Kindle

2018 note: this post has some formatting issues from when I migrated to a new blog engine. Until I get time to get it fixed, you’ll have to view source to see the markup correctly. (The post is also somewhat obsolete now, I think.)

A lot of the ebooks I’m working on have poetry, and after struggling with the formatting for a while, I think I’ve finally found some methods that are quite acceptable for EPUB (iBooks and Adobe Digital Editions) and somewhat acceptable for Kindle.

Without line numbers

This is the easiest. We’ll be working with the first two stanzas of “Adam-ondi-Ahman”, aiming for the following formatting:

This earth was once a garden place,

With all her glories common,

And men did live a holy race,

And worship Jesus face to face,

In Adam-ondi-Ahman.

We read that Enoch walk’d with God,

Above the power of mammon,

While Zion spread herself abroad,

And Saints and angels sung aloud,

In Adam-ondi-Ahman.

EPUB

First off, there’s no standard way to mark up poetry. This works for me, but if you’ve got a better way, let us know in the comments.

Markup

This earth was once a garden place,

With all her glories common,

And men did live a holy race,

And worship Jesus face to face,

In Adam-ondi-Ahman.

We read that Enoch walk'd with God,

Above the power of mammon,

While Zion spread herself abroad,

And Saints and angels sung aloud,

In Adam-ondi-Ahman.

So, encapsulate the poem in a .poetry div, put each line in a <p> tag, and use the .indent class for indenting lines. For new stanzas, add a .stanza class to the first line.

CSS
.poetry                 { margin: 1em 0; }
.poetry p               { margin: 0 0 0 4em; text-indent: -2em; }
.poetry p.stanza        { margin-top: 1em; }
.poetry p.indent        { margin-left: 5em; }
.poetry p.indent2       { margin-left: 5.5em; }
.poetry p.indent3       { margin-left: 6em; }

And that’ll give you hanging indents and proper indentation and all that good stuff, indenting the whole poem 2em from the left; if you need further indentation, you can use the .indent2 and .indent3 classes (and of course modify them however you need).

To set the poetry flush left, by the way, change margin: 0 0 0 4em to margin: 0 0 0 2em and set the .indent classes to start at 3em instead of 5em.

Kindle (no hanging indent)

If your lines are short enough that you don’t need to worry about using hanging indents, this markup is clean and short:

Markup

This earth was once a garden place,

With all her glories common,

And men did live a holy race,

And worship Jesus face to face,

In Adam-ondi-Ahman.

We read that Enoch walk'd with God,

Above the power of mammon,

While Zion spread herself abroad,

And Saints and angels sung aloud,

In Adam-ondi-Ahman.

CSS
p           { text-align: left; }
p.stanza    { margin-top: 1em; }
p.indent    { text-indent: 3em; }

Fairly simple.

Kindle (hanging indent)

With longer lines, you’ll usually want to give them hanging indents, as is traditional in formatting poetry. We can do this on the Kindle using nested “ tags.

There’s a catch, though: if you use this technique for hanging indents, you can’t do further indentation using CSS (like line 2 in our example poem) — as soon as you try to add the hanging indent, the whole thing goes flush left again. Instead, you have to resort to the dreaded   entity. If any of you figure out how to get indents and hanging indents on the Kindle, let me know.

Markup

This earth was once a garden place,

     With all her glories common,

And men did live a holy race,

And worship Jesus face to face,

     In Adam-ondi-Ahman.

We read that Enoch walk'd with God,

     Above the power of mammon,

While Zion spread herself abroad,

And Saints and angels sung aloud,

     In Adam-ondi-Ahman.

Note that for a new stanza, we replace the .inner class with .stanza (since the Kindle parser can’t handle two CSS classes on the same element).

CSS
p           { text-align: left; }
p.outer     { text-indent: 2em; }
p.inner     { text-indent: -2em; }
p.stanza    { text-indent: -2em; margin-top: 1em; }

With line numbers

Now it gets a little more complicated. For all of these, I’m using manually entered line numbers. Once EPUB readers support more CSS selectors (like :nth-child), though, it’ll be possible to do this automatically.

There are two basic styles of line numbers in poetry. Here’s left-aligned, using the first twelve lines of the Old English poem “Dream of the Rood” as an example of what we’re trying to achieve:

Hwæt! Ic swefna cyst secgan wylle,

hwæt me gemætte to midre nihte,

syðþan reordberend reste wunedon!

þuhte me þæt ic gesawe syllicre treow

5

on lyft lædan, leohte bewunden,

beama beorhtost. Eall þæt beacen wæs

begoten mid golde. Gimmas stodon

fægere æt foldan sceatum, swylce þær fife wæron

uppe on þam eaxlegespanne. Beheoldon þær engel dryhtnes ealle,

10

fægere þurh forðgesceaft. Ne wæs ðær huru fracodes gealga,

ac hine þær beheoldon halige gastas,

men ofer moldan, ond eall þeos mære gesceaft.

And right-aligned:

Hwæt! Ic swefna cyst secgan wylle,

hwæt me gemætte to midre nihte,

syðþan reordberend reste wunedon!

þuhte me þæt ic gesawe syllicre treow

5

on lyft lædan, leohte bewunden,

beama beorhtost. Eall þæt beacen wæs

begoten mid golde. Gimmas stodon

fægere æt foldan sceatum, swylce þær fife wæron

uppe on þam eaxlegespanne. Beheoldon þær engel dryhtnes ealle,

10

fægere þurh forðgesceaft. Ne wæs ðær huru fracodes gealga,

ac hine þær beheoldon halige gastas,

men ofer moldan, ond eall þeos mære gesceaft.

EPUB markup (left- and right-aligned line numbers)

The markup is the same for both left-aligned and right-aligned line numbers:

Hwæt! Ic swefna cyst secgan wylle,

hwæt me gemætte to midre nihte,

syðþan reordberend reste wunedon!

þuhte me þæt ic gesawe syllicre treow

5

on lyft lædan, leohte bewunden,

beama beorhtost. Eall þæt beacen wæs

begoten mid golde. Gimmas stodon

fægere æt foldan sceatum, swylce þær fife wæron

uppe on þam eaxlegespanne. Beheoldon þær engel dryhtnes ealle,

10

fægere þurh forðgesceaft. Ne wæs ðær huru fracodes gealga,

ac hine þær beheoldon halige gastas,

men ofer moldan, ond eall þeos mære gesceaft.

Syllic wæs se sigebeam, ond ic synnum fah,

forwunded mid wommum. Geseah ic wuldres treow,

EPUB CSS (left-aligned line numbers)

.poetry             { margin: 1em 0; }
.poetry p           { margin: 0 0 0 6em; text-indent: -3em; }
.poetry p.indent    { margin-left: 7em; }
.poetry .num        { float: left; margin-left: 5px; font-size: .8em;
                        color: #999; font-style: italic; }
.poetry .caesura     { display: inline-block; width: 2em; }

EPUB CSS (right-aligned line numbers)

.poetry             { margin: 1em 0; }
.poetry p           { margin: 0 2em 0 2em; text-indent: -2em; }
.poetry p.indent    { margin-left: 1em; }
.poetry .num        { float: right; margin-left: 2em; margin-right: 5px;
                        font-size: .8em; color: #999; font-style: italic; }
.poetry .caesura     { display: inline-block; width: 2em; }

Kindle (right-aligned)

With Kindle, alas, there’s no good way to set line numbers with poetry. The best I’ve come up with has the line numbers right aligned on their own line, which means every five lines (or however often you put line numbers in) there’s a stanza-like blank line. You’ll also notice that the .caesura spans have been replaced with manual strings of  , because the spans don’t work on Kindle.

Markup

Hwæt! Ic swefna cyst       secgan wylle,

hwæt me gemætte       to midre nihte,

syðþan reordberend       reste wunedon!

þuhte me þæt ic gesawe       syllicre treow

5

on lyft lædan,       leohte bewunden,

beama beorhtost.       Eall þæt beacen wæs

begoten mid golde.       Gimmas stodon

fægere æt foldan sceatum,       swylce þær fife wæron

uppe on þam eaxlegespanne.       Beheoldon þær engel dryhtnes ealle,

10

fægere þurh forðgesceaft.       Ne wæs ðær huru fracodes gealga,

ac hine þær beheoldon       halige gastas,

men ofer moldan,       ond eall þeos mære gesceaft.

CSS
p           { text-align: left; }
p.outer     { text-indent: 2em; }
p.inner     { text-indent: -2em; }
p.num       { font-style: italic; text-indent: 90%; }

Conclusion

Nice as it would be to have a cross-platform EPUB/Kindle solution for formatting poetry, that day hasn’t yet come. But in spite of the occasional hassles (I’m looking at you, Kindle), you can get decent-looking results without resorting to too much hackery.


Reply via email or via office hours