View Full Version : TOC issue: only h2, h3 selectable, not h1


bubism
08-01-2013, 10:15 PM
Hello,

I have created a perfectly validated epub file with Sigil. Its TOC correctly reflects the nested h1, h2, ecc. titles.

The problem: when I check out the file on my actual reader (a Sony T1), I cannot select parent entries in the contents table. In example, selecting h1 entries only "opens" and "closes" their internal list of h2, h3... subheadings, instead of going to the start of the chapter (the h1 entry in question). Same goes with any entry containing subheadings.

Does anybody know how to fix this?

DomesticExtremis
08-02-2013, 01:01 AM
Make the h1s h2s and style a special h2 subclass to have a larger font?

Admittedly, the reader should perhaps behave better but this might work around it.

bubism
08-02-2013, 06:35 AM
Nope. The problem is not the h level, but the behavior of parent headings of any level.

Anytime a h contains sublevel h headings, it only behaves as a "container" instead of a "destination".

Any suggestion?

theducks
08-02-2013, 10:08 AM
This is a known ADE problem. (The NCX is valid)

P1
C1
C2
P2
C3

You can't land on the P1 or P2 pages except by navigating (pg fwd/back) there from either side :(

bubism
08-02-2013, 10:26 AM
Oh. So no solution at all?

Also, is this a Sony readers problem only, or does it happen with every device?

theducks
08-02-2013, 11:32 AM
Oh. So no solution at all?

Also, is this a Sony readers problem only, or does it happen with every device?

Happens on my PEz.
It is a MRSDK (ADE) issue.
A Flat, 1 level TOC (NCX) is the only easy way

DaleDe
08-02-2013, 01:21 PM
The best solution is to not include any text between the H1 and the first H2. This way it becomes a non-issue.

bubism
08-02-2013, 05:27 PM
@DaleDe: I suspect we are getting closer, but please bear with me... The text looks something like:

<h1>Chapter Title</h1>
Opening text of the chapter, possibly several pages long...
<h2>Subheading</h2>
More text, possibly including further sub-subheadings...

So, the text between h1 and h2 is there and I can't do anything about it.

DaleDe
08-02-2013, 05:37 PM
@DaleDe: I suspect we are getting closer, but please bear with me... The text looks something like:

<h1>Chapter Title</h1>
Opening text of the chapter, possibly several pages long...
<h2>Subheading</h2>
More text, possibly including further sub-subheadings...

So, the text between h1 and h2 is there and I can't do anything about it.

yes, but there is nothing preventing an extra H2 tag using the same name as the Chapter title or something very similar.

Dale

bubism
08-02-2013, 06:42 PM
So are you suggesting:

<h1>Chapter Title</h1>
<h2>Chapter title</h2>
Opening text of the chapter, possibly several pages long...
<h2>Subheading</h2>
More text, possibly including further sub-subheadings...

?

pholy
08-02-2013, 06:49 PM
Just to avoid the visual duplication of the title, I would suggest:

<h1>Chapter numeral</h1>
<h2>Title</h2>
Opening text of the chapter, possibly several pages long...
<h2>Subheading</h2>
More text, possibly including further sub-subheadings...

Just an idea off the top of my head, I haven't used it yet.

bubism
08-02-2013, 08:50 PM
I tried the above suggestion... then I realized that -beside being ingenuous yet ugly - it doesn't really solve the problem, as any parent heading, at any level, remains not selectable. In other words, it (sorta) works for chapters, but not for subheadings.

Any taker?

DaleDe
08-02-2013, 09:23 PM
Apply recursion.

Dale

Hitch
08-03-2013, 06:04 AM
Apply recursion.

Dale

If I may, why not this?



<h1>Yippity-yippity</h1>
<h2>Start Reading</h2>
<h2>next chapter</h2>


Or, "Beginning," or whatever? It's neither ugly nor out of fashion; heaven knows, the "James Patterson TOC," with its Title and Start Reading as the sole entries, gets requested around here all the time, if that helps.

Other than that, there's really nothing you can do. The h1 won't work as a "go to" link, and you can only jump to the reading material from an active link, by definition. Therefore, you need to find a way to put a usable link there for the readers to use. We oftentimes use h1 headers with the title attribute only, so that no text displays on the page, but does on the NCX, with an h2 following for a sub-header, but you seem to not like that idea?

HTH,
Hitch

