11-02-2008, 11:52 AM | #1 |
Wizard
Posts: 1,176
Karma: 2431850
Join Date: Sep 2008
Device: IPad Mini 2 Retina
|
[Old Thread] RTF and Table of Contents
Hi
I've been happilly converting RTF to LRF using the fantastic Calibre. One thing puzzles me - if it is possible to generate a table of contents? Initially I didn't have any headings in the text, so in the LRF file one chapter led straight into the next. So in Word I then marked all the chapter headings using the Word Heading 1 style. After Calibre had converted the RTF to LRF, I now had page breaks before each chapter. This seems to suggest that Calibre was able to detect the chapter headings correctly. But I cannot get the "Add chapters to table of contents" option to work. Is this supposed to create a TOC even if one does not exist already in the RTF? I have also tried using Word to insert a TOC into the RTF - in Word 2003: Insert -> Reference -> Index and Tables -> Table of Contents -> Untick "Show Page Numbers". I then converted the RTF using Calibre; this has a couple of problems: All the links in ToC in the LRF file jump to the first page of the document (The links work OK in Word). There is two blank lines between each row in the ToC. I will continue to play around with this but any help would be appreciated. I realise that Word puts A LOT of "helpful" tags around headings that probably are not necessary. I imagine this makes Calibre's job very difficult - trying to separate the wheat from the chaff. Thanks |
11-02-2008, 12:23 PM | #2 |
creator of calibre
Posts: 44,346
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I'd sugest converting to epub instead, it has more powerful options for the autogeneration of the TOC (change your output format to epub in the config dialog).
EDIT: Or the following options should work with lrf conversion --chapter-attr h1,none, --add-chapters-to-toc |
11-02-2008, 12:55 PM | #3 |
Wizard
Posts: 1,176
Karma: 2431850
Join Date: Sep 2008
Device: IPad Mini 2 Retina
|
OK, I tried that but the conversion job is not completing - The hour glass is spinning and it has been going for 10 mins already. Conversion to LRF only takes a minute for the same RTF file.
Any thoughts? |
11-02-2008, 12:58 PM | #4 |
creator of calibre
Posts: 44,346
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
epub conversion can be slow sometimes because it has to split the file into smaller chunks (a limitation of adobe's reader software on the 505). You can click the hourglass and then double click the job entry to see what its doing.
|
11-02-2008, 01:26 PM | #5 |
Wizard
Posts: 1,176
Karma: 2431850
Join Date: Sep 2008
Device: IPad Mini 2 Retina
|
I wasn't giving it long enough to convert the file - it took about 20 mins in the end, at least 10 of which was on "Saving stylesheets".
I still didn't get a TOC though... |
11-02-2008, 01:43 PM | #6 |
creator of calibre
Posts: 44,346
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
try the options i talked about above for lrf conversion.
|
11-02-2008, 02:29 PM | #7 |
Wizard
Posts: 1,176
Karma: 2431850
Join Date: Sep 2008
Device: IPad Mini 2 Retina
|
OK I tried those options...I think. I ticked "Add chapters to table of contents" and set "Detect chapter at tag" to "h1,none,", but still no joy.
By the way the RTF has both "Heading 1" and "Heading 2" chapter headings. In the LRF these both have page breaks before them, so Calibre seems to be detecting them OK, but it is not creating a TOC. |
11-02-2008, 03:13 PM | #8 |
creator of calibre
Posts: 44,346
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
That's odd. Open a ticket and send me this rtf.
|
11-02-2008, 04:17 PM | #9 |
Wizard
Posts: 1,176
Karma: 2431850
Join Date: Sep 2008
Device: IPad Mini 2 Retina
|
OK I have raised this as #1220.
Many thanks |
11-10-2008, 06:12 AM | #10 |
Junior Member
Posts: 4
Karma: 10
Join Date: Nov 2008
Device: PRS505
|
TOC in RTF - a solution
I have also tried the auto chapter detection with a number of different formats inc RTF and HTML. I created several test documents so I can control the chapter tag and attribute + value. Nothing works. The only reliable way to get a TOC is to go via Mobipocket Creator which detects the chapter tag ok. The full procedure I used is:
- Edit the doc in Word and save in RTF. Create a word style - I called it ChapterHeading - based on Heading 1. Give all the chapter headings this style. There must be a hard page break before the chapter heading with no other page or section breaks in the doc. Whilst you are at it you can get rid of split lines and multiple blank lines also. Save as RTF. - Switch to Mobipocket Creator and create a new publication by importing a Word doc. Import the RTF and add a TOC. In the TOC panel set 'h' as the tag, 'class' as the attribute and 'ChapterHeading' as the value. Build the publication to get the .prc file. - Switch to Calibre and convert to LRF. - Bingo you have a perfect eBook with TOC. - repeat for the other 15000 ebooks in your collection. |
11-16-2008, 03:37 AM | #11 |
Wizard
Posts: 1,176
Karma: 2431850
Join Date: Sep 2008
Device: IPad Mini 2 Retina
|
This turned out not to be a bug in Calibre at all but my misunderstading
Calibre does not embed a TOC in the ebook itself. However, if you press the Menu button on the Reader and go to the main menu for the book, there is a "Table of Contents" option which will take you to the TOC created by Calibre. This is easier to use than an embedded TOC as it is easier to get to. |
11-16-2008, 09:21 AM | #12 | |
Connoisseur
Posts: 68
Karma: 479602
Join Date: Aug 2006
Device: Kindle DX
|
Quote:
alessandro |
|
02-13-2013, 05:16 AM | #13 |
Junior Member
Posts: 2
Karma: 1234
Join Date: Feb 2013
Device: none
|
Working TOC in RTF
Code:
{\rtf1\ansi\deff0\adeflang1045 {\fonttbl {\f0\fsserif\fcharset238 Verdana;}} \titlepage\line\line\line\line\line {\pard {\field{\*\fldinst HYPERLINK \\l "toc"} {\fldrslt\f0\fs80\b\scaps\qc\ul0 Title Page\line go to Table of Contents}} \par} \page{\*\bkmkstart page2}{\*\bkmkend page2}\line\line\line\line\line{\pard\f0\fs80\b\scaps\qc\sa10000{\field{\*\fldinst HYPERLINK \\l "toc"} {\fldrslt Page}} \chpgn\par} \page{\*\bkmkstart page3}{\*\bkmkend page3}\line\line\line\line\line{\pard\f0\fs80\b\scaps\qc\sa10000{\field{\*\fldinst HYPERLINK \\l "toc"} {\fldrslt Page}} \chpgn\par} \page{\*\bkmkstart page4}{\*\bkmkend page4}\line\line\line\line\line{\pard\f0\fs80\b\scaps\qc\sa10000{\field{\*\fldinst HYPERLINK \\l "toc"} {\fldrslt Page}} \chpgn\par} \page{\*\bkmkstart page5}{\*\bkmkend page5}\line\line\line\line\line{\pard\f0\fs80\b\scaps\qc\sa10000{\field{\*\fldinst HYPERLINK \\l "toc"} {\fldrslt Page}} \chpgn\par} \page{\*\bkmkstart toc}{\*\bkmkend toc}{\pard\sa1000\f0\fs50\b\qc{\field{\*\fldinst TOC}{\fldrslt Table of Contents}}\par} {\pard\f0\fs28\fi0\trowd\cellx8000\cellx8600 \pard\intbl\ql {\field{\*\fldinst HYPERLINK \\l "page2"} {\fldrslt\ul0 Link to anchor #page2}}\cell\pard\intbl\qr {\field{\*\fldinst PAGEREF page2}}\cell\row \pard\intbl\ql {\field{\*\fldinst HYPERLINK \\l "page3"} {\fldrslt\ul0 Link to anchor #page3}}\cell\pard\intbl\qr {\field{\*\fldinst PAGEREF page3}}\cell\row \pard\intbl\ql {\field{\*\fldinst HYPERLINK \\l "page4"} {\fldrslt\ul0 Link to anchor #page4}}\cell\pard\intbl\qr {\field{\*\fldinst PAGEREF page4}}\cell\row \pard\intbl\ql {\field{\*\fldinst HYPERLINK \\l "page5"} {\fldrslt\ul0 Link to anchor #page5}}\cell\pard\intbl\qr {\field{\*\fldinst PAGEREF page5}}\cell\row \par} } Last edited by yarr; 02-13-2013 at 08:43 AM. |
02-13-2013, 05:39 AM | #14 | ||
US Navy, Retired
Posts: 9,865
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
|
Welcome to MobileRead!
Moderator Notice
I know you mean well and I encourage you to help folks with your knowledge, but stop resurrecting ancient threads. The thread you are posting to is over 4 years old. Calibre has gone through Five Major revisions and over 200 minor version updates since this thread was created. There was an Old Thread Warning below your reply window that you didn't see or chose to ignore. As a general rule necroposting should be avoided. When in doubt start a new thread. Quote:
Last edited by DoctorOhh; 02-13-2013 at 05:44 AM. |
||
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Table of Contents not being identified as Table of Contents | openletter | Conversion | 2 | 10-19-2012 12:54 AM |
[Old Thread] Table of contents forced to end not start of .mobi | irishpolyglot | Conversion | 4 | 05-24-2011 08:33 PM |
Table of Contents | ucoa | Calibre | 1 | 01-07-2011 09:01 PM |
Table of Contents RTF > MOBI | daxmon87 | Calibre | 12 | 10-09-2010 12:46 AM |
PRS-500 Is Working Table of Contents Possible with RTF? | Falstaff | Sony Reader Dev Corner | 2 | 12-20-2006 11:42 PM |