Can Everton Jones find out how his father stole Emperor Bokassa’s diamonds and, more importantly, where he hid them; before the world and his brother get there first?
Click on the picture link in the sidebar to read an extract of my first novel, which was published by Paradise Press in August 2012.

Thursday, 14 August 2014

How to use Mark Up to link notes in your e-book

This post covers how to link the notes in your e-book using markup.

I am assuming here that your book is in an MS Word file and contains notes of some kind. See my post on how to present notes in a print book for important information about how these should be formatted. If you have no notes, then this post is not relevant.

In an e-book, because there are no pages as such, the concept of a footnote is meaningless. So the first thing you will have to do is to convert all the footnotes into endnotes.

Once you have done that you are going to have to identify the note cues in the text using markup. I am assuming here that your note cues are superscript numbers. These need to be converted into hyperlinks to the notes. I should add that styling a superscript number using CSS might not work on the kindle, so I am using an html tag instead.

If you are using a different referencing system, such as Author-Date or the Vancouver system, you will need to hyperlink directly to the bibliography. See my forthcoming post on how to link to the bibliography to find out how to use markup to do this.

So, going back to endnotes cued by superscript numbers, you might have this in chapter one in the MS Word file:

‘… arguably, at least according to Mr Stevens23, the woman was insane at the time of the incident …’

which will need to be coded like this in the final ebook chapter (I will explain each part of the code fully below):



arguably, at least according to Mr Stevens<a href="Endnotes.xhtml#1n23"><sup>23</sup></a>, the woman was insane at the time of the incident

and in the endnote text a label will need adding:

<p id="1n23" class="endnote"><sup>23</sup> Text of the endnote.</p>

So markup the MS Word file as follows:

‘… arguably, at least according to Mr Stevens/n/1n23/nn/23/nnn/, the woman was insane at the time of the incident …’

IMPORTANT: the 1n23’needs to be included with the markup. It will be used to generate the link to the endnote. It seems to me to be fairly pain-free to use a convention of starting with the chapter number (one, in this case), some other character – I have used ‘n’ to stand for ‘note’, although any other character will do just as well, provided it is unique – and then repeat the endnote number. This will create a unique label which you will need to edit into the endnote (see below). IF you have numbered your endnotes consecutively from the beginning to the end of your book, then you could get away with dropping the chapter number part of the label, leaving just: ‘n23’.

When this is imported into the ebook as unformatted text it will look like this:

‘… arguably, at least according to Mr Stevens/n/1n23/nn/23/nnn/, the woman was insane at the time of the incident …’

Note that the formatting for the superscript note cue has been lost, and it is now just plain text.

Then use find and replace in Sigil to replace all instances of /n/ with <a href="Endnotes.xhtml# to get this:

‘… arguably, at least according to Mr Stevens<a href="Endnotes.xhtml#1n23/nn/23/nnn/, the woman was insane at the time of the incident …’

IMPORTANT: ‘Endnotes.xhtml’ is the filename of the chapter (html file) containing the endnotes. Obviously replace this with whatever YOUR filename is. As both endnotes.xhtml and chapter1.xhtml are in the same folder (the ‘Text’ folder), there is no need to include a path in the href.

And then replace all instances of /nn/ with "><sup> to get this:

‘… arguably, at least according to Mr Stevens<a href="Endnotes.xhtml#1n23"><sup>23/nnn/, the woman was insane at the time of the incident …’

And finally replace all instances of /nnn/ with </sup></a> to get this:

‘… arguably, at least according to Mr Stevens<a href="Endnotes.xhtml#1n23"><sup>23</sup></a>, the woman was insane at the time of the incident …’