DaleDe
08-03-2013, 12:05 PM
The reasons for using several levels is structure of the document. Using H1 for title doesn't actually buy any structure, although I have been know to use it that way myself. But if you do then the TOC will show only one entry and then you will have to expand it to get to the chapters. You haven't bought any structure. You might as well have only a single level. However, the collapsing of sections and expanding of sections can be quite useful in a TOC so multiple levels structurally make a lot of sense. It is unfortunate that ADE assumes that the higher level is always just a structural container without any text but that is what they assume. I have certainly seen documents that use that same assumption but some do not. One thing might be:

<h1>Chapter 1</h1>
<h2>Introduction to chapter 1</h2>
<h2>section 1</h2>
<h3>introduction to chapter 1 section 1</h3>
<h3>subsection</h3>
etc. etc.

It does not make much sense to have more that 3 levels in any event.

Dale

DomesticExtremis
08-03-2013, 05:16 PM
Nope. The problem is not the h level, but the behavior of parent headings of any level.

Anytime a h contains sublevel h headings, it only behaves as a "container" instead of a "destination".

Any suggestion?

This doesn't make sense to me - it implies that even if they were all h2, the first one in the book/page would act as a container.
Is that correct?

What I was thinking was:


<h2 class="chapterheading">chapter 1</h2>
<p>intorductory text</p>
<h2 class="subheading">subheading</h2>
<p>etc</p>



With appropriate styling for the various h2 classes.

Hitch
08-03-2013, 05:53 PM
This doesn't make sense to me - it implies that even if they were all h2, the first one in the book/page would act as a container.
Is that correct?

No. Not unless it had h3's beneath it, similarly structured to the h1-h2 examples above.

What I was thinking was:


<h2 class="chapterheading">chapter 1</h2>
<p>intorductory text</p>
<h2 class="subheading">subheading</h2>
<p>etc</p>



With appropriate styling for the various h2 classes.

This seems to be what the OP does not want to do, for some reason. It seems that the H1 header has text immediately after it (like an introductory section), which is then followed by, Chapter 1, which the OP has structured as an H2, so that the ncx looks collapsible/outline-like in the NCX view (in ADE, Nook, etc.). However, when you do that, you can't use the h1 header, in the NCX, as a link to the actual content in the book. In other words, when you click the h1, (in the NCX TOC) it simply expands/collapses the underlying h2 TOC items. It won't take you to the h1 header, nor the text content, in the book. That's the issue, it seems.

Hitch

bubism
08-03-2013, 09:24 PM
@Hitch/DaleDe - I am not entirely sure to be able to follow your answers.

One information you might find useful is a small section of the actual TOC, where you can see that I am talking about an enormous encyclopedic work (just short of 800 pages originally), where structure is most important to allow a meaningful reading experience.

https://www.dropbox.com/sc/rc90xuxmrsmz4v9/oi-LucFyjE

Jellby
08-04-2013, 02:50 AM
Since this problem is related to the NCX, it has nothing to do with <h1>, <h2> or whatever is in the HTML files. Except that the NCX can be automatically created from those tags by some editors, but that's only a convenient tool.

One could have something like:

<h1>Chapter One</h1>
<p>Some text</p>

<h2 id="sec1">Section 1</h2>
<p>Some text</p>

<h2 id="sec2">Section 2</h2>
<p>Some text</p>

From which the "default" NCX would look like this:

<navPoint id="Chap1">
<navLabel><text>Chapter One</text></navLabel>
<content src="Chap1.xhtml" />
<navPoint id="Sec1">
<navLabel><text>Section 1</text></navLabel>
<content src="Chap1.xhtml#sec1" />
</navPoint>
<navPoint id="Sec2">
<navLabel><text>Section 2</text></navLabel>
<content src="Chap1.xhtml#sec2" />
</navPoint>
</navPoint>

with sections 1 and 2 inside the block of chapter 1, and this is the problem. Well, nothing prevents you changing the NCX, and only that, into:

<navPoint id="Chap1">
<navLabel><text>Chapter One</text></navLabel>
<content src="Chap1.xhtml" />
</navPoint>
<navPoint id="Chap1c">
<navLabel><text>Chapter One contents</text></navLabel>
<content src="Chap1.xhtml" />
<navPoint id="Sec1">
<navLabel><text>Section 1</text></navLabel>
<content src="Chap1.xhtml#sec1" />
</navPoint>
<navPoint id="Sec2">
<navLabel><text>Section 2</text></navLabel>
<content src="Chap1.xhtml#sec2" />
</navPoint>
</navPoint>

