View Single Post
Old 05-15-2010, 12:32 AM   #12
Amalthia
Wizard
Amalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beauty
 
Amalthia's Avatar
 
Posts: 1,158
Karma: 32196
Join Date: Jan 2007
Location: Anchorage, AK
Device: Sony Reader PRS-505, PRS-650, PRS-T3, Pocketbook HD2
Quote:
Originally Posted by jackie_w View Post

Can be simplified to something like:

Code:
Device Table of Contents Only

If you plan on only having a Device Table of Contents, then you only need to find your chapters and apply the MSWord built-in style "Heading 2" to each of them.

When your document is converted to HTML, your chapter headings will automatically be correctly wrapped in <h2>...</h2> tags which Calibre can then add to your device's table of contents.
Okay I've edited the page to add some clarification.

Here is the new text.
Code:
If you plan on only having a Device Table of Contents There are two ways to do this. One is to apply Heading 2 style to all your chapters and let the program automatically create the <h2> tags for your chapters. 

If you are using a program that does not work well with applying styles to your chapter headers you can use a unique marker before and after your chapter: something like ##Chapter 1## 

When your document is converted to HTML you can use the Find and Replace Function to search for ##Chapter and replace it with <h2>Chapter and then search for ## and replace that with </h2> The end result will give you the code <h2>Chapter 1</h2> which Calibre can then add to your device's table of contents. 

The unique marker can be anything that's not normally in the body of the document. 

Creating a macro to accomplish the Search and Replace isn't a bad idea if you plan on formatting many documents that share the same format. 

Keep in mind <h2> is what I used as an example for this tutorial. You can use <h1> or <h3> for your chapter headers if you prefer. You also do not need to use the word chapter. Any text within the <h2> tags will be added to your Table of Contents.
Amalthia is offline   Reply With Quote