In some books (namely, The Iliad, The Bible, Seneca's Letters) I've seen paragraphs, lines or sentences are numbered.

There is a couple of books I'd like to have properly formatted, and they have just that enumeration. Unfortunately, I don't know the term for this and can't find out what's the correct way to do that in epub.

Should these be just regular text or is there a tag for them?

  • One bodge that comes to mind is using a numbered list... but that would be horribly, horribly ugly.
    – evilsoup
    Jun 8, 2014 at 13:54
  • It is not semantically a list, it's prose, so paragraphs shoudln't be list elements. Jun 8, 2014 at 15:40
  • Of course you're right (and that's why I put that as a comment rather than an answer), but it might do the job in a pinch. I'm sure there are better ways, though.
    – evilsoup
    Jun 8, 2014 at 21:36

2 Answers 2


You can download a free version of Dante's Divine Comedy from ReadBeyond (Inferno, Purgatorio, Paradiso), these are well formatted epubs that also have numbered lines. You may find useful to look inside them and check their structure, to see if you can replicate these CSS settings for your own needs.

  • A great answer! The book, indeed, is very well formatted, and also has comments and illustration, so I can lookup how to deal with these. Having an id for each sentence is also a good idea. Jun 21, 2014 at 20:33

I think currently there's no way to embed enumeration in paragraphs, but here's what seems to be recommended for poetry (and I think it applies to ancient philosophy as well): http://bencrowder.net/blog/2011/06/formatting-poetry-epub-kindle/

TL:DR - numbers go to separate span of class num and have their own CSS definitions. I'll go with that and see how it renders in readers I use.

  • 1
    I'd suggest giving the <span>s an id in addition to a class; that would allow you to link to any particular line number later on with hyperlinks.
    – Tom
    Jun 9, 2014 at 19:31
  • It's a good idea! Once the formatting is done, I'll feed the directory to a Perl script which would do it for me. Jun 11, 2014 at 21:57
  • Should be able to do it with a simple RegEx, really; no need to do it with Perl.
    – Tom
    Jun 11, 2014 at 21:58
  • I think having TT or erb template is a great idea anyway. It's reuseable, and you can pass some options to the script, etc. As a rule, whenever it's more than a simple substitution in one file, I reach for Perl or Ruby. Jun 26, 2014 at 10:09
  • Sure; whatever works best for you is definitely the best way to go. For me, I like being able to just paste in a pre-written RegEx to the find and replace box, but that's just my preference.
    – Tom
    Jun 26, 2014 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.