03-03-2011, 07:51 AM | #1 |
Junior Member
Posts: 4
Karma: 10
Join Date: Mar 2011
Device: Kindle 3 Wi-Fi
|
Table Of Contents - Appearance
Hi, All.
I convert html books to mobi with calibre. It works pretty well. It do create appropriate table of contents with all the working links. I use h2 and h3 tags to create nested table of contents. Everything is Ok with conversion. The only thing I'd like to improve in resulting mobi files is the appearance of the created table of contents. To be more specific: if a toc entry is too long and occupy two lines it looks as justified alignment but not as left alignment which I prefer. Are there any way to do the left alignment for the toc entries? One more question, is it possible to insert a custom designed text to the Table of Contents page? |
03-03-2011, 10:56 AM | #2 |
creator of calibre
Posts: 43,773
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You can use the toc title option to change the text of "Table of Contents" but other than that no customization is possible without editing the source code.
|
Advert | |
|
03-04-2011, 03:27 AM | #3 |
Junior Member
Posts: 4
Karma: 10
Join Date: Mar 2011
Device: Kindle 3 Wi-Fi
|
If it is possible by modifying the html source of the book what code should I add to the source?
I can imagine two ways: the first is modifying some css which affect the "Table of Contents" formatting or the second is to make my own formatted page with the list of contents links within the html source and to mark this part of the html code in someway which makes the calibre to use this html code instead of the auto-generated "Table of Contents". So the question is how to do this, or where can I find some instructions how to do this? |
03-04-2011, 03:34 AM | #4 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
I think Kovid was talking about Calibre's source code, not the HTML of the book.
|
03-04-2011, 04:37 AM | #5 |
Wizard
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
|
Im' not at all sure what Kovid means by 'source code', but when preparing books in ePub format I've started to use a numbered list for the chapter headings, and the CSS is
div#TOC { margin: 0; padding: 2em 0 2em 0; page-break-after: always; text-align: left; } /* Sets a top and bottom margin for TOC, and page break */ div#TOC p { text-indent: 3%; font-size: larger; padding-bottom: 0.2em;} div#TOC li { font-size: larger; padding-bottom: 0.2em; margin-left: 3%; } The HTML looks something like <div id="TOC"> <h2>Table of Contents</h2><hr /> <p><a href="#coverpage">Cover page</a></p> <p><a href="#titlepage">Title and Copyright page</a></p> <p><a href="#authorpreface">Preface by the Author</a></p> <p><a href="#intro">Introduction by the Editor</a></p> <p><a href="#preface">Preface to this edition</a></p> <ol> <li><a href="Ch01.html">Childhood</a></li> <li><a href="Ch02.html">The New Master and Mistress</a></li> <li><a href="Ch03.html">The Slaves' New Year's Day</a></li> <-- Deleted to save space --> <li><a href="Ch38.html">Renewed Invitations to Go South</a></li> <li><a href="Ch39.html">The Confession</a></li> </ol> <p><a href="Endmatter.html#afterword">Afterword</a></p> <p><a href="Endmatter.html#endnotes">End notes</a></p> <p><a href="Endmatter.html#colophon">Colophon</a></p> </div><!-- End of TOC div; page break is in the CSS --> Does this make sense? I really have no idea what it would look like when converted from ePub to mobi. Regards, Alex PS. Do you use the CoffeeCup HTML editor? Last edited by AlexBell; 03-04-2011 at 04:39 AM. Reason: To add PS |
Advert | |
|
03-04-2011, 05:37 AM | #6 |
Wizard
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
For Mobi conversion DMSmilie came up with a solution. Create an inline TOC in an epub source with whatever formatting you desire. Then you need to do some hand tweaking to the epub which will clue Calibre in to use your custom TOC in the mobi output.
Read more here: https://www.mobileread.com/forums/sho...d.php?t=123170 |
03-04-2011, 07:35 AM | #7 | |
Junior Member
Posts: 4
Karma: 10
Join Date: Mar 2011
Device: Kindle 3 Wi-Fi
|
Thanks for the responses. I'll check the possibility to format "Table of Contents" via epub.
Quote:
|
|
03-09-2011, 05:30 AM | #8 |
Junior Member
Posts: 4
Karma: 10
Join Date: Mar 2011
Device: Kindle 3 Wi-Fi
|
Thanks ldolse, once again. The idea from the topic you've mentioned does work well.
So to create my own "table of contents" I prepared at the end of my html source of the book my own page with links in the way I like. Then I converted it to epub with Calibre and tweaked epub with Calibre in the way described in that topic and at last converted the epub to mobi. As a result I've got the mobi with working "table of contents" formatted in the way I need. |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Table of Contents | taraboom11 | Sigil | 20 | 04-30-2011 11:18 AM |
Table of Contents | ucoa | Calibre | 1 | 01-07-2011 09:01 PM |
Table of Contents | peterinnes | Sigil | 1 | 09-29-2010 03:03 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 |