Hitch
08-04-2013, 04:49 PM
Since this problem is related to the NCX, it has nothing to do with <h1>, <h2> or whatever is in the HTML files. Except that the NCX can be automatically created from those tags by some editors, but that's only a convenient tool.

One could have something like:

<h1>Chapter One</h1>
<p>Some text</p>

<h2 id="sec1">Section 1</h2>
<p>Some text</p>

<h2 id="sec2">Section 2</h2>
<p>Some text</p>

From which the "default" NCX would look like this:

<navPoint id="Chap1">
<navLabel><text>Chapter One</text></navLabel>
<content src="Chap1.xhtml" />
<navPoint id="Sec1">
<navLabel><text>Section 1</text></navLabel>
<content src="Chap1.xhtml#sec1" />
</navPoint>
<navPoint id="Sec2">
<navLabel><text>Section 2</text></navLabel>
<content src="Chap1.xhtml#sec2" />
</navPoint>
</navPoint>

with sections 1 and 2 inside the block of chapter 1, and this is the problem. Well, nothing prevents you changing the NCX, and only that, into:

<navPoint id="Chap1">
<navLabel><text>Chapter One</text></navLabel>
<content src="Chap1.xhtml" />
</navPoint>
<navPoint id="Chap1c">
<navLabel><text>Chapter One contents</text></navLabel>
<content src="Chap1.xhtml" />
<navPoint id="Sec1">
<navLabel><text>Section 1</text></navLabel>
<content src="Chap1.xhtml#sec1" />
</navPoint>
<navPoint id="Sec2">
<navLabel><text>Section 2</text></navLabel>
<content src="Chap1.xhtml#sec2" />
</navPoint>
</navPoint>

Jellby:

Yes, or, even simpler, same exact effect:

<h1>Chapter One</h1>
<p>Some text</p>

<h2 id="sec1c" title="Chapter One Contents">&nbsp;</h2>

<h2 id="sec1">Section 1</h2>
<p>Some text</p>

<h2 id="sec2">Section 2</h2>
<p>Some text</p>

Which would keep him from having to mess with his ncx, if he's uncomfortable doing that. However, his replies so far have indicated that he doesn't seem to want to put any new navpoint (however created) in his NCX, at least, that was my take. He wants a solution whereby somebody clicks the h1 header in the NCX and it works, which I don't think any of us can do.

However, your solution is FAR more elegant and Steely-Eyed ePUB Pilot-worthy than mine, which is a cheat we use all the time. :eek:

Hitch

bubism
08-04-2013, 08:30 PM
@jellby & Hitch - Thank you for your answers... I (a "she", actually) really hoped there was a different solution, but I think I got it now.
I am baffled by the sheer stupidity of designing a device so quirky on such a basic usage... but at the least I now know what's happening under its hood :)

Jellby
08-05-2013, 03:30 AM
Yes, or, even simpler, same exact effect:

<h1>Chapter One</h1>
<p>Some text</p>

<h1 id="sec1c" title="Chapter One Contents">&nbsp;</h1>

<h2 id="sec1">Section 1</h2>
<p>Some text</p>

<h2 id="sec2">Section 2</h2>
<p>Some text</p>

I guess the red bits are h1's and not h2's as you had. I'd rather put that dummy title right below the true <h1>, so it would point to the same place (for readers that can use the NCX properly). And I'd make sure it doesn't show at all in the main text, instead of introducing a (possibly unwanted) blank line plus margins. Oh, and that solution only works with Sigil (and maybe similar software), but ePubs can be created in so many different ways ;)

Hitch
08-05-2013, 03:42 AM
I guess the red bits are h1's and not h2's as you had. I'd rather put that dummy title right below the true <h1>, so it would point to the same place (for readers that can use the NCX properly). And I'd make sure it doesn't show at all in the main text, instead of introducing a (possibly unwanted) blank line plus margins. Oh, and that solution only works with Sigil (and maybe similar software), but ePubs can be created in so many different ways ;)

Actually, I had meant to cut out the "some text" or move it below the title option, yes. And, yes, it only works with Sigil, but I thought she'd said that's what she was using, mea culpa. ;-)

Hitch