MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Sigil (https://www.mobileread.com/forums/forumdisplay.php?f=203)
-   -   Number of pages in a chapter (https://www.mobileread.com/forums/showthread.php?t=335973)

Ashjuk 12-27-2020 09:27 AM

Number of pages in a chapter
 
One of the options for the header on a Kobo is the progress through the current chapter.

I have found that this seems to work for some epubs, but not others where it will only display the current position in the whole book. It appears that this is not uncommon as there is a note in the header settings on the Kobo stating that it might not work with some books.

I was puzzling over this so I opened a book that worked, and one that did not, in Sigil and tried to see if I could spot what made the chapter progress work. One thing I did note is that in the book that worked there was a populated toc.ncx file with navPoint references to the chapters of the book, but the one that did not work had an almost empty toc.ncx file.

Am I right in assuming that this is what is causing the problem of chapter progress not working?

Any ideas?

phillipgessert 12-27-2020 11:17 AM

Seems likely as the logical TOC is the only place in an ebook where someone explicitly defines a chapter startpoint as such.

Ashjuk 12-27-2020 12:39 PM

Quote:

Originally Posted by phillipgessert (Post 4074263)
Seems likely as the logical TOC is the only place in an ebook where someone explicitly defines a chapter startpoint as such.

That was my thinking, but I thought I would ask to see if anyone knew definitively whether this was the case.

The next step I suppose will be to try editing the toc.ncx file of a book that does not work to see what happens.

theducks 12-27-2020 06:47 PM

I suspect your book is one big monolithic file with a butt simple NCX: Start
:angry:
Both Sigil and Calibre have ZERO problems working book wide, those made of multiple files. Some folk insist that you can only edit if a single file :rolleyes:

davidfor 12-28-2020 01:18 AM

Quote:

Originally Posted by Ashjuk (Post 4074290)
That was my thinking, but I thought I would ask to see if anyone knew definitively whether this was the case.

The next step I suppose will be to try editing the toc.ncx file of a book that does not work to see what happens.

It is a combination of what @phillipgessert and @theducks. The Kobo devices use both the internal files and the ToC for the chapter page counts. If you have multiple internal files without a ToC, then the page count will get restarted at the beginning of each file (though I haven't tested this recently so it might have changed). And the chapter page count is also started at whereever a ToC entry points. Overall, it works best with a one-to-one mapping between the internal files and the ToC. But, multiple ToC entries per file is fine. I just wouldn't recommend having an internal file without a ToC entry pointing to the start of it.

And of course, this isn't a Sigil question. How to create the above would be, but, how epubs work and how a particular device works should be elsewhere.

Ashjuk 12-28-2020 05:17 AM

Quote:

Originally Posted by theducks (Post 4074398)
I suspect your book is one big monolithic file with a butt simple NCX: Start
:angry:
Both Sigil and Calibre have ZERO problems working book wide, those made of multiple files. Some folk insist that you can only edit if a single file :rolleyes:

No, both books are structured the same way with each chapter in its own file so its not that.

Quote:

Originally Posted by davidfor (Post 4074505)
It is a combination of what @phillipgessert and @theducks. The Kobo devices use both the internal files and the ToC for the chapter page counts. If you have multiple internal files without a ToC, then the page count will get restarted at the beginning of each file (though I haven't tested this recently so it might have changed). And the chapter page count is also started at whereever a ToC entry points. Overall, it works best with a one-to-one mapping between the internal files and the ToC. But, multiple ToC entries per file is fine. I just wouldn't recommend having an internal file without a ToC entry pointing to the start of it.

And of course, this isn't a Sigil question. How to create the above would be, but, how epubs work and how a particular device works should be elsewhere.

I think it must be down the the ToC file. I have edited the toc.ncx file in the the book that did not work but yet to have put it on my Kob to see if it works.
I have been working my way through both books to see if I can spot any other differences, but so far they appear to be very similar in all other details.

Yes, I realised this is not actually a Sigil problem but, as as it seems there are a lot of knowledgeable people that frequent this forum, I though I would ask here.

Thanks for the replies.

davidfor 12-28-2020 06:48 AM

Quote:

Originally Posted by Ashjuk (Post 4074545)
No, both books are structured the same way with each chapter in its own file so its not that.


I think it must be down the the ToC file. I have edited the toc.ncx file in the the book that did not work but yet to have put it on my Kob to see if it works.
I have been working my way through both books to see if I can spot any other differences, but so far they appear to be very similar in all other details.

Yes, I realised this is not actually a Sigil problem but, as as it seems there are a lot of knowledgeable people that frequent this forum, I though I would ask here.

Except that there are two better places to ask the question. There is a Workshop area dedicated to epubs. There are some extremely knowledgeable people there. And there is a forum dedicated to Kobo ereaders. Again, knowledgeable people who know how these devices work.

Of course, you have also basically ignored our advice. You seem to be looking for something else. All you need to do is generate the ToC to match the internal files and put it on the device. That will solve the problem.

Ashjuk 12-28-2020 11:25 AM

Quote:

Originally Posted by davidfor (Post 4074555)
Except that there are two better places to ask the question. There is a Workshop area dedicated to epubs. There are some extremely knowledgeable people there. And there is a forum dedicated to Kobo ereaders. Again, knowledgeable people who know how these devices work.

Of course, you have also basically ignored our advice. You seem to be looking for something else. All you need to do is generate the ToC to match the internal files and put it on the device. That will solve the problem.

I'm sorry, in future I will try to find the right place to ask my questions.

I was actually trying to generate a Toc by editing the toc.ncx file to match the files of the book. I have looked at the Generate ToC under Tools but I have no idea what to do with that.

As I have said before I am extremely new to using Sigil and there is still a lot that I don't understand.

The Generate Table of Contents box that pops up is blank apart from one line - ToC Entry/Heading Title.
I have tried clicking on everything on that box and nothing appears to do anything apart from OK and cancel so what are you supposed to do with it?

I have tried searching here for Generate ToC but nothing seemed to explain how the tool works.

exaltedwombat 12-28-2020 12:08 PM

Generate TOC looks for text items that are designated as Headers, that is ones inside <h1></h1>, <h2></h2> etc. tags. If the body of a chapter file starts with something like

<h1>Chapter 1. The Beginning</h1>

the TOC generator will have something to work with.

Ashjuk 12-28-2020 12:38 PM

Quote:

Originally Posted by exaltedwombat (Post 4074655)
Generate TOC looks for text items that are designated as Headers, that is ones inside <h1></h1>, <h2></h2> etc. tags. If the body of a chapter file starts with something like

<h1>Chapter 1. The Beginning</h1>

the TOC generator will have something to work with.

Thanks, I think I understand a little more about how it works now.

I have had a look at the book that was not working and I see that the chapters all start with p class tags like this - <p class="h2" id="chapter2">Chapter 2</p>

So if I understand you correctly if I were to change all of them to 'h' class tags the ToC generator would pick them up, right?

exaltedwombat 12-28-2020 01:38 PM

Change one and try!

Ashjuk 12-29-2020 05:04 AM

Quote:

Originally Posted by exaltedwombat (Post 4074680)
Change one and try!

I went through the book and changed the chapter titles to h tags and - as you said - the ToC now shows all the relevant entries.

Thanks for your help. :thumbsup:

AlanHK 12-31-2020 06:37 AM

Quote:

Originally Posted by Ashjuk (Post 4074901)
I went through the book and changed the chapter titles to h tags and - as you said - the ToC now shows all the relevant entries.

If you need to do this again, especially if there are more than a dozen or so chapters, get the Tag Mechanic plugin:
https://www.mobileread.com/forums/sh...d.php?t=270639
and you can do that in one operation.

Ashjuk 12-31-2020 12:59 PM

Quote:

Originally Posted by AlanHK (Post 4075817)
If you need to do this again, especially if there are more than a dozen or so chapters, get the Tag Mechanic plugin:
https://www.mobileread.com/forums/sh...d.php?t=270639
and you can do that in one operation.

Thanks, I will check that out.


All times are GMT -4. The time now is 10:18 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.