Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 04-10-2012, 07:39 AM   #1
Kratos
Connoisseur
Kratos began at the beginning.
 
Posts: 60
Karma: 10
Join Date: Mar 2011
Location: UK
Device: Kindle 3, iPhone, iPad, PC
How do I add a Table of Contents to a Kindle Previewer mobi?

I've made an epub with Indesign. I converted it to a mobi using KindlePreview after a bit of help from this forum everything looks great! I'm ready to upload to Amazon. I manually created a table of contents with hyperlinks at the start of the book and this works fine. But the Go to Table of Contents function is not working.

Searching the internet I've learnt I have to tinker with this myself by creating a html document and adding a 'toc tag?' into my file. I've seen some comments to use Mobipocket creator but they refer to people who are making books with Word. I'm not sure if this would also affect the formatting of my book.

I'm a complete beginner with this but would appreciate any advice or links to a step by step guide. I really don't know where to start. Thanks
Kratos is offline   Reply With Quote
Old 04-10-2012, 07:55 AM   #2
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,465
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
In order for the "Go to Table of Contents" functionality to work. There must be a reference item in the Guide section of the OPF file identifying the html ToC.

Code:
<guide>
  .
  .
  <reference href="Text/your_file_name.xhtml" title="Table Of Contents" type="toc" />
  .
  .
</guide>
The dots only indicate that there may be other reference tags before or after the one for the TOC.

Make sure the "href" attribute actually points to your html toc (correct file name/location). If your ToC is a single stand-alone html file, that's all you need to do. But if it's just a section of another HTML file, you'll have to identify it with an anchor (or any tag with an "id" attribute actually) and include that url fragment in the <reference /> tag's href attribute. In the HTML file:
Code:
<a id="toc"></a>
and in the OPF file:
Code:
<reference href="Text/your_file_name.xhtml#toc" title="Table Of Contents" type="toc" />
DiapDealer is offline   Reply With Quote
Advert
Old 04-10-2012, 08:28 AM   #3
Kratos
Connoisseur
Kratos began at the beginning.
 
Posts: 60
Karma: 10
Join Date: Mar 2011
Location: UK
Device: Kindle 3, iPhone, iPad, PC
DiapDealer Im finding it quite difficult so thanks for taking the time to help.To keep things simple its probably best I create a separate html ToC rather then muck about with my code. So let me reiterate and see if I've understood this right.

* I first unzip the original epub

* I create a separate html table of contents. With this code listed at the top
Code:
<a id="toc"></a>
Is there any examples or links on how to format it right? I add this into unzipped epub folder.

* I then add the Guide code you listed above to my OPF file. -In my OPF there isn't a Guide section. There is metadata, manifest, and a spine toc=ncx. So I add it between metadata and manifest?

And it will look like this
Code:
<guide>
  <reference href="Text/your_file_name.xhtml" title="Table Of Contents" type="toc" />
</guide>
But then where do I put this?
Code:
<reference href="Text/your_file_name.xhtml#toc" title="Table Of Contents" type="toc" />
* I then rezipped the folder into an epub and use Kindle Previewer to convert it into a mobi and the ToC should work.

Is that right?!

Also, do I need to put some markers at the start of each html document (chapter page) so the ToC can find it?

Last edited by Kratos; 04-10-2012 at 08:33 AM.
Kratos is offline   Reply With Quote
Old 04-10-2012, 09:08 AM   #4
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,465
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Sorry to be unclear. It's an either/or situation. If you have a separate html file for your TOC (and it's already listed in the Manifest and the Spine), all you need to do is add the one reference item to the guide section of the OPF:
Code:
<reference href="Text/your_file_name.xhtml" title="Table Of Contents" type="toc" />
You won't need to add any other code in that situation. The rest of the stuff I mentioned is only used if your TOC is NOT a completely separate html file in the ePub.

The Guide section usually appears after the Spine section, but I doubt if that's a requirement.
Code:
  .
  .
  .
  </spine>
  <guide>
    <reference href="Text/your_file_name.xhtml" title="Table Of Contents" type="toc" />
  </guide>
