Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 01-07-2012, 11:47 PM   #1
Phil_C
Addict
Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.
 
Phil_C's Avatar
 
Posts: 274
Karma: 391602
Join Date: Oct 2009
Location: Chicago, IL USA
Device: Sony PRS-350; Kobo Clara HD; Kobo Clara 2E; Kobo Clara BW
LRF>EPUB fouls up TOC links

I've been converting many Book Designer LRFs to EPUBs, now that I figured out how to tweak the resulting EPUB to make some minor font and line height adjustments.

Imagine my consternation when I tried to read a couple of these EPUBs on my Sony PRS-350 and found that all of my TOC links are suddenly off by one chapter.

If I click in the TOC on chapter 1, it goes to chapter 2. Clicking on a chapter link takes me back to chapter 1 instead of the TOC.

Strangely, the links work properly when viewed in Calibre. But NOT on the reader.

And NOT in the Sony Library software either.

EPUBs from other sources are all fine.

Ideas, anyone?!?
Phil_C is offline   Reply With Quote
Old 01-08-2012, 11:07 AM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,001
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Phil_C View Post
I've been converting many Book Designer LRFs to EPUBs, now that I figured out how to tweak the resulting EPUB to make some minor font and line height adjustments.

Imagine my consternation when I tried to read a couple of these EPUBs on my Sony PRS-350 and found that all of my TOC links are suddenly off by one chapter.

If I click in the TOC on chapter 1, it goes to chapter 2. Clicking on a chapter link takes me back to chapter 1 instead of the TOC.

Strangely, the links work properly when viewed in Calibre. But NOT on the reader.

And NOT in the Sony Library software either.

EPUBs from other sources are all fine.

Ideas, anyone?!?
Calibre's viewer makes the book into a linear presentation.
Your TOC anchor is probably the Last item on the previous chapters page . Because the pages have been stitched together, they appear (almost,) correct.

I have seen this a few times.
I don't know how to get Calibre to do it otherwise. I just, tediously , Joined and Split at the proper point, in Sigil
theducks is offline   Reply With Quote
Advert
Old 01-08-2012, 11:35 AM   #3
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,612
Karma: 145864263
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Forget the internal ToC. Is the external (toc.ncx) correct?
JSWolf is offline   Reply With Quote
Old 01-08-2012, 11:55 AM   #4
Phil_C
Addict
Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.
 
Phil_C's Avatar
 
Posts: 274
Karma: 391602
Join Date: Oct 2009
Location: Chicago, IL USA
Device: Sony PRS-350; Kobo Clara HD; Kobo Clara 2E; Kobo Clara BW
First, I don't know much about html or CSS. How do I find the TOC anchor?

As for the TOC.ncx, I opened the EPUB in Sigil and got this:

Code:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1" xml:lang="eng">
  <head>
    <meta content="bfb5f440-ca3c-43f5-8b72-937849983ed6" name="dtb:uid"/>
    <meta content="2" name="dtb:depth"/>
    <meta content="calibre (0.8.33)" name="dtb:generator"/>
    <meta content="0" name="dtb:totalPageCount"/>
    <meta content="0" name="dtb:maxPageNumber"/>
  </head>
  <docTitle>
    <text>The Beasts of Tarzan</text>
  </docTitle>
  <navMap>
    <navPoint id="44fb58d9-ed97-4767-9299-6ed485aaae3d" playOrder="1">
      <navLabel>
        <text>Start</text>
      </navLabel>
      <content src="Text/titlepage.xhtml"/>
    </navPoint>
  </navMap>
</ncx>
I have NO idea what this code means.

The problem is 100% repeatable. Links work fine in Calibre view, but never in Sony Library software or on either of 2 PRS-350's.

How can the links be read differently by different software/devices? I thought the code was the code.
Phil_C is offline   Reply With Quote
Old 01-08-2012, 12:44 PM   #5
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,001
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Phil_C View Post
First, I don't know much about html or CSS. How do I find the TOC anchor?

As for the TOC.ncx, I opened the EPUB in Sigil and got this:

Code:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1" xml:lang="eng">
  <head>
    <meta content="bfb5f440-ca3c-43f5-8b72-937849983ed6" name="dtb:uid"/>
    <meta content="2" name="dtb:depth"/>
    <meta content="calibre (0.8.33)" name="dtb:generator"/>
    <meta content="0" name="dtb:totalPageCount"/>
    <meta content="0" name="dtb:maxPageNumber"/>
  </head>
  <docTitle>
    <text>The Beasts of Tarzan</text>
  </docTitle>
  <navMap>
    <navPoint id="44fb58d9-ed97-4767-9299-6ed485aaae3d" playOrder="1">
      <navLabel>
        <text>Start</text>
      </navLabel>
      <content src="Text/titlepage.xhtml"/>
    </navPoint>
  </navMap>
