Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 01-13-2015, 04:44 AM   #1
1v4n0
Connoisseur
1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.
 
Posts: 63
Karma: 28458
Join Date: Oct 2013
Device: kindle
Poetry: line numbers aligned to the left.

Hello.

Very often poetry printed books have numbered lines, normally every fifth line has its number, aligned to the left of the page. The lines of course all start flush, with a big indent (see attachment, and btw I'm sorry the first thing I found was possibly Italy's most overrated poem )

How can I do this w/ epubs? Perhaps with a <span></span> around each number, which then I'd float to the left, or to which I'd give a negative indent?

Thanks
Attached Thumbnails
Click image for larger version

Name:	poet.png
Views:	131
Size:	140.5 KB
ID:	133722  

Last edited by 1v4n0; 01-17-2015 at 04:58 AM.
1v4n0 is offline   Reply With Quote
Old 01-13-2015, 11:13 AM   #2
odedta
Addict
odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.
 
Posts: 354
Karma: 96448
Join Date: Dec 2013
Device: iPad
Create an ordered list and style it using CSS.
odedta is offline   Reply With Quote
Old 01-13-2015, 11:20 AM   #3
1v4n0
Connoisseur
1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.
 
Posts: 63
Karma: 28458
Join Date: Oct 2013
Device: kindle
uh... could you explain?
1v4n0 is offline   Reply With Quote
Old 01-13-2015, 11:47 AM   #4
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 17,010
Karma: 10253000
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Astak Pocket Pro, K4NT,Galaxy Tab 2
That appears to be numbered random lines, An ordered (ol) list (li) might be used if the stanza was being numbered.

Tables, with the first column used when numbers needed?
theducks is offline   Reply With Quote
Old 01-13-2015, 11:47 AM   #5
RbnJrg
Fanatic
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 585
Karma: 387749
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by 1v4n0 View Post
Hello.

Very often poetry printed books have numbered lines, normally every fifth line has its number, aligned to the left of the page. The lines of course all start flush, with a big indent (see attachment, and btw I'm sorry the first thing I found was possibly Italy's most overrated poem )

How can I do this w/ epubs? Perhaps with a <span></span> around each number, which then I'd float to the left, or to which I'd give a negative indent?

Thanks
Hmmm, read this issue:

http://www.mobileread.com/forums/sho...8&postcount=18

and after that read this "solution":

http://www.mobileread.com/forums/sho...0&postcount=21

You could try the same technique to get what you want.

Regards
Rubťn
RbnJrg is offline   Reply With Quote
Old 01-13-2015, 11:52 AM   #6
1v4n0
Connoisseur
1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.
 
Posts: 63
Karma: 28458
Join Date: Oct 2013
Device: kindle
Quote:
Originally Posted by theducks View Post
That appears to be numbered random lines, An ordered (ol) list (li) might be used if the stanza was being numbered.

Tables, with the first column used when numbers needed?

They're not RDM, they count ne number of the lines. The "table" approach might be the easiest one.
1v4n0 is offline   Reply With Quote
Old 01-13-2015, 11:55 AM   #7
1v4n0
Connoisseur
1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.
 
Posts: 63
Karma: 28458
Join Date: Oct 2013
Device: kindle
Or perhaps even just manually adding spaces before the lines.
1v4n0 is offline   Reply With Quote
Old 01-13-2015, 06:21 PM   #8
RbnJrg
Fanatic
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 585
Karma: 387749
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by 1v4n0 View Post
They're not RDM, they count ne number of the lines. The "table" approach might be the easiest one.
The table approach will bring you more problems than solutions.
RbnJrg is offline   Reply With Quote
Old 01-13-2015, 06:53 PM   #9
Doitsu
Wizard
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: 2,550
Karma: 5672131
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:	89
Size:	77.7 KB
ID:	133757   Click image for larger version

Name:	PW2_The_Raven.png
Views:	98
Size:	29.8 KB
ID:	133758  
Attached Files
File Type: azw3 The Raven.azw3 (19.9 KB, 32 views)
File Type: epub The Raven.epub (5.0 KB, 40 views)
Doitsu is offline   Reply With Quote
Old 01-14-2015, 03:50 AM   #10
1v4n0
Connoisseur
1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.
 