</package>
Also, rather than unzipping your epub and editing and then rezipping... you make want to consider using Sigil to do the final tweaking of your ePub before using Kindlegen/Calibre on it to build the MOBI. Sigil makes it pretty trivial to edit metadata, and mark a certain file as the TOC (which will create the proper OPF entries).

As to the actual content/formatting of the HTML ToC, you'd indicated that you already created it. But it's nothing more than a bunch of html links to different points in the ebook. Nothing special is really needed. If the links were working properly (with the exception of the "Go to ToC" functionality), then you've already done that part correctly.
DiapDealer is offline   Reply With Quote
Old 04-10-2012, 10:41 AM   #5
Kratos
Connoisseur
Kratos began at the beginning.
 
Posts: 60
Karma: 10
Join Date: Mar 2011
Location: UK
Device: Kindle 3, iPhone, iPad, PC
Oh Lord I am so stuck. I haven't done anything yet. Nothing listed in my Manifest or Spine. No ToC created yet. I don't know what step 1 should be.

So close to finishing but so far. Why doesn't Amazon include a ToC maker? The mental thing is I can't find any relevant instructions via the internet. They are all for Word or html.

I'm trying a non-coding method. I've installed Sigil. I have edited the metadata with it. But not created a Table of Contents. It tells me to use Calibre! Which is not an option because it loses the formating I have.
Kratos is offline   Reply With Quote
Advert
Old 04-10-2012, 10:55 AM   #6
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,465
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
The mental thing is I can't find any relevant instructions via the internet. They are all for Word or html.
The html instructions are what you're looking for. You need to create links to various anchor points in your epub's html code.

Just so we're somewhat on the same page... this:
Quote:
Originally Posted by Kratos
I manually created a table of contents with hyperlinks at the start of the book and this works fine.
is what led me to believe that you already had the "heavy lifting" done and only needed to tweak the OPF file. Are you now telling me that you don't already have a working html table of contents?
DiapDealer is offline   Reply With Quote
Old 04-10-2012, 11:19 AM   #7
Kratos
Connoisseur
Kratos began at the beginning.
 
Posts: 60
Karma: 10
Join Date: Mar 2011
Location: UK
Device: Kindle 3, iPhone, iPad, PC
I do have a internal Table of Contents that is viewable like an ordinary page. But not the Kindle menu accessible ToC.
Kratos is offline   Reply With Quote
Old 04-10-2012, 11:32 AM   #8
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,465
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
I do have a internal Table of Contents that is viewable like an ordinary page. But not the Kindle menu accessible ToC.
Good. Let's start from right there. Do you have a functional ePub we can experiment with (preferably a copy of the original "almost there" version) that contains that viewable table of contents?
DiapDealer is offline   Reply With Quote
Old 04-10-2012, 11:37 AM   #9
Kratos
Connoisseur
Kratos began at the beginning.
 
Posts: 60
Karma: 10
Join Date: Mar 2011
Location: UK
Device: Kindle 3, iPhone, iPad, PC
yes I do!
Kratos is offline   Reply With Quote
Old 04-10-2012, 11:59 AM   #10
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,465
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Open a copy of that ePub with Sigil and locate the html file that contains that viewable ToC in Sigil's Book Browser (where you can see all the folders, html files, css, opf... etc) and double-click it to open it. Does that html file contain other parts of the ebook in addition to the ToC section? Or does it only contain the ToC?
DiapDealer is offline   Reply With Quote
Old 04-10-2012, 12:02 PM   #11
Kratos
Connoisseur
Kratos began at the beginning.
 
Posts: 60
Karma: 10
Join Date: Mar 2011
Location: UK
Device: Kindle 3, iPhone, iPad, PC
Quote:
Originally Posted by DiapDealer View Post
Open a copy of that ePub with Sigil and locate the html file that contains that viewable ToC in Sigil's Book Browser (where you can see all the folders, html files, css, opf... etc) and double-click it to open it. Does that html file contain other parts of the ebook in addition to the ToC section? Or does it only contain the ToC?
I've opened a copy of the epub in Sigil.
On the panel on the left I can see all the internal files which are
* the individual html files for each page/chapter
* Styles, Images, Fonts, Misc folders
* toc.ncx
* content.opf
Kratos is offline   Reply With Quote
Old 04-10-2012, 12:14 PM   #12
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,465
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Can you find/select the HTML file that contains what you described as the "internal Table of Contents that is viewable like an ordinary page"? The list of "hyperlinks at the start of the book"?

