If you have a simple single line chapter title, all you need to do is format the line as a heading. In a word processor you would use one of the heading styles. If you're using html you would use h1, h2, h3, etc tags.
In this post I'm going to tell you how to have chapter titles that span multiple lines and chapter titles that are images. We're going to accomplish this by using the "title" attribute. To do this you'll need to be working with html. I don't know how to do this in the various word processors, and I'm not sure it's even possible. If anyone knows if it is possible please let me know.
If your chapter title is on separate lines, simply styling both lines as headings can cause problems. If your chapters are titled like this:
Chapter One
The Beginning
If you mark both lines as h1 they will both appear in the ToC as separate entries like in the image below.
If you decide to only use the h1 tag on the first line, then the second part "The Beginning" will not appear at all.
There are two ways to set this up so that it looks nice in the book and appears as you want in your ToC. One method is to use the h1 tag on the first line, and the p tag on the second line. Then use styling to make them look the same. The other method is to use the br tag. This will create a line break but will not start a new paragraph. The h1 tag wraps around both lines.
<h1 class="chaptertitle">Chapter One</h1>
<p class="chaptertitle">The Beginning</p>
or
<h1 class="chaptertitle">Chapter One<br />
The Beginning</h1>
Now you want your chapter titles to appear correctly in your ToC. If you add the "title" attribute within the h1 tag, it will be used instead of any text between the tags. Here's how it would look:
<h1 title="Chapter One - The Beginning" class="chaptertitle">Chapter One<br />
The Beginning</h1>
This will appear in the ToC as "Chapter One - The Beginning" like in the image below:
Now, what if you want to use an image as your chapter title? That brings a slightly different problem. You can use the h1 tag around the image to try to make it appear in the ToC. The problem is, since there's no text, the entry will appear blank. You can see that here:
But, if you use the "title" attribute, like in the two line chapter title, you can fix this. So, your code would look like this:
<h1 title="Chapter One" class="chaptertitle"><img src=".../Image/chap1.jpg" /></h1>
Now, Chapter One will appear in your ToC like this:
This can also be used if, for some reason, you want the text that appears on the page of your book to be different than the text that appears in the ToC.
(note: I used the h1 tag through my explanation, but this will work for all levels of headings: h1, h2, h3, h4, and h5)