Posts: 63
Karma: 28458
Join Date: Oct 2013
Device: kindle
Hey, thanks. That looks good in my kindle non-touch (this one), and I think in books where there isn't only poetry this could be a case of "graceful degradation": if you have a reader that supports pseudo-elements you see the numbers, but if you don't you're still able to read the text.

Granted, if it is a long poem we're talking about this might not be a viable solution. In this latter case I'd go for manually inserting the numbers befor each 5th verse, and the spaces in the other lines, combined with a monospaced font (like they do here). Or I wouldn't, after all. Sounds like a hell of a job

Anyway, if you add this

Code:
ul {
    counter-reset: counter;
    margin-left: 1.25em;
	text-indent: -.5em;
}
The verses become more readable

EDIT I was just suggested another solution, which does not involve the counter: use an <OL> instead of<UL>, and hide all the numbers but the 5n-th by giving them a transparent background.
Spoiler:

Code:
ol li:before {
    width:100px;
    height:30px;
    background-color:#FFF;
    content:"";
    display:inline-block;
    position:relative;
    margin-left: -100px;
}
ol li:nth-child(5n):before {
    background-color:transparent;
}


This looks fine in calibre and sigil, and in ADE it just shows all the numbers.

However, besides the dot after the numbers, which apparently is unavoidable w/o the counter, this solution raises a weird problem on my kindle: it only works for the first page. Once you turn it, all the numbers show. On the "Paperwhite" it works fine though.

Anyway, credits go to this guy.

Last edited by 1v4n0; 01-14-2015 at 05:47 AM.
1v4n0 is offline   Reply With Quote
Old 01-14-2015, 07:33 AM   #11
RbnJrg
Fanatic
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 585
Karma: 387749
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
And what about something like this (that also works in any ereader):

Click image for larger version

Name:	Image1.png
Views:	98
Size:	72.8 KB
ID:	133778

The above screenshot belongs to ADE 3.0 and to get that result, you only need a few lines of code:

Spoiler:

Code:
h3 {
   text-align: center;
}

.stanza {
   margin-left: 4em;
   margin-bottom: 1em;
}

.stanza p {
  margin: 0;
  text-indent: 1.2em;
  line-height: 1.2em;
}

.stanza p + p {
  text-indent: 0;
}

.stanza p.number {
  float: left;
  margin-left: -4em;
  margin-top: 0.3em;
  font-size: 70%;
}


and in the .xhtml file:

Spoiler:

Code:
  <h3>IL CINQUE MAGGIO</h3>

  <div class="stanza">
    <p>Ei fu. Siccome immobile,</p>
    <p>Dato il mortal sospiro,</p>
    <p>Stette la spoglia immemore</p>
    <p>Orba di tanto spiro,</p>
    <p class="number">5</p>
    <p>Cosž percossa, attonita</p>
    <p>La terra al nunzio sta,</p>
  </div>

  <div class="stanza">
    <p>Muta pensando allíultima</p>
    <p>Ora dellíuom fatale;</p>
    <p>NŤ sa quando una simile</p>
    <p class="number">10</p>
    <p>Orma di piŤ mortale</p>
    <p>La sua cruenta polvere</p>
    <p>A calpestar verrŗ.</p>
  </div>

  <div class="stanza">
    <p>Lui folgorante in solio</p>
    <p>Vide il mio genio e tacque;</p>
    <p class="number">15</p>
    <p>Quando, con vece assidua,</p>
    <p>Cadde, risorse e giacque,</p>
    <p>Di mille voci al sonito</p>
    <p>Mista la sua non ha:</p>
  </div>


So, you only need to add <p class="number">"your number here"</p> in the proper place; everything else is the same you have done always.

Below you can check the respective epub.

Regards
Rubťn
Attached Files
File Type: epub Poetry with side numbers.epub (2.5 KB, 33 views)

Last edited by RbnJrg; 01-14-2015 at 07:56 AM.
RbnJrg is offline   Reply With Quote
Old 01-14-2015, 09:11 AM   #12
1v4n0
Connoisseur
1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.1v4n0 solves Fermatís last theorem while doing the crossword.
 
Posts: 63
Karma: 28458
Join Date: Oct 2013
Device: kindle
Cool. It works on my kindle. The problem here is that I'd have to manually insert the numbers, or the tags around them. That could be achieved with a simple regex, stg like