When you do find it... does that HTML file contain ONLY the Table of contents (the working hyperlinks), or does it also contain more of the ebook (like the first chapter or more)?
DiapDealer is offline   Reply With Quote
Old 04-10-2012, 12:21 PM   #13
Kratos
Connoisseur
Kratos began at the beginning.
 
Posts: 60
Karma: 10
Join Date: Mar 2011
Location: UK
Device: Kindle 3, iPhone, iPad, PC
In the book I created a page that has just the table of contents and nothing else. This is a sample from the body part -edited.


Code:
<body>
  <div class="story" id="AAA-Fab-05b-chapter-heads-2.html" xml:lang="en-GB">
    <p class="chapter" id="toc_marker-3"><span class="body sgc-1"><a id="Anchor-376"></a></span><span class="Chapter-Text sgc-2">Table of Contents</span></p>

    <p class="body"><span class="ToC-larger-Text sgc-3"><br /></span><a href="#Anchor-317"><span class="ToC-larger-Text sgc-3">Foreword</span></a></p>
Kratos is offline   Reply With Quote
Old 04-10-2012, 12:37 PM   #14
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,465
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Don't confuse "page" with "file." What I'm asking is if the TOC "page" that you created is the only thing in that particular html "file." Or does that same html file contain many other pages (in addition to the TOC).
DiapDealer is offline   Reply With Quote
Old 04-10-2012, 12:40 PM   #15
Kratos
Connoisseur
Kratos began at the beginning.
 
Posts: 60
Karma: 10
Join Date: Mar 2011
Location: UK
Device: Kindle 3, iPhone, iPad, PC
It just has references to the ToC.
Because when I created the epub in Indesign on export I chose to break the document at my Chapter Title paragraph style. So the next chapter is in its own html page.

Here is the code from the page - with extra chapter hyperlinks removed.

Code:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>AAA Fab 05b chapter heads-2.html</title>
  <link href="../Styles/template.css" rel="stylesheet" type="text/css" />
  <style type="text/css">
/*<![CDATA[*/

  span.sgc-4 {font-size:1.43em;}
  span.sgc-3 {font-size:1.14em;}
  span.sgc-2 {font-size:1.11em;}
  span.sgc-1 {font-size:0.67em;}
  /*]]>*/
  </style>
</head>

<body>
  <div class="story" id="AAA-Fab-05b-chapter-heads-2.html" xml:lang="en-GB">
    <p class="chapter" id="toc_marker-3"><span class="body sgc-1"><a id="Anchor-376"></a></span><span class="Chapter-Text sgc-2">Table of Contents</span></p>

    <p class="body"><span class="ToC-larger-Text sgc-3"><br /></span><a href="#Anchor-317"><span class="ToC-larger-Text sgc-3">Foreword</span></a></p>

    <p class="body"><span class="Chapter-Text sgc-4"><a id="Anchor-317"></a><br />
    <br />
    <br /></span></p>
  </div>
</body>
</html>

Last edited by Kratos; 04-10-2012 at 12:55 PM.
Kratos is offline   Reply With Quote
Reply

Tags
mobi, table of contents, toc

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creator How do I add a table of contents when using mobipocket creator? Kratos Kindle Formats 24 06-20-2012 05:03 AM
Extract table of contents from mobi file oecherprinte Kindle Formats 7 04-16-2012 12:10 PM
Table of Contents RTF > MOBI daxmon87 Calibre 12 10-09-2010 12:46 AM
Table of Contents - html to Mobi problem thames Calibre 3 06-02-2010 07:24 PM
PRS-500 Can I add a table of contents to a given lrf file? harpum Sony Reader Dev Corner 0 07-13-2007 08:36 PM


All times are GMT -4. The time now is 01:39 AM.


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