</ncx>
I have NO idea what this code means.

The problem is 100% repeatable. Links work fine in Calibre view, but never in Sony Library software or on either of 2 PRS-350's.

How can the links be read differently by different software/devices? I thought the code was the code.
Your (unneeded in EPUB ) Inline TOC is no longer in sync with the book

You have (basically) No useful TOC, Only a Start point. (use the GoTo Menu (TOC) on your sony and see)

AFAIK, Calibre will not attempt to create/maintain an inline TOC in EPUB.

the NCX file is all to EPUB
theducks is offline   Reply With Quote
Advert
Old 01-08-2012, 01:17 PM   #6
Phil_C
Addict
Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.
 
Phil_C's Avatar
 
Posts: 274
Karma: 391602
Join Date: Oct 2009
Location: Chicago, IL USA
Device: Sony PRS-350; Kobo Clara HD; Kobo Clara 2E; Kobo Clara BW
I did not know there were two kinds of TOC. I've been creating my books in Book Designer with a TOC, then either:

1) Exporting as LRF to use as is, or
2) Exporting as HTM, to open in Sigil where I adjust font, line height, and split at each chapter.

The Sigil EPUB gets converted again in Calibre, which further adjusts font sizes. (I found the "easiest" way by a lot of trial and error.) The inline (?) TOC holds up when doing it like this.

It seems you are saying that, if I want to use Calibre to convert an LRF to EPUB, the TOC (originally created in BD) should be eliminated.

How does the proper EPUB TOC you are talking about get created? In Sigil? In Calibre? I tried Calibre long ago with no success. Keep in mind, my HTM source is BD, which seems to put out somewhat unconventional code (from what I gather in these forums).
Phil_C is offline   Reply With Quote
Old 01-08-2012, 02:54 PM   #7
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,001
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Phil_C View Post
I did not know there were two kinds of TOC. I've been creating my books in Book Designer with a TOC, then either:

1) Exporting as LRF to use as is, or
2) Exporting as HTM, to open in Sigil where I adjust font, line height, and split at each chapter.

The Sigil EPUB gets converted again in Calibre, which further adjusts font sizes. (I found the "easiest" way by a lot of trial and error.) The inline (?) TOC holds up when doing it like this.

It seems you are saying that, if I want to use Calibre to convert an LRF to EPUB, the TOC (originally created in BD) should be eliminated.

How does the proper EPUB TOC you are talking about get created? In Sigil? In Calibre? I tried Calibre long ago with no success. Keep in mind, my HTM source is BD, which seems to put out somewhat unconventional code (from what I gather in these forums).
The Preferencs: (conversion) Common Options: TOC wizards should help.

