01-13-2015, 04:44 AM | #1 |
Groupie
Posts: 171
Karma: 40000
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 Last edited by 1v4n0; 01-17-2015 at 04:58 AM. |
01-13-2015, 11:13 AM | #2 |
Addict
Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
|
Create an ordered list and style it using CSS.
|
Advert | |
|
01-13-2015, 11:20 AM | #3 |
Groupie
Posts: 171
Karma: 40000
Join Date: Oct 2013
Device: kindle
|
uh... could you explain?
|
01-13-2015, 11:47 AM | #4 |
Well trained by Cats
Posts: 29,800
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
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? |
01-13-2015, 11:47 AM | #5 | |
Wizard
Posts: 1,542
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
https://www.mobileread.com/forums/sho...8&postcount=18 and after that read this "solution": https://www.mobileread.com/forums/sho...0&postcount=21 You could try the same technique to get what you want. Regards Rubén |
|
Advert | |
|
01-13-2015, 11:52 AM | #6 | |
Groupie
Posts: 171
Karma: 40000
Join Date: Oct 2013
Device: kindle
|
Quote:
They're not RDM, they count ne number of the lines. The "table" approach might be the easiest one. |
|
01-13-2015, 11:55 AM | #7 |
Groupie
Posts: 171
Karma: 40000
Join Date: Oct 2013
Device: kindle
|
Or perhaps even just manually adding spaces before the lines.
|
01-13-2015, 06:21 PM | #8 |
Wizard
Posts: 1,542
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
|
01-13-2015, 06:53 PM | #9 |
Grand Sorcerer
Posts: 5,584
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:
And used the following minimal CSS: Spoiler:
|
01-14-2015, 03:50 AM | #10 |
Groupie
Posts: 171
Karma: 40000
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; } 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:
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. |
01-14-2015, 07:33 AM | #11 |
Wizard
Posts: 1,542
Karma: 6613969
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):
The above screenshot belongs to ADE 3.0 and to get that result, you only need a few lines of code: Spoiler:
and in the .xhtml file: Spoiler:
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 Last edited by RbnJrg; 01-14-2015 at 07:56 AM. |
01-14-2015, 09:11 AM | #12 |
Groupie
Posts: 171
Karma: 40000
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> |
01-14-2015, 11:51 AM | #13 |
Junior Member
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.
|
01-15-2015, 11:29 AM | #14 |
Addict
Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
|
Nice solution Doitsu, I didn't know that
|
01-16-2015, 09:51 AM | #15 |
Wizard
Posts: 1,542
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Automatic numbering of verses under ADE 4.02
In this post:
https://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:
and Spoiler:
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: 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. |
|
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 |