07-02-2013, 09:38 PM | #1 |
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Q: CSS 'counter', 'counter-increment', etc.
I came across the CSS content, counter, counter-increment, and counter-reset and thought that these would be a great ( = 'easy') way to number sections and chapters.
Works great (text, TOC, etc.) in Sigil and in Calibre viewer, but in ADE and the Kindle the numbering and the content (like 'Section, 'Topc', 'Area' below don't appear. Is this a lack of functionality in ADE and Kindle, or is there a workaround? Code:
body { counter-reset:section; } h1 { counter-reset:subsection; } h2 { counter-reset:subsubsection; } h1:before { counter-increment:section; content:"Section " counter(section) ". "; } h2:before { counter-increment:subsection; content:"Topic " counter(section) "." counter(subsection) " "; } h3:before { counter-increment:subsubsection; content:"Area "counter(section) "." counter(subsection) "." counter(subsubsection) " "; } Paul Last edited by phossler; 07-04-2013 at 05:03 PM. |
07-02-2013, 09:53 PM | #2 | |
Well trained by Cats
Posts: 29,768
Karma: 54401244
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Rule of thumb: don't count on these kinds of Features, they will fail when you most need them |
|
Advert | |
|
07-02-2013, 10:11 PM | #3 | |
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Quote:
Out of curousity, where do such CSS things get used then, browsers only??? I'll keep them in mind tho, maybe EPUB4 will allow them Paul |
|
07-03-2013, 08:10 AM | #4 | |
Well trained by Cats
Posts: 29,768
Karma: 54401244
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
So Web Browsers is the most common. BTW Just because it IS allowed in the EPUB spec, does not mean that all devices support it. Just ask the professionals that visit here TEST on different target devices, not just emulators. And don't count on Sigil or Calibre's viewers either way (pass or fail). They have their render quirks also. |
|
07-03-2013, 09:33 AM | #5 | |
Wizard
Posts: 1,539
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Regarding Kindle, (at least K4NT) IT WORKS! I compiled your epub with Kindlegen 2.9 and the mobi I got shows numbering as should be. Regards Rubén |
|
Advert | |
|
07-03-2013, 09:41 AM | #6 |
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
@RbnJrg -- thanks, I used Calibre's convert to make the AZ3 and the Kindle previewer. I'll go back and double check and then use kindlegen to make a mobi file and see if that's better. I usually prefer AZ3 since I can select Publisher Font
@theducks -- you're right, I should have used the actual device. Lesson learned Paul |
07-03-2013, 10:24 AM | #7 | |
Well trained by Cats
Posts: 29,768
Karma: 54401244
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Even then, we still built a bunch and tested the * out of them (Heat, cold, humid, drop...). Then we gave some to users to destroy use. |
|
07-03-2013, 11:44 AM | #8 |
Guru
Posts: 878
Karma: 2457540
Join Date: Nov 2011
Device: none
|
Well, most CSS happens in web pages! eBooks are just a minor backwater, using a dumbed-down version of XHTML.
Last edited by exaltedwombat; 07-03-2013 at 12:03 PM. |
07-03-2013, 12:01 PM | #9 | |
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Quote:
Paul Last edited by phossler; 07-03-2013 at 12:04 PM. |
|
07-03-2013, 12:12 PM | #10 |
Wizard
Posts: 1,539
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Yes, use Kindlegen instead of Calibre. And of course, to use this kind of feature, you must work with azw3 since the old mobi format doesn't support counters (actually doesn't support anything )
|
07-03-2013, 01:39 PM | #11 |
Well trained by Cats
Posts: 29,768
Karma: 54401244
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
07-03-2013, 02:37 PM | #12 | |
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Quote:
But it makes a MOBI file, is there a way to get the AZW3 file so that Publisher Font is supported? Thanks again Paul |
|
07-03-2013, 03:20 PM | #13 | |
Bookmaker & Cat Slave
Posts: 11,460
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
Why do you believe that Publisher Font isn't supported with KindleGen? And what will you do for the fallback coding for the mobi (k7) version? Did KG support that for the K7's? Hitch |
|
07-04-2013, 05:52 AM | #14 | |
Grand Sorcerer
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
BTW, if you're only interested in auto-incrementing counters, you won't need to use KindleGen, because Calibre generated AZW3 files support auto-incrementing counters just fine, as long as you select AZW3 and not MOBI as the target format. However, as Hitch has pointed out, if you preparing a book for submission to Amazon KDP, you'll have to implement fall-back styles, which makes the use of auto-incementing pointer moot, because there's no point in using auto-incrementing counters and hard-coded numbers, because you might as well only use hard-coded numbers. |
|
07-04-2013, 10:22 AM | #15 | |
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
@Doitsu --
Quote:
Since the stuff I do is for personal or family use, I can live with that, and now that I understand how counters are used, I think I can make my life easier. The last PD book I re-formatted ('cleaned') had 3-4 Parts (h1), and about 60 Chapters (h2), all numbered the hard way Thanks to all Paul |
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
line-counter needed | schuster | Calibre | 4 | 05-15-2011 12:15 PM |
Classic over the counter | iandix | Barnes & Noble NOOK | 7 | 02-07-2010 05:48 AM |
No Page Counter | andavane | Bookeen | 2 | 10-25-2009 04:32 AM |