Me
I use Sigil.
Set Heading levels, Open the TOC Editor (if not open, I use that to Quick Jump to the Item), Click Generate TOC button, adjust Tics to Hide items (remove the tic at the bottom will show hidden one as well, (Make note if the level is wrong), Save
Wash (edit ), Spin (repeat TOC), Hang out to dry (ship it)
theducks is offline   Reply With Quote
Old 01-08-2012, 02:55 PM   #8
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,251
Karma: 16539642
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
There is no 'One True Way' to do these things, everyone finds their own favourite method in the end.

If you're starting with a clean HTML file, my preferred method is to open it in a text editor and make sure that each chapter is marked up with suitable HTML heading tags.

For instance, for a book with a single level TOC
Code:
<h2>Chapter 1</h2>
...
<h2>Chapter 2</h2>
... ...
Once you've done that you can reimport the HTML file into Calibre and convert to EPUB paying particular attention to the StructureDetection page. The 'Detect chapters at' box can be set to
//h:h2
The resulting EPUB will have a TOC entry wherever you put the <h2>...</h2> tags.


If your book needs a 2-level nested TOC, e.g. with Parts and Chapters, then you can try marking them
Code:
<h2>Part 1</h2>
<h3>Chapter 1</h3>
...
<h3>Chapter 2</h3>
... ...
<h2>Part 2</h2>
<h3>Chapter 3</h3>
...
<h3>Chapter 4</h3>
... ...
When you convert to EPUB the StructureDetection page should have the 'Detect chapters at' box set to
//*[name()='h2' or name()='h3']
and on the TOC page set
'Level 1 TOC' box to //h:h2
'Level 2 TOC' box to //h:h3

The converted EPUB will have TOC entries for each item where you used either <h2>...</h2> or<h3>...</h3> tags. Each <h3> item will be nested inside the previous <h2> item, like the attached pic.
Attached Thumbnails
Click image for larger version

Name:	TOC.jpg
Views:	259
Size:	54.1 KB
ID:	80942  
jackie_w is offline   Reply With Quote
Old 01-08-2012, 05:13 PM   #9
Phil_C
Addict
Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.
 
Phil_C's Avatar
 
Posts: 274
Karma: 391602
Join Date: Oct 2009
Location: Chicago, IL USA
Device: Sony PRS-350; Kobo Clara HD; Kobo Clara 2E; Kobo Clara BW
Here's what the chapter code looks like from Book Designer when opened in Sigil:

Code:
  <p><span id="title"><a id="BdToc_1"></a></span></p>

  <div class="sgc-3">
    <span class="sgc-6" id="title">1 Technician</span>
  </div>
When the same HTM file is dragged into Calibre, some changes seem to get made during the process. This is the same chapter location;

Code:
  <h2 class="title"><a id="BdToc_1"></a></h2>

  <div class="sgc-3">
    <h2 class="title sgc-6">1 Technician</h2>
  </div>
It now contains h2 tags. It looks like something more still has to be done with this before a true TOC can be generated in either Sigil or Calibre. I'll have to fiddle with this to see if I can get it to work.
Phil_C is offline   Reply With Quote
Old 01-08-2012, 05:57 PM   #10
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,001
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Phil_C View Post
Here's what the chapter code looks like from Book Designer when opened in Sigil:

Code:
  <p><span id="title"><a id="BdToc_1"></a></span></p>

  <div class="sgc-3">
    <span class="sgc-6" id="title">1 Technician</span>
  </div>
When the same HTM file is dragged into Calibre, some changes seem to get made during the process. This is the same chapter location;

Code:
  <h2 class="title"><a id="BdToc_1"></a></h2>

  <div class="sgc-3">
    <h2 class="title sgc-6">1 Technician</h2>
  </div>
It now contains h2 tags. It looks like something more still has to be done with this before a true TOC can be generated in either Sigil or Calibre. I'll have to fiddle with this to see if I can get it to work.
Did you click the Generate TOC button? Verify what you see is better than what you have, else cancel.

Save your EPUB the new TOC should show in Calibre's book viewer (use TOC button)
theducks is offline   Reply With Quote
Old 01-08-2012, 07:25 PM   #11
Phil_C
Addict
Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.Phil_C ought to be getting tired of karma fortunes by now.
 
Phil_C's Avatar
 
Posts: 274
Karma: 391602
Join Date: Oct 2009
Location: Chicago, IL USA
Device: Sony PRS-350; Kobo Clara HD; Kobo Clara 2E; Kobo Clara BW
It works!

It looks like Calibre is the way to go, since the original HTM comes from BD. Simply dragging that into Calibre generates h2 tags where there was something else in BD.

I used this to create the TOC and page breaks:

Code:
//h:h2[re:test(@class, "title", "i")]
My old process of RTF>BD>SIGIL>CALIBRE is now shortened because I can skip the Sigil part where I created page breaks and adjusted font stuff. Calibre can do all that.

I'm sure Sigil will be handy for any later tweaks I might need.

This does not directly solve the LRF conversion problem, but I have the original BD files which can quickly put out HTM for Calibre conversion.

Not to mention I discovered a type of TOC I didn't know existed.

Many thanks to all!
Phil_C is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
TOC links inside tables in epub don't translate in mobi wannabee Calibre 1 01-20-2011 01:13 AM
epub: links in toc should not be underlined ... NASCARaddicted Calibre 2 06-15-2010 06:26 PM
ePub eBooks (Fully Edited w/ TOC) Fanfiction, Forumfiction [Links removed by OP] Guns4Hire Reading Recommendations 12 02-25-2010 03:53 AM
505 TOC from PDF to EPUB/LRF wayamauro Sony Reader 18 09-27-2009 04:21 AM
TOC created with EPUB but not LRF? Achilles Calibre 7 08-07-2009 07:24 PM


All times are GMT -4. The time now is 03:22 AM.


MobileRead.com is a privately owned, operated and funded community.