View Full Version : How to have a TOC entry link to mid-chapter?


MHC
12-29-2012, 05:08 PM
I'm using the InDesign 5.5 Book feature to convert a printed book to ePub. The main chapters are divided into separate files to provide page breaks, but each chapter has sub-chapters that need second-level (at least) TOC entries.

The subchapters don't start on new pages in the printed book and I need to follow that format.

a) How can I add the TOC entries that jump to the subchapters (either in Indesign or Dreamweaver 5.5) without creating a page break when the user is reading straight through?

b) How can I indent these TOC entries to get 2nd and 3rd levels?

:thanks:

theducks
12-29-2012, 05:22 PM
I'm using the InDesign 5.5 Book feature to convert a printed book to ePub. The main chapters are divided into separate files to provide page breaks, but each chapter has sub-chapters that need second-level (at least) TOC entries.

The subchapters don't start on new pages in the printed book and I need to follow that format.

a) How can I add the TOC entries that jump to the subchapters (either in Indesign or Dreamweaver 5.5) without creating a page break when the user is reading straight through?

b) How can I indent these TOC entries to get 2nd and 3rd levels?

:thanks:
Just add an named anchor
<a id="midway">(optional words)</a>

then the TOC should reference the Anchor:

<content src="Text/index_split_004.xhtml#midway"/>

(I prefer to use a full link instead of a relative link(the red part) )

dgatwood
12-29-2012, 06:25 PM
I would suggest that you not include any text within a destination anchor. Some readers (ADE, I think) incorrectly style all anchors as though they were links. (I discovered this quite by accident last week.)

You can't really fix this in CSS because "color: WindowText" and "color: -webkit-text" aren't globally supported, and setting it to black will wreck display on readers in inverse-color mode.

So basically, just always leave non-link anchors empty. :)

MHC
12-29-2012, 07:24 PM
EDIT: Figured it out - it worked all along, it just didn't bring the anchor to the top of the page - ADE navigates so my subhead is in the middle of the page. Any way to have the subhead at the top? Or is this just an ADE glitch?

Thank you so much!

Original post, ignore:
OK, I added an "empty" anchor in InDesign (no text highlighted) before my subhead name, added an entry in the ncx file using the … chapterX.html#anchorname code and re-numbered all the navPoints and playOrders in DW.

I now have the correct TOC entry, but it takes me to the beginning of the main chapter - not the anchor within it. I'm previewing in ADE, as my device isn't here - is that the problem, or do I have to do something else to get it to go to the anchor point?

Dreamweaver does show the anchor is in the correct spot (mid-chapter), and I double-checked what I've done so far. Thanks!

dgatwood
12-29-2012, 08:52 PM
EDIT: Figured it out - it worked all along, it just didn't bring the anchor to the top of the page - ADE navigates so my subhead is in the middle of the page. Any way to have the subhead at the top? Or is this just an ADE glitch?


I think you're misunderstanding the difference between scrolling media and paged media.

Book readers act like paged media (e.g. printed pages); element positioning is computed only once when you first open the book, so that page 65 is always page 65. (*)

When clicking a link to an anchor, a reader behaves as though you turned to the page containing that anchor using the "next page" button. So if the subheading is halfway down the page, it appears halfway down the page just as it would if you turned to that page in a printed copy of the book.

If you want the subhead to be at the top of the page, you would need to insert a page break before the heading to force it to always be at the top of the page.


(*) As a special exception, changing the reader's font style/size settings, margin settings, etc. forces the reader to lay out the book's content again.

MHC
12-29-2012, 11:14 PM
Good to know, I assumed incorrectly. Thanks for your help everyone!

Jellby
12-30-2012, 04:34 AM
I would suggest that you not include any text within a destination anchor. Some readers (ADE, I think) incorrectly style all anchors as though they were links. (I discovered this quite by accident last week.)

You can't really fix this in CSS because "color: WindowText" and "color: -webkit-text" aren't globally supported, and setting it to black will wreck display on readers in inverse-color mode.

But

a { color: inherit; text-decoration: none; }

works perfectly ;)

dgatwood
12-31-2012, 12:16 AM
But

a { color: inherit; text-decoration: none; }

works perfectly ;)

Wow. I never even knew "inherit" existed. It's not often that such a keyword would be useful, but this is one of those nasty edge cases in the spec where it is. :)