IF your endnotes are at the end of the chapter in which they occur, then you can omit the Endnotes.xhtml part from the href (BUT NOT the ‘#’) and still include the 1 and the n in the label, to ensure the labels in each chapter remain unique.

IF you want the superscript numbers a bit smaller, then use a CSS style like this in the CSS stylesheet:

sup {font-size: 0.9em;}

BUT proofread your e-book carefully, particularly if it is a Kindle, as I strongly suspect the Kindle rounds up to the nearest 0.1em and you might need to adjust some of the styles accordingly. If your endnotes section is already 0.9em and then within that a style adds 0.9em to the superscript numbers, round-off error might occur. You can edit your file at a late stage of preparation by unpacking the finished epub file you are using as the source for your Kindle and then editing the CSS stylesheet manually using an html editor such as Komodo edit. I will explain this in more detail when I finally reach the end of this series of posts!

The endnote text also needs marking up. BUT it is in a special section in your MS Word file, so you will need to mark up the text to identify italic, bold and other formatting and then save it as an unformatted text file as outlined in my post on how to import your book into Sigil. If you have a separate endnotes section in your print book you will almost certainly have already converted the notes to normal text.

So, in the MS Word file, after you have marked up the bold, italic and other formatting, add more markup to the endnotes section as follows:

/en/1n23/een/23/eeen/ Text of the endnote.

When it is imported into your e-book it will look like this:

<p>/en/1n23/een/23/eeen/ Text of the endnote.</p>

So now use Find and Replace in Sigil to replace all instances of <p>/en/ with <p id=" to get:

<p id="1n23/een/23/eeen/ Text of the endnote.</p>

and then replace all instances of /een/ with " class="endnote"><sup> to get:

<p id="1n23" class="endnote"><sup>23/eeen/ Text of the endnote.</p>

and finally replace all instances of /eeen/ with </sup> to get:

<p id="1n23" class="endnote"><sup>23</sup> Text of the endnote.</p>

Obviously you will need a suitable style in your stylesheet for the endnote text. Maybe something like:

.endnote {font-size: 0.9em; text-align: left; margin-left: 2em; text-indent: -2em;}

which creates a hanging indent of 2em and a slightly smaller font size, left-aligned. (I finally found a use for a hanging indent!!!)

IMPORTANT: the label: 1n23 needs to match the label used in the chapter to build the link.

ALSO, if you are following Chicago style and want to have the note numbers in the endnotes section full-size, on the line and followed by a full point, you would need to use the following substitutions instead of the ones above:

replace /een/ with " class="endnote">
and replace /eeen/ with .

Unfortunately this isn’t the end of the story. I have said elsewhere that you might want to provide a ‘return’ link at the end of the citation. This is where it can get complicated. Click here to skip this part if like me you will NOT be putting in ‘return’ links.

If you are going to have a return link, it needs to be to a label in the chapter. So in your MS Word file you need to use different markup for this like:

‘… arguably, at least according to Mr Stevens/n/1n23/nn/1n23/nnn/23/nnnn/, the woman was insane at the time of the incident …’

and then when it has been imported into your e-book as unformatted text,

replace /n/ with <a id="c
and replace /nn/ with " href="Endnotes.xhtml#e
and replace /nnn/with "><sup>
and replace /nnnn/ with </sup></a>

it should then look like this:

‘… arguably, at least according to Mr Stevens<a id="c1n23" href="Endnotes.xhtml#e1n23"><sup>23</sup></a>, the woman was insane at the time of the incident …’

But when you come to markup the endnote text, it is even worse! This time you will need to mark up  your MS Word file  like this:

/en/1n23/een/23/eeen/ Text of the endnote. /r/Chapter1/rr/1n23/rrr/

which will look like this when it is imported into your e-book as unformatted text:

<p>/en/1n23/een/23/eeen/ Text of the endnote. /r/Chapter1/rr/1_23/rrr/</p>

So, as before,

replace <p>/en/ with <p class="endnote" id="e
and replace /een/ with "><sup>
and replace /eeen/ with </sup>

and then

replace /r/ with <a href="
and replace /rr/ with .xhtml#c
and then replace /rrr/ with ">return</a>

to get:

<p class="endnote" id="e1n23"><sup>23</sup> Text of the endnote. <a href="Chapter1.xhtml#c1n23">return</a></p>

IMPORTANT: you will note that ‘Chapter1’ has been added to the markup. This is to specify the chapter for the return link to jump into. It looks like a lot of trouble, and it is. But once the markup is entered there are only a few find and replace operations to carry out. The alternative, which is to edit in the hyperlinks manually would be a much larger task and much more likely to generate mistakes. I STRONGLY recommend using ‘Chapter1.xhtml’, ‘Chapter2.xhtml’, ‘Chapter3.xhtml’ etc … for your filenames, as it makes creating the html index and these links a whole lot easier and less likely to contain errors.

You will notice that I have used the markup to add a prefix of ‘c’ or ‘e’ to the labels and hrefs. ‘c’ stands for the label in the chapter and ‘e’ stands for the label in the endnotes. These have been added to make the labels unique. Obviously you could use any other suitable alternative.

As before, you will be able to omit the chapter filename parts of the markup if the endnotes are at the end of the chapter.

The example uses the word ‘return’ for the return link. You could use any other text you wanted, or even a suitable symbol (but make sure it is supported on the Kindle!). I might even suggest making any return link use a symbol which matches that on the physical return button on a Kindle BUT the damn Kindle doesn’t support one! An alternative would be to use a small graphic file. However the return button on the e-reader is a quicker way to go back than using a link, so perhaps a back link is best dispensed with altogether and hope your reader knows how to use their e-reader properly!!!!!

I am going to suggest using even more markup to create links from the endnotes to the bibliography, but I cover that in another post. That post will also explain how to use markup to link notes in the main text to the bibliography if you are using the Author-Date or Vancouver stsyems.

Index to ‘how to …’ posts:

How to ‘unpack’ an epub file to edit the contents and see what’s inside.
How to understand what is inside an epub
How to link the html table of Contents in a Kindle e-book
How to restructure the html table of contents for a Kindle
How to delete the html cover for a Kindle ebook
How to link the cover IMAGE in a Kindle e-book
How to clean up your MS Word file before your get started
How to markup an MS Word file to identify the formats before importing it into an epub
How to create a new blank e-pub using Sigil
How to import your marked-up MS Word file into your ebook using Sigil
How to create and link a CSS stylesheet in an e-book using Sigil
How to replace the markup with CSS styles in your ebook using Sigil
How to style an e-book so it works with the limited CSS styling available to Kindle e-readers
How to understand the syntax of CSS
How to style Small Caps in an e-book
How to split your ebook up into chapters using Sigil
How to sequence your e-book
How to phrase the copyright declarations etc. in an e-book
How to generate the logical table of contents using Sigil
How to understand toc.ncx in an e-book
How to generate the html table of contents in an e-pub
How to style the html table of contents using CSS
How to create an html cover for your epub using Sigil
How to present references and notes in a book
How to use Mark Up to link notes in your e-book
How to present a bibliography in a book
How to use markup to link entries in a bibliography with the notes section
How to index an e-book
How to use the tools in MS Word to create an index
How to alphabetise an index or bibliography
How to adapt the print index in your MS Word file for an e-book using markup
How to adapt cross-references in your print index for e-book and how to use markup to make the links
How to understand content.opf
How to understand and edit the Metadata of an ebook using Sigil
How to understand the manifest in content.opf
How to understand the spine and guide in content.opf
How to test your e-pub using flightCrew in Sigil
How to test your e-pub using epubcheck
How to convert an e-pub to Kindle using kindlegen

TinyURL for this post: http://tinyurl.com/ow8swyd

No comments:

Post a Comment

 
Twitter Bird Gadget