FIND: ([0-9]{1,})
REPLACE: <p class="number">\1</p>
1v4n0 is offline   Reply With Quote
Old 01-14-2015, 11:51 AM   #13
teamcoltra
Junior Member
teamcoltra began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jan 2015
Device: Moto-X
instead of "background:white" I would just use color:transparent; and then on the nth use color:black; But that will "fail" to transparent fonts.
teamcoltra is offline   Reply With Quote
Old 01-15-2015, 11:29 AM   #14
odedta
Addict
odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.
 
Posts: 354
Karma: 96448
Join Date: Dec 2013
Device: iPad
Nice solution Doitsu, I didn't know that
odedta is offline   Reply With Quote
Old 01-16-2015, 09:51 AM   #15
RbnJrg
Fanatic
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 585
Karma: 387749
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Automatic numbering of verses under ADE 4.02

In this post:

http://www.mobileread.com/forums/sho...56&postcount=9

Doitsu developed a clever method to use automatic numbering of verses; he utilized pseudo-elements under the form of unordered list. I borrowed some of his thoughts to do something similar but without using lists. The code I used was as follows:

Spoiler:
Code:
body {
  counter-reset: verse 0;
}

h3 {
   text-align: center;
}

.stanza {
   margin-left: 4em;
}

.stanza p {
  margin: 0;
  line-height: 1.2em;
}

.stanza p:nth-child(6n+7) {
    text-indent: 1em;
}

.stanza p:nth-child(6n+6) {
    margin-bottom: 1em;
}

.stanza p:nth-child(5n+5):before {
    float: left;
    margin-left: -4em;
    font-size: 70%;
    content: counter(verse);
    counter-increment: verse 5;
}

.dropcap {
    float: left;
    color: blue;
    line-height: 1.2em;
    font-size: 3em;
    font-weight: bold;
    margin: -0.2em 5px -0.3em 0;
}


and

Spoiler:
Code:
  <h3>IL CINQUE MAGGIO</h3>

  <div class="stanza">
    <p><span class="dropcap">E</span>i fu. Siccome immobile,</p>
    <p>Dato il mortal sospiro,</p>
    <p>Stette la spoglia immemore</p>
    <p>Orba di tanto spiro,</p>
    <p>Cosž percossa, attonita</p>
    <p>La terra al nunzio sta,</p>

    <p>Muta pensando allíultima</p>
    <p>Ora dellíuom fatale;</p>
    <p>NŤ sa quando una simile</p>
    <p>Orma di piŤ mortale</p>
    <p>La sua cruenta polvere</p>
    <p>A calpestar verrŗ.</p>

    <p>Lui folgorante in solio</p>
    <p>Vide il mio genio e tacque;</p>
    <p>Quando, con vece assidua,</p>
    <p>Cadde, risorse e giacque,</p>
    <p>Di mille voci al sonito</p>
    <p>Mista la sua non ha:</p>
  </div>


Since Doitsu had already added an automatic bottom margin after the sixth verse, inspired on his ideas, I also added automatic indenting. As we can see, is practically Doitsu's original code but without using unordered list. The ebooks looks great under Sigil, Kindle and surprisingly also works under ADE 4.02 with epub3 conversion. Here you can watch a screenshot:

Click image for larger version

Name:	Image1.png
Views:	73
Size:	50.5 KB
ID:	133861

That means that the ereaders based on RMSDK could show automatic numbering Below you can check the respective epub3 ebook and thank you very much Doitsy for being the first in thinking to use counters for this task.
Attached Files
File Type: epub Poetry_with_side_numbers_epub3.epub (3.1 KB, 35 views)
RbnJrg is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Style poetry - line break on verse ramsaa Sigil 15 10-22-2013 04:28 PM
setting line-height between paragraphs of poetry in epubs Derek R ePub 12 03-14-2013 04:38 AM
Shakespeare Collection for Kindle with line numbers SamTCat Amazon Kindle 0 08-19-2011 11:36 PM
Adding line numbers to an ebook txgecko Workshop 8 06-11-2011 02:59 PM
Formatting epic poems with line numbers? Lima_dat Workshop 4 02-25-2008 03:53 PM


All times are GMT -4. The time now is 07:52 PM.


MobileRead.com is a privately owned, operated and funded community.