View Single Post
Old 01-13-2015, 06:53 PM   #9
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,583
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
If you have an iPad or a Kindle K3 or higher with the latest firmware and aren't interested in publishing books with KDP, you could give pseudo-elements a try, because they allow you to automatically add line numbers. They also allow you add special formatting to every nth element. (I used both features in my simple test file.)

Unfortunately, the majority of ePub readers and apps don't support pseudo-elements and you can't use counter pseudo-elements in KDP Kindle books according to the official publishing guidelines, even though they work fine.

I slapped together a very simple test file that displays fine with Sigil, Calibre Book Viewer, iBooks (after ePub3 conversion) and on my Kindle PW2. However, it doesn't display correctly with ADE4, even if it's converted to an ePub3 file.

I formatted the poem as an unordered list:

Spoiler:
Code:
  <h3>The Raven by Edgar Alan Poe</h3>

  <ul>
    <li>Once upon a midnight dreary, while I pondered, weak and weary,</li>
    <li>Over many a quaint and curious volume of forgotten lore,</li>
    <li>While I nodded, nearly napping, suddenly there came a tapping,</li>
    <li>As of some one gently rapping, rapping at my chamber door.</li>
    <li>"'Tis some visiter," I muttered, "tapping at my chamber door—</li>
    <li>Only this, and nothing more."</li>

    <li>Ah, distinctly I remember it was in the bleak December,</li>
    <li>And each separate dying ember wrought its ghost upon the floor.</li>
    <li>Eagerly I wished the morrow;—vainly I had tried to borrow</li>
    <li>From my books surcease of sorrow—sorrow for the lost Lenore—</li>
    <li>For the rare and radiant maiden whom the angels name Lenore—</li>
    <li>Nameless here for evermore.</li>
    <!-- more lines ... -->
  </ul>


And used the following minimal CSS:

Spoiler:
Code:
ul {
    counter-reset: counter;
    margin-left: .25em;
}

li {
    counter-increment: counter;
    list-style-type: none;
}

ul li:nth-child(5n+5):before {
    left: 0;
    position: absolute;
    padding-left: 1em;
    content: counter(counter);
}

ul li:nth-child(6n+6) {
    text-align: right;
    margin-bottom: 1em;
}

h3 {
    text-align: center;
}
Attached Thumbnails
Click image for larger version

Name:	Calibe_The_Raven.png
Views:	7809
Size:	77.7 KB
ID:	133757   Click image for larger version

Name:	PW2_The_Raven.png
Views:	12224
Size:	29.8 KB
ID:	133758  
Attached Files
File Type: azw3 The Raven.azw3 (19.9 KB, 457 views)
File Type: epub The Raven.epub (5.0 KB, 372 views)
Doitsu is offline   Reply With Quote