How to Create a Linked Table of Contents (TOC) in an eBook
I spent the last week or so messing with the various free software programs that format your eBook from a Word Document into an ePub. I figured most of it out, but I had the worst time trying to create a Table of Contents. I failed royally. I was sick of it. I was at the point of throwing things.
But luckily, I figured out an answer and my laptop is still in one piece. I'm writing this post to share my revelation with you and prevent this:
[image error]
Community Logos
"Therapy"
The Feature A linked table of contents allow readers to easily skip ahead to a chapter later on in the book without thumbing through the pages until they find it. The ePub file type is pretty nifty, but it does not have page numbers, since the entire appeal of an ePub is that it can automatically adjust the page numbers, formatting, and font to whatever reader you're using.
A lot of writers choose to forego a linked TOC because of the sheer hell and headaches you'll read about below. Me? I'm too damn stubborn not to figure it out, which just makes me even more frustrated when doing this eats up valuable writing time. I'm sure frightful noises came out of my writing room while I was working this out, which explains why my roommates' cats won't go in there anymore.
Oops.
The Problem I tried converting my base files using Calibre, Mobipocket, Sigil, and more programs I don't even remember. There's even an entire Wikipedia entry for all of the various programs that exist today. And you know what? It's probably not really an exhaustive list.
There are tons of programs out there, various reviews that insist they have found "the one" conversion tool, and there are even programs you can buy that are supposed to be better than the freewares.
[image error]
Zounz.comThey're not really better.
And you know what? Not a single one of them created a TOC for me. Not. A. Single. One.
I read the manuals, which were written in techie speak that most authors just aren't going to get. I read the forums where people like me (read: with no f*cking clue) posted questions and were answered in more techie speak that we didn't understand from the manual. What gives?
I'm going with the "the system is rigged" cop-out, because it makes stubborn authors like me feel stupid when it doesn't work. If you want to succeed in getting auto-generated TOC's working, get used to reading forums like this and this.
By the way, my favorite quote from that last forum comes after a user says they can't understand the TOC filter, which I didn't get either, and then the program creator replies with only, "Basically, you have to use the TOC filter J"
...as if that evil little smiley is going to make me less inclined to hulk out.
[image error]
Pocket Gamer
It isn't.
The Solutions You have a few choices.1. See the above entry for "the problem." Read forums and scream.2. Hire someone at roughly $200 - $600 per book. Scream.3. Do not put a linked TOC in your book. Sigh, then scream.OR!4. Read these steps below, do it manually, and feel as geeky as you will accomplished.
Here are the bare bones basics that you need to know to make this work. If you don't want to mess with it, you can hire me to do it. I don't charge much, but I also don't have much free time in which to take cases. However, I want to you please read through this. I think you'll find it's easier than you thought. Take a deep breath, walk around for a minute, grab a soda, and come back. You can do this.
[image error]
photosot.comPatience is...something. This was an encouraging poster, once.
How ePub Conversion Works ePubs are boss.
Before you can create the linked TOC, you need to know how to actually format your eBook. It's super easy, truthfully, and involves only one download. The easiest way to convert them is a program called Calibre, which also acts as an eLibrary management tool for Non-DRM books. It's pretty awesome. It's TOC creator sucks, in my opinion, but that's because I don't get it. Everything else with Calibre, though, is fantastic and fairly straightforward.
How to Convert an ePub w/ Linked Table of Contents (TOC) If you want to see what the final product should look like, go here to my test "book" and make your browser window really small, so that all you can see is the table of contents. When you click on one of the links, you'll be taken to the Chapter Header. That's what's supposed to happen in your TOC.
Here are the steps:
Get Your Book Ready 1. Write a good book in MS Word (or Open Office). This part is kind of important.2. Format it as desired and always, ALWAYS make a backup of your work. I'm not responsible if you lose your file because you didn't back it up.3. Go to Save As to create a second Word file for your eBook and name it accordingly. You'll need slightly different formatting for this than, say, your print copy. Create indents that are about 2-4 centimeters, since the limited space with an eReader will make anything else look ridiculous. 4. Single-space or 1.5-space your entire book. It doesn't matter if you include the space between paragraphs, because when you format it later, one will be added anyway.5. In 9 of 10 cases, your font doesn't matter. The eReader usually auto-formats it according to the reader's preferences and whatever font looks better on the eReader.6. Create your Front Matter, which is basically the title page, dedication, and all that other fun stuff. Make this single spaced.7. Enter a page break before every chapter and every page of the front matter. This makes for a cleaner look on the finished project. Note: enter a page break by going to Insert> Page Break in MS Word.8. Create a TOC page in your Front Matter. Include the Chapter Names, Prologue, Epilogue…whatever you want to have linked later. Make sure this is single spaced and that the text is aligned to the left. It will look funky if you don't do a left-align.9. Once everything is perfect in Word, save the file as a filtered HTML document.
Download Calibre1. Download Calibre here (http://calibre-ebook.com/download)or Google it and find the download that way. You won't hurt my feelings, whichever one you choose.2. Set it up on your computer. Tinker with it to get used to it if you want, but I'm going to walk you through the big parts in a bit.
How to Manually Set up the Linked TOC in the HTML Code Note: Skip this if you don't want to enter a Linked TOC and just want help formatting a ePub file using Calibre.
For our example, I wrote an epic mini book. In this mini book's TOC, we're going to link the phrase "Chapter 1" to the same phrase later in theeBook. To do this, you have to mess with the HTML code. Never fear, I added so much detail that you can get this even without understanding anything else about HTML.
It's not as scary as it sounds. Really-really. The method that I use to create the linked TOC involves linking one word or phrase to another word or phrase later on in the document. I do this with two, short changes to the code for each TOC entry (i.e. each Chapter). I'll show you with detail and screenshots in a minute.
1. Browse to your HTML file and right click on it. Choose "Open With" and open with Notepad. If Notepad isn't an option, browse to it. Note : It's usually in C:\Windows\system32. You can also go to Accessories in the Start Menu and right click on notepad there to find the executable file's location.
It won't look pretty if you're not used to HTML. Don't worry. You got this. You are boss.
Note: Use CNTL+F whenever you want to open the "Find" dialogue. This lets you search for keywords in the code and it is going to be your best friend while you're making the TOC.
2. After you open the HTML file in Notepad, find the first chapter (or the prologue, or whatever) on your table of contents page that you create while still in WORD. Do this by searching (using CNTL+F) in the HTML for a keyword in the Chapter title or by searching for the word "Chapter," provided you don't mention that anywhere else in the front matter. Note: the CNTL+F feature only works going down the document – it doesn't ever start again at the top. Just keep that in mind as you're working.
We're going to practice with just Chapter 1. Here is what my TOC looks like in Word: [image error]
And here is what it looks like in HTML opened with Notepad: [image error]
So we're going to start by linking the first Chapter TOC entry with the ACTUAL Chapter 1 that exists later in the document. We're going to make just a few modifications to the HTML. Again, make a backup copy before you start, please.
3. In the TOC page of the HTML – the one where you entered your own chapters and titles in Word – you're going to delete the auto-generated formatting and replace it with this: <p><a href='#ch1'> (in front of the chapter name) and </a></p> (behind the chapter name).
Here's a before shot of the code: [image error]
And the After: [image error]
There are a few important notes to make about this code that we just added.The words and letters we're putting in brackets are called "tags" in HTML. I'm using that term henceforth.
Every tag you open needs to be closed. So, if you see <a>, you also need to make sure there's also a </a> to close it.
HTML is case sensitive. So ch1 does not mean the same thing as CH1.
Every word, space, and symbol is important in HTML. Go slow and be really careful. That said, there is one exception. The spaces in between each line are cosmetic, but you should always keep an empty space between each line of code to make it easier to read.
Now, we need to talk about what the actual code means. · An <a> tag links a word to something else. If you want to read more, w3schools.com is an amazing resource.
· We use the href= to tell the <a> tag what to link to. In this case, we're linking to a keyword later on.
· To tell the <a> tag what keyword to link to later, we added '#ch1'. This is a keyword that we have to define in the code later, which I will show you in just a second.
So there you have it. <a href='#ch1'>Chapter 1: Chapter Name</a> will link to whatever words you later define as Chapter 1.
4. Now that you added the new code to the TOC, all you have to do is define the keyword later on in the text, so that the link jumps to the code later on. I'll show you a great way to test this, too.5. Use CNTL+F to find the second case of Chapter 1, where it actually appears with your chapter text later on in your book. This is what it might look like with all your formatting:
[image error]
6. Add this code to it: <h2><a name="ch1"> (beginning) and </a></h2> (end) but keep all your old formatting. It will look like this:
[image error]
Now, we need to talk about what the actual code means. · The <h2> tag is just a header 2 tag, the same thing that's applied to the HTML when you choose "Header 2" for some text in Word. It makes it larger and better defines the formatting, making it easier for an eReader to read.
· We already know that an <a> tag links a word to something else. Here, we're defining the link we created later, so the <a> tag takes us back to that link.
· name= tells the link we created earlier where to search for the keyword we entered in the TOC.
· "ch1" actually creates the keyword that we entered in the TOC. This is what the link in the TOC is looking for. Note: Remember, HTML is case-sensitive. Make sure this matches your previous keyword exactly or the TOC will just link you to the top of the document.
So there you have it. <h2><a name="ch1">Chapter 1</a></h2> will pull the link from the TOC to your actual chapter. Yay!
7. I would recommend taking this opportunity to open the altered HTML file in your internet browser (browse to the file, right click, and choose "open with firefox, chrome, or internet explorer" whichever one you have). This will bring you to a webpage of sorts, allowing you to test the links to make sure they work. You'll see the clickable TOC. Click on your active link and it should take you to your chapter! If it doesn't, go back up through these steps and make sure that you entered the code correctly, didn't delete anything you weren't supposed to, and that you use the exact same keywords in both the TOC entry for Chapter 1 and later on in the real Chapter 1. Remember that HTML code is case sensitive, so you need to make sure that the tags match exactly.
If you want to see what it should look like, go here to my test book and make your browser window really small, so that all you can see is the table of contents. When you click on one of the links, you'll be taken to the Chapter Header. That's what's supposed to happen in your TOC.
8. Once you get this fully working in your browser, it's time to repeat steps 1-7 with all chapters in your book. Note: When you create the tags for Chapter 2 and beyond, you'll need to make sure to change the tags. So, for Chapter 2, the tag will be "ch2" instead of "ch1" and so on for Chapter 3 ("ch3"), Chapter 4 ("ch4") and so on until your whole TOC is working perfectly in the browser test.
Import the HTML File into Calibre and Convert the HTML file to ePub 1. Open Calibre. Import your HTML file (loads as a ZIP file).2. Click "Edit Metadata." 3. Add your cover, author name, the works. Close when done (it saves automatically).4. Highlight the book in the Calibre grid (main view) & choose "Convert"5. Go to the Look and Feel tab. Enable "Insert blank line between paragraphs."
6. Go to the Structure Design tab. Delete everything that's pre-entered. You can leave the "remove fake margins" feature.7. Go to the Table of Contents tab. Disable the "force use of auto-generated TOC." Enable "Do not add detected chapters to the TOC." Leave everything else as is.8. Click OK to begin conversion. Take anywhere from a few seconds to a few minutes, depending on the size of your file.9. Upload to your eReader. Rejoice!
So, as I said in the title, this told you how to convert to an ePub. Using Calibre, you can easily convert to almost any other file format as well, including the MOBI file that Amazon requires for their Kindles. Just repeat steps 1-9, converting the ZIP file you uploaded to a MOBI isntead of an ePub
If this was too much for you or you just don't want to mess with it, I can create a linked TOC for a really reasonable price. Click here if you want to know more.
If you have any questions, go ahead and leave a reply or email me
But luckily, I figured out an answer and my laptop is still in one piece. I'm writing this post to share my revelation with you and prevent this:
[image error]
Community Logos
"Therapy"
The Feature A linked table of contents allow readers to easily skip ahead to a chapter later on in the book without thumbing through the pages until they find it. The ePub file type is pretty nifty, but it does not have page numbers, since the entire appeal of an ePub is that it can automatically adjust the page numbers, formatting, and font to whatever reader you're using.
A lot of writers choose to forego a linked TOC because of the sheer hell and headaches you'll read about below. Me? I'm too damn stubborn not to figure it out, which just makes me even more frustrated when doing this eats up valuable writing time. I'm sure frightful noises came out of my writing room while I was working this out, which explains why my roommates' cats won't go in there anymore.
Oops.
The Problem I tried converting my base files using Calibre, Mobipocket, Sigil, and more programs I don't even remember. There's even an entire Wikipedia entry for all of the various programs that exist today. And you know what? It's probably not really an exhaustive list.
There are tons of programs out there, various reviews that insist they have found "the one" conversion tool, and there are even programs you can buy that are supposed to be better than the freewares.
[image error]
Zounz.comThey're not really better.
And you know what? Not a single one of them created a TOC for me. Not. A. Single. One.
I read the manuals, which were written in techie speak that most authors just aren't going to get. I read the forums where people like me (read: with no f*cking clue) posted questions and were answered in more techie speak that we didn't understand from the manual. What gives?
I'm going with the "the system is rigged" cop-out, because it makes stubborn authors like me feel stupid when it doesn't work. If you want to succeed in getting auto-generated TOC's working, get used to reading forums like this and this.
By the way, my favorite quote from that last forum comes after a user says they can't understand the TOC filter, which I didn't get either, and then the program creator replies with only, "Basically, you have to use the TOC filter J"
...as if that evil little smiley is going to make me less inclined to hulk out.
[image error]
Pocket Gamer
It isn't.
The Solutions You have a few choices.1. See the above entry for "the problem." Read forums and scream.2. Hire someone at roughly $200 - $600 per book. Scream.3. Do not put a linked TOC in your book. Sigh, then scream.OR!4. Read these steps below, do it manually, and feel as geeky as you will accomplished.
Here are the bare bones basics that you need to know to make this work. If you don't want to mess with it, you can hire me to do it. I don't charge much, but I also don't have much free time in which to take cases. However, I want to you please read through this. I think you'll find it's easier than you thought. Take a deep breath, walk around for a minute, grab a soda, and come back. You can do this.
[image error]
photosot.comPatience is...something. This was an encouraging poster, once.
How ePub Conversion Works ePubs are boss.
Before you can create the linked TOC, you need to know how to actually format your eBook. It's super easy, truthfully, and involves only one download. The easiest way to convert them is a program called Calibre, which also acts as an eLibrary management tool for Non-DRM books. It's pretty awesome. It's TOC creator sucks, in my opinion, but that's because I don't get it. Everything else with Calibre, though, is fantastic and fairly straightforward.
How to Convert an ePub w/ Linked Table of Contents (TOC) If you want to see what the final product should look like, go here to my test "book" and make your browser window really small, so that all you can see is the table of contents. When you click on one of the links, you'll be taken to the Chapter Header. That's what's supposed to happen in your TOC.
Here are the steps:
Get Your Book Ready 1. Write a good book in MS Word (or Open Office). This part is kind of important.2. Format it as desired and always, ALWAYS make a backup of your work. I'm not responsible if you lose your file because you didn't back it up.3. Go to Save As to create a second Word file for your eBook and name it accordingly. You'll need slightly different formatting for this than, say, your print copy. Create indents that are about 2-4 centimeters, since the limited space with an eReader will make anything else look ridiculous. 4. Single-space or 1.5-space your entire book. It doesn't matter if you include the space between paragraphs, because when you format it later, one will be added anyway.5. In 9 of 10 cases, your font doesn't matter. The eReader usually auto-formats it according to the reader's preferences and whatever font looks better on the eReader.6. Create your Front Matter, which is basically the title page, dedication, and all that other fun stuff. Make this single spaced.7. Enter a page break before every chapter and every page of the front matter. This makes for a cleaner look on the finished project. Note: enter a page break by going to Insert> Page Break in MS Word.8. Create a TOC page in your Front Matter. Include the Chapter Names, Prologue, Epilogue…whatever you want to have linked later. Make sure this is single spaced and that the text is aligned to the left. It will look funky if you don't do a left-align.9. Once everything is perfect in Word, save the file as a filtered HTML document.
Download Calibre1. Download Calibre here (http://calibre-ebook.com/download)or Google it and find the download that way. You won't hurt my feelings, whichever one you choose.2. Set it up on your computer. Tinker with it to get used to it if you want, but I'm going to walk you through the big parts in a bit.
How to Manually Set up the Linked TOC in the HTML Code Note: Skip this if you don't want to enter a Linked TOC and just want help formatting a ePub file using Calibre.
For our example, I wrote an epic mini book. In this mini book's TOC, we're going to link the phrase "Chapter 1" to the same phrase later in theeBook. To do this, you have to mess with the HTML code. Never fear, I added so much detail that you can get this even without understanding anything else about HTML.
It's not as scary as it sounds. Really-really. The method that I use to create the linked TOC involves linking one word or phrase to another word or phrase later on in the document. I do this with two, short changes to the code for each TOC entry (i.e. each Chapter). I'll show you with detail and screenshots in a minute.
1. Browse to your HTML file and right click on it. Choose "Open With" and open with Notepad. If Notepad isn't an option, browse to it. Note : It's usually in C:\Windows\system32. You can also go to Accessories in the Start Menu and right click on notepad there to find the executable file's location.
It won't look pretty if you're not used to HTML. Don't worry. You got this. You are boss.
Note: Use CNTL+F whenever you want to open the "Find" dialogue. This lets you search for keywords in the code and it is going to be your best friend while you're making the TOC.
2. After you open the HTML file in Notepad, find the first chapter (or the prologue, or whatever) on your table of contents page that you create while still in WORD. Do this by searching (using CNTL+F) in the HTML for a keyword in the Chapter title or by searching for the word "Chapter," provided you don't mention that anywhere else in the front matter. Note: the CNTL+F feature only works going down the document – it doesn't ever start again at the top. Just keep that in mind as you're working.
We're going to practice with just Chapter 1. Here is what my TOC looks like in Word: [image error]
And here is what it looks like in HTML opened with Notepad: [image error]
So we're going to start by linking the first Chapter TOC entry with the ACTUAL Chapter 1 that exists later in the document. We're going to make just a few modifications to the HTML. Again, make a backup copy before you start, please.
3. In the TOC page of the HTML – the one where you entered your own chapters and titles in Word – you're going to delete the auto-generated formatting and replace it with this: <p><a href='#ch1'> (in front of the chapter name) and </a></p> (behind the chapter name).
Here's a before shot of the code: [image error]
And the After: [image error]
There are a few important notes to make about this code that we just added.The words and letters we're putting in brackets are called "tags" in HTML. I'm using that term henceforth.
Every tag you open needs to be closed. So, if you see <a>, you also need to make sure there's also a </a> to close it.
HTML is case sensitive. So ch1 does not mean the same thing as CH1.
Every word, space, and symbol is important in HTML. Go slow and be really careful. That said, there is one exception. The spaces in between each line are cosmetic, but you should always keep an empty space between each line of code to make it easier to read.
Now, we need to talk about what the actual code means. · An <a> tag links a word to something else. If you want to read more, w3schools.com is an amazing resource.
· We use the href= to tell the <a> tag what to link to. In this case, we're linking to a keyword later on.
· To tell the <a> tag what keyword to link to later, we added '#ch1'. This is a keyword that we have to define in the code later, which I will show you in just a second.
So there you have it. <a href='#ch1'>Chapter 1: Chapter Name</a> will link to whatever words you later define as Chapter 1.
4. Now that you added the new code to the TOC, all you have to do is define the keyword later on in the text, so that the link jumps to the code later on. I'll show you a great way to test this, too.5. Use CNTL+F to find the second case of Chapter 1, where it actually appears with your chapter text later on in your book. This is what it might look like with all your formatting:
[image error]
6. Add this code to it: <h2><a name="ch1"> (beginning) and </a></h2> (end) but keep all your old formatting. It will look like this:
[image error]
Now, we need to talk about what the actual code means. · The <h2> tag is just a header 2 tag, the same thing that's applied to the HTML when you choose "Header 2" for some text in Word. It makes it larger and better defines the formatting, making it easier for an eReader to read.
· We already know that an <a> tag links a word to something else. Here, we're defining the link we created later, so the <a> tag takes us back to that link.
· name= tells the link we created earlier where to search for the keyword we entered in the TOC.
· "ch1" actually creates the keyword that we entered in the TOC. This is what the link in the TOC is looking for. Note: Remember, HTML is case-sensitive. Make sure this matches your previous keyword exactly or the TOC will just link you to the top of the document.
So there you have it. <h2><a name="ch1">Chapter 1</a></h2> will pull the link from the TOC to your actual chapter. Yay!
7. I would recommend taking this opportunity to open the altered HTML file in your internet browser (browse to the file, right click, and choose "open with firefox, chrome, or internet explorer" whichever one you have). This will bring you to a webpage of sorts, allowing you to test the links to make sure they work. You'll see the clickable TOC. Click on your active link and it should take you to your chapter! If it doesn't, go back up through these steps and make sure that you entered the code correctly, didn't delete anything you weren't supposed to, and that you use the exact same keywords in both the TOC entry for Chapter 1 and later on in the real Chapter 1. Remember that HTML code is case sensitive, so you need to make sure that the tags match exactly.
If you want to see what it should look like, go here to my test book and make your browser window really small, so that all you can see is the table of contents. When you click on one of the links, you'll be taken to the Chapter Header. That's what's supposed to happen in your TOC.
8. Once you get this fully working in your browser, it's time to repeat steps 1-7 with all chapters in your book. Note: When you create the tags for Chapter 2 and beyond, you'll need to make sure to change the tags. So, for Chapter 2, the tag will be "ch2" instead of "ch1" and so on for Chapter 3 ("ch3"), Chapter 4 ("ch4") and so on until your whole TOC is working perfectly in the browser test.
Import the HTML File into Calibre and Convert the HTML file to ePub 1. Open Calibre. Import your HTML file (loads as a ZIP file).2. Click "Edit Metadata." 3. Add your cover, author name, the works. Close when done (it saves automatically).4. Highlight the book in the Calibre grid (main view) & choose "Convert"5. Go to the Look and Feel tab. Enable "Insert blank line between paragraphs."
6. Go to the Structure Design tab. Delete everything that's pre-entered. You can leave the "remove fake margins" feature.7. Go to the Table of Contents tab. Disable the "force use of auto-generated TOC." Enable "Do not add detected chapters to the TOC." Leave everything else as is.8. Click OK to begin conversion. Take anywhere from a few seconds to a few minutes, depending on the size of your file.9. Upload to your eReader. Rejoice!
So, as I said in the title, this told you how to convert to an ePub. Using Calibre, you can easily convert to almost any other file format as well, including the MOBI file that Amazon requires for their Kindles. Just repeat steps 1-9, converting the ZIP file you uploaded to a MOBI isntead of an ePub
If this was too much for you or you just don't want to mess with it, I can create a linked TOC for a really reasonable price. Click here if you want to know more.
If you have any questions, go ahead and leave a reply or email me
Published on September 04, 2011 03:53
No comments have been added yet.