07-31-2009, 09:56 AM | #1 |
Enthusiast
Posts: 43
Karma: 29000
Join Date: Jul 2009
Device: Kindle Paperwhite
|
How to do Table of Contents in Calibre?
Hi all,
Finally got my sony reader today and am loving it! Just had a quick query I was hoping someone could help with. I had an ebook in rtf format and converted it to lrf in calibre. Use the autodetect TOC checkbox though no table of contents is created. I was wondering if it's possible to create a TOC based on the occurance of a word followed by either a number 'chapter 1' or another word 'chapter one'. Could I then skip through chapters via the TOC for that book or do I have to keep skipping through until I catch up to where I am which is chapter 11 in this case? I tend to read alot at work see so will most likely want a way to quickly catch up on my ebook and this is the only option I can think of as I couldn't find anyway to search. Any ideas? Last edited by Killian; 07-31-2009 at 05:22 PM. |
07-31-2009, 05:16 PM | #2 |
Enthusiast
Posts: 43
Karma: 29000
Join Date: Jul 2009
Device: Kindle Paperwhite
|
Managed to find this thread Problem Generateing TOC and used the info within to generate this; //*[re:test(., "chapter", "i")]
Seems to have done the job aslong as I use epub. Am assuming you can't do it with lrf. Not quite sure why but I'm getting 3 entries for each chapter in the newly generated TOC. Any ideas? |
Advert | |
|
07-31-2009, 05:32 PM | #3 |
creator of calibre
Posts: 44,293
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Probably because that expression is matching 3 separate tags for each chapter entry
|
07-31-2009, 05:34 PM | #4 |
Enthusiast
Posts: 43
Karma: 29000
Join Date: Jul 2009
Device: Kindle Paperwhite
|
I did think that but having checked the html in the epub (one html file for each chapter) I can only see one tag. Was going to specify the class but Calibre puts all the classes as 'calibre2'. Will keep having a play about; not the end of the world though. Atleast it's working
|
07-31-2009, 05:37 PM | #5 |
creator of calibre
Posts: 44,293
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Look at the source html not the final epub as the matching happens before the final epub is generated
|
Advert | |
|
07-31-2009, 06:38 PM | #6 |
Enthusiast
Posts: 43
Karma: 29000
Join Date: Jul 2009
Device: Kindle Paperwhite
|
The source file is rtf. Perhaps it would help if I first convert to html and go from there?
Edit: Can't see an option to convert to html so guess that's out the window. Is there any option to view the html that Calibre stores prior to converting to an epub? Last edited by Killian; 07-31-2009 at 06:42 PM. |
07-31-2009, 06:47 PM | #7 |
Resident Curmudgeon
Posts: 75,764
Karma: 134321338
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Try converting the ePub to LRF and see what happens.
|
07-31-2009, 06:59 PM | #8 |
creator of calibre
Posts: 44,293
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You can see the html if you run the conversion from the command line as follows
Code:
ebook-convert myfile.rtf .epub -vv --debug-input html_dir |
08-01-2009, 10:33 AM | #9 |
Enthusiast
Posts: 43
Karma: 29000
Join Date: Jul 2009
Device: Kindle Paperwhite
|
Checked out the HTML using the above and it doesn't particularly make it any easier. All the tags are <p> and the class' are not unique in order to pull chapters from them.
Found out why it was giving me multiple one's though; I'd been putting the formula in the TOC menu as apposed to the Structure Detection menu. Took it out the TOC and overwrote the formala under the Structure Detection as //*[((name()='p') and re:test(., 'chapter', 'i'))]. It's worked perfectly for a few of my books though one of the books has the word 'chapter' amongst it's content and so that is also added as a bookmark. Is there anyway to filter out that particular entry? Tried using the TOC filter from the TOC menu but couldn't get my head around it. |
08-01-2009, 10:57 AM | #10 |
creator of calibre
Posts: 44,293
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Basically, you have to use the TOC filter
|
08-01-2009, 11:10 AM | #11 |
Enthusiast
Posts: 43
Karma: 29000
Join Date: Jul 2009
Device: Kindle Paperwhite
|
|
08-01-2009, 11:32 AM | #12 |
Enthusiast
Posts: 43
Karma: 29000
Join Date: Jul 2009
Device: Kindle Paperwhite
|
Doesn't start with hello after all. Starts "tut, tut. I've copied the contents re chapter detection from the Job Details. Any ideas how to filter it out?
Detecting structure... Detected chapter: Chapter 1 Detected chapter: Chapter 2 Detected chapter: Chapter 3 Detected chapter: Chapter 4 Detected chapter: Chapter 5 Detected chapter: Chapter 6 Detected chapter: “Tut, tut — hardly any of you remembered that my f Detected chapter: Chapter 7 Detected chapter: Chapter 8 Detected chapter: Chapter 9 Detected chapter: Chapter 10 Detected chapter: Chapter 11 Detected chapter: Chapter12 Detected chapter: Chapter 13 Detected chapter: Chapter 14 Detected chapter: Chapter 15 Detected chapter: Chapter 16 Detected chapter: Chapter 17 Detected chapter: Chapter 18 Auto generated TOC with 19 entries. Flattening CSS and remapping font sizes... Source base font size is 12.00000pt Cleaning up manifest... |
08-01-2009, 01:42 PM | #13 |
creator of calibre
Posts: 44,293
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Use .*Tut.*
|
08-01-2009, 01:58 PM | #14 |
Enthusiast
Posts: 43
Karma: 29000
Join Date: Jul 2009
Device: Kindle Paperwhite
|
Worked perfectly. Could I ask why there has to be the periods as there are no periods in the output from the job file? why is it not just *"tut*? Just for future reference?
|
08-01-2009, 02:03 PM | #15 |
creator of calibre
Posts: 44,293
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
that's the syntax of regular expressions.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Table of Contents | peterinnes | Sigil | 1 | 09-29-2010 03:03 AM |
Help with my Table of Contents | Skylinefranc | Calibre | 0 | 03-19-2010 12:55 AM |
Amazon and Sony on Calibre - Table of Contents | jsprung | Calibre | 2 | 01-19-2010 08:35 AM |
How to: table of contents | wizzofoz | Sigil | 1 | 10-08-2009 08:22 AM |
only the table of contents | wang960 | Sony Reader | 3 | 08-29-2008 12:45 PM |