Beyond optimum strategies, the nature of HTML and CSS, and the principles of composition, the watershed in an e-book project is the production process itself.
This chapter considers in detail the individual stages that that process comprises, and the flow chart that you see in the sidebar below depicts those stages, while the sections below expand on each, by breaking each stage down into discrete sub-steps.
Some general points:
1.
Steps and Stages. To avoid confusion, this chapter refers formally to each stage in the flow chart as a ‘stage’, whereas it refers equally formally to each sub-step within a given stage as a ‘step’.
2.
Validation. Chapter Two, Resources, points out the importance ofvalidation during production. Hence, a number of the stages upon which the sections below expand involve a validation step, where you pass your content through an automated tool, which will detect errors in your code.
You might see these steps as pedantic and overly fussy, but this is not true because it is easy to mis-code some piece of HTML and/or CSS, such that it is not valid – it is all too easy to introduce an error with a slip of a finger on a key. This may cause some aspect of the styling or layout to fail, and given that you will have to fix such problems at some point, you might as well do that as early as possible, as that is the fastest way to proceed overall.
3.
An Iterative Process. Do not attempt to do everything at once should this be the first time you have generated an e-book file, as you are bound to make mistakes that may prove discouraging. This chapter presents the production process in idealised form, which suggests that it is possible to navigate it successfully in a single pass, and while this is true, the overwhelming reality for us all is that production is an iterative process. That is, it requires frequent looping back to fix the problems that crop up, and to take opportunities to improve things.
In this light, do not expect to generate your deliverable in a single, flawless production run, because that simply will not happen. In fact, you will have a far easier experience if you take just a sample chapter initially, or even just a small portion of a chapter, and format that to generate the first version of your book file. Only after you have succeeded in that should you then attempt to format further chapters, but even then, it may be better to process those in an incremental fashion too, by adding each chapter one at a time.
The flow chart you see here gives the steps that comprise the Set Up stage, and the explanations for each step are as follows:
A.
Install Tools. Install a copy of Sigil, Calibre or whatever EPUB editor you intend to use, and then install any browser plug-ins such as an HTML validator. Following that, install Amazon's Kindle Previewer and Kindle for PCs, and then install the text editor you will be using.
B.
Create Directory Structure. Create a directory (or ‘folder’) structure on your machine that looks like the diagram below the flow chart (where we assume that the title of your book is ‘Lorem Ipsum’). This structure can be a child of any appropriate directory on your machine, and remember that you can skip the Fonts directory if you will not be using custom typefaces. However, if you will be using one or more custom typefaces, you should copy the relevant font files to that directory.
C.
Save Source Files without Smart Quotes. Word processors such as Microsoft's Word convert characters such as ordinary 'straight quotes' (the ones that your keyboard generates) to their ‘curly’ equivalents, and converts hyphens to n-dashes. This is to lend documents a more professional and elegant feel, however the encoding that Word uses for such characters is not part of UTF-8,which is the standard encoding that you should use in any web- or e-book-related HTML that you create.
Text editors vary in the way that they save HTML code that contains such characters. Some editors convert them to ASCII straight quotes, others keep them as they are. In the latter case, those characters will not appear when a user agent renders the final deliverable, and will appear instead as what is known as Unicode's replacement character (often a rendered as white question mark in a black diamond).
Appendix F, Unicode and All That, goes into some detailon this, but the essential production point here is that you should save your source chapter files without smart quotes (and any other so-called ‘smart’ characters). Suggested search terms for help on this are:
D.
Set Source Files to Read-Only. Once you pass the Set Up stage, you will not return to editing your word processor files, and you will make any further changes to the content (say, to fix grammatical or spelling errors) only by editing the HTML files. Moreover, you should preserve your original content in case you make a mistake when creating the HTML version, in which case you will need recourse to a master copy. Given this, you should mark all the word processor files as read-only, which will freeze them as they are, thus precluding inadvertent changes.
If you are unclear on how to make a file read-only, the suggested search terms are:
To which you should append the name of your operating system or computer brand, such as ‘Windows’ or ‘Apple’.
E.
Create Blank Page. Start the text editor that you have acquired and installed on your system, create a new file, and enter the code you see below, which replicates theexample given in the Page Anatomy section in Chapter Three, Structure.
<!DOCTYPE html> <html> <head> <meta charset = 'UTF-8'/> <title>Lorem Ipsum</title> </head> <body> </body> </html>
Do replicate the indentation, where you indent each child element by three spaces, but do not use tabs, just hit the space bar three times (or set your text editor, if possible, to insert three spaces for each stroke of the tab key). Using spaces rather than tabs is preferable because, if you pay attention laying out your code properly,you will find that tab characters tend to cause sudden jumps in alignment when you are deleting excess spaces. The same applies when you use <pre> elements to lay out textual sections, where you wish the spaces in the rendered content to match the corresponding spacing in the HTML.
Save this file in the Text directory you created for Step B above, under the name ‘BlankPage.htm’ (or similar). You will use a copy of this file as a template for each new chapter you convert to HTML format.
On completion of the previous stage, you should create the HTML files that will carry your content. The flow chart you see here gives the steps that comprise this stage.
A.
Copy Blank HTML File. For a given chapter in your book, make a copy of the BlankPage.htm file you created in Step D in the previous stage, and change its name to the name of the chapter.
A valuable tip here: it is very good practice to prepend a number to the beginning of the filename that corresponds to the chapter ordering. For example, if your first three chapters are called Lorem, Ipsum and Dolor respectively, then you should name the corresponding HTML files, ‘01_Lorem.htm’, ‘02_Ipsum.htm’ and ‘03_Dolor.htm’. Similarly, you should name any front matter such as the title page, the table of contents, and any introduction as ‘00a_Title_Page.htm’, ‘00b_ToC.htm’ and ‘00c_Introduction.htm’.
This ensures that the files take the correct order automatically when you view the contents of the directory that holds those files. Equally, they will also take the correct order in the EPUB automatically when you import them into Sigil. Moreover, the ordinal numbering will match the cardinal numbering. That is, the first chapter's prefix will be ‘01_’ the second's ‘02_’, and so on.
To develop this point: if any chapter contains one or more images, you should give each image the same prefix and name as the chapter to which it belongs. Thus, if ‘02_Ipsum.htm’ has two JPG images, you should name them ‘02_Ipsum_00.jpg’ and ‘02_Ipsum_01.jpg’. As with the chapter files, they will then appear in the correct order in the directory that contains them, and in the EPUB when imported into Sigil; and these two practices help greatly in avoiding confusion during the production process.
To develop this idea still further, you may have images that are shared among multiple chapters, in which case giving them a chapter numbering does not apply. One approach here is to prepend ‘00_’ to each image's filename.
Note here that there should be no spaces, slashes or colons in any filename. So, if the first source chapter file is called, for example, ‘Lorem Ipsum.docx’ the corresponding HTML file should be called ‘01_Lorem_Ipsum.htm’ or ‘01_LoremIpsum.htm’ (whichever takes your fancy, but do be consistent in applying the nomenclature you adopt). Note also that every HTML chapter-file should reside in the Text directory that you created in the previous stage.
B.
Open HTML File. Open the newly-created HTML file for the chapter in question in your text editor.
C.
Open Source Word Processor File. Open the corresponding word processor file for the chapter in question.
D.
Select, Copy and Paste Content. Select all content in the file within the word processor (there is no need to use the mouse, Ctrl-A will suffice). Copy the selection, and then paste the content into the <body> element within the corresponding HTML file in the text editor. That is, you should paste the content between the <body></body> tags, as shown in the code sample below.
<body> <!-- Your chapter content should go here and nowhere else. --> </body>
Note that if your content looks like this in your word processor:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
…it will paste into your text editor looking like this:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
…where each paragraph takes up just one line. Do not let this worry you, as it has a positive rather than deleterious effect on the production process, as the next section below explains.
Repeat the steps above for each chapter in your book.
Stage Three in the master process comprises eight sub-steps, which the flow chart you see here enumerates. Obviously, you may not take all of the steps shown because, for example, there are no subtitles in a given chapter. However, including a mass of conditional logic in the diagram would over-complicate it, so it is up to you to act accordingly.
Examining each step in turn:
A.
Place Chapter Title in <title> Element. A self-evident step: enter the title of the chapter into the <title> element. Unlike the filename restriction mentioned for the previous stage, spaces, slashes and colons are perfectly acceptable here.
B.
Delimit Titles and Subtitles. Place <h1></h1> tags around the chapter title, and <h2></h2> tags around any subtitles etc. See theHeadings section in Chapter Three, Structure.
C.
Delimit each Paragraph. Place <p></p> tags around each paragraph in the chapter, as shown in theBasic Structure section in Chapter Three. That is, and using the example from the previous stage above, if your pasted content looks like this:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
…it should look like this after you have emplaced the <p></p> tags:
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p> <p> Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p>
This is why the fact that your paragraphs paste-in as single, long lines of text is of benefit because all you need do is paste this fragment:
</p> <p>
…between each line, using no more than a keystroke to paste before you move the cursor down one line. Avoid using the mouse and all that tedious left- and right-clicking; on a Windows machine, you need press only Ctrl-v then the Down-Arrow-key, which is far faster (other operating systems will have similar keystroke conventions).
It follows that you need only repeat that keystroke combination until you reach the end of the file, and so remember here that Chapter Two, Resources,champions the use of an independent, professional, text editor because such tools give rich support for what are known as ‘macros’. That is, a decent editor will allow you to record a set of keystrokes, such as those spelt out above, such that a single key-press will execute those keystrokes in a single step. Once recorded, you need only position the cursor at the correct point in the file before hitting the replay key repeatedly until you reach the end of the file.
This too is wherecolumnar selection is so valuable. Once you have applied the <p></p> tags, you can use that feature to indent the contents of the body element by three spaces in a single action.
D.
Apply Italicisation etc. Refer back to theText Effects section in Chapter Three for this step. Remember that super-scripting includes changing ordinal numbers like ‘1st’ into ‘1st’, and ‘2nd’ into ‘2nd’, which is a simple matter if you use the search and replace functionality in your text editor. However, do remember that the cardinal value ‘eleven’ is written ordinally as ‘11th’ in English, and so you should remember to do a search/replace on the first three ‘teen’ ordinals too in a given chapter. That is, you must convert ‘11th’, ‘12th’ and ‘13th’ to their superscripted equivalents too.
E.
Convert Special Characters. Referring back to theCharacter References section in Chapter Three will help with this step. Remember to change any plain single-/double-quotes and apostrophes with their ‘printer's’ equivalents (‘curly quotes’). Similarly, where you have used hyphens as en dashes and em dashes (that is, ‘-’ instead of ‘–’ or ‘—’) then you should change them accordingly. You should also convert any exotic characters to their character-reference equivalents.
Note that executing this step satisfies in part RuleTwo, Produce Professionally.
F.
Insert <img> Elements. You can skip this step if your book does not use images internally. That is, if the only image in the book is the cover, you can go to Step G below, as you should not include the cover art using an <img> element (as pointed out below in Stage 4). However, if the content does employ one or more images you need to include those by inserting <img> tags, and so you may need to refer back to theImages section in Chapter Three for details on this.
Remember also thatKindleGen converts all standalonePNG images to their JPG equivalents, so it is better if you do that conversion yourself using a tool such asGIMP, such that you import only JPG images into your EPUB editor. This will give you control over the compression ratio you employ, which will give you control in turn over the size of those image files. It will also improve KindleGen's performance, in the case of image-heavy books, as it absolves that tool from performing the conversion itself, which can slow the compilation process considerably. See Appendix Bif you are unsure about image formats, and the significance of this point.
G.
Insert all Other Elements. If your book's content comprises more than text, headings and images, and contains elements such as sidebars, tables and the like, insert the HTML that implements these.
H.
Validate. Save the file and then drag-drop it on to your web browser. After giving it a cursory visual check, run the validation tool that you have installed, or validate it by using an online resource such as that provided by the World Wide Web Consortium (the ‘W3C’, the body that develops and maintains the HTML and CSS standards).
The search-terms suggestion for this is:
You can validate a tract of HTML in three ways using this resource. You can:
i.
Provide the address of the file on the Internet if it forms part of a published web site. This does not apply to e-book production.
ii.
Upload a given HTML file.
iii.
Choose ‘Validate by Direct Input’, then select all the text in a given HTML file within your text editor, copy and paste it into the large input field in the W3C page in your browser, and click ‘Check’.
Repeat the steps above for each chapter in your book.
In addition to your chapter files, you will need certain auxiliaries, such as a title page, a 'TP Verso', which, in print publishing, is the other side of the title page (hence the name) and which contains things such as the copyright assertion and the ISBN (if you decideto use one). You also have to think about acknowledgements, and any other pages that will make up the book, such as a dedication. In all such cases, you should make a copy of BlankPage.htm, re-name that copy appropriately and create the HTML within each according to the principles explored in Chapter Three. See the next stage for the details of creating a table of contents.
For the title page, you can centre the elements such as the title and author name(s) using the text-align : center approachdetailed in Chapter Four, Style. However, varying the zoom level on a given user agent can cause, say, the author names(s) to spill over to the next 'page'. This is a less than endearing attribute of re-flowable text, and a solution is to use an SVG image, which you pull into the content by means of an HTML file (called, say, 00a_TitlePage.htm, as suggested above).
The contents of this file should look like the following:
<!DOCTYPE html> <html> <head> <meta charset = 'UTF-8'/> <title>Title Page</title> <style type = 'text/css'> #TitleGraphic { width : 100%; } </style> </head> <body> <img src = "Images/00_TitleGraphic.svg" id = "TitleGraphic"/> </body> </html>
Assuming you give the graphic the correct proportions (see below), it will always fill the user's display properly, will be immune to zooming, and will never spill over to the next page. The only drawback to this technique is that it will not work on first and second generation Kindles because they do not support SVG. However, this need not be a concern if you choose to forget about those very early user agents.
You will also need to generate or acquire your cover art. You will need to include a copy of this in the final deliverable, but when you upload that, you also need to upload a standalone copy of the artwork to retailers/distributors, which they use for promotional purposes. Retailers and distributors now recommend very high-resolution versions of the promotional version, and recommend minimum and maximum dimensions too, which vary from retailer to retailer, and which change from time to time too.
This makes the issue of settling on a single resolution, size and aspect ratio a rather tricky question, and the graphic you see below gives a comparison of the dimensions that five of the major retailers recommend currently.
It is impracticable to give precise directions here (not least because they would probably become out of date rather quickly), and so you should consult a given retailer's specifications online when you create your cover art. Accordingly, the search-terms suggestion is:
Aside from that, the best strategy would seem to be to generate your cover art such that it conforms to the largest of the retailers' recommendations, as that will allow you to scale the image down if a given retailer is not happy with it (and which is considerably easier than scaling it up). Do remember also that the numbers involved are recommendations only, not hard and fast rules, and so some variance is unlikely to spell disaster.
A final point for this stage: do not include your book's cover image by means of a page containing just a single <img> element that points to the actual image file. As the previous section mentions, and as coverage of the next stage shows, you simply import the cover image, and then tell the EPUB editor that that is the cover.
Following conversion of your content to HTML, you need to insert links. Note that this stage is not a sub-step of Stage 3, Convert to HTML because, if your book has intra- and inter-chapter links, it is far better to emplace all linkage in one go, after all the HTML elements have been put in place.
For the majority of e-books, however, inserting the links means simply creating the Table of Contents. To proceed in this regard, make a copy of the BlankPage.htm file that you created in StageOne above, giving the file an appropriate name, as directed in the coverage of Stage Two above. Then insert anchor elements, asshown in Chapter Three, Structure. Note that you do not need to append anyID value to the file reference you give, simply quote the full name of the file including its ‘.htm’ extension.
Successful completion of this step should result in a piece of HTML that looks something like the following:
<!DOCTYPE html> <html> <head> <meta charset = 'UTF-8'/> <title>Table of Contents</title> </head> <body> <h1>Contents</h1> <a href = 'Lorem.htm'>Lorem</a><br/> <a href = 'Ipsum.htm'>Ipsum</a><br/> <a href = 'Dolor.htm'>Dolor</a> </body> </html>
Obviously, you may be producing a book that, like this one, contains intra-section and -chapter links. In this case you will need to go through each HTML chapter file, inserting <a></a> elements for each link in the appropriate places. You must also insert id attributes at the appropriate points in each chapter file to act as targets for the links you create. Refer back to theLinks section in Chapter Three if you are uncertain about the technicalities here.
As with the all-important validation phase in the Convert to HTML stage, you should also test the links once they are in place. As Chapter One, Strategy,points out, this is another good reason for using a web browser during the production process.
Stage Five is the point at which you add styling and layout commands to your book, assuming that you will not go exclusively with user agentdefaults. However, if you will not be imposing your own styling, you can skip this step entirely.
Examining each step in turn:
A.
Create Stylesheet.css. Create a new file in your text editor, and save it under the filename ‘Stylesheet.css’ or some other meaningful title to which you give a ‘.css‘ extension. The decision here is yours, as you can use any legal filename (‘legal’ meaning ‘acceptable to your computer’ rather than ‘law of the land’). Ensure that you situate this file in the Styles sub-directory described in the Set Up section above.
Note that, if you use one or more custom fonts in your book, you should implement the workaround for the ‘font-stripping’ bug that Chapter Four, Style,documents. That is, the only stylesheet that your HTML files should import should be an intermediary that contains one or more @import directives, which cause the user agent to pull-in the stylesheet file(s) that stipulate the stying and layout for your book. If you do use the workaround, references in the rest of this section to Stylesheet.css should be interpreted accordingly.
B.
Insert Link Elements. This step applies to the Table of Contents file as well as to the chapter and other files, and the code for the <head> element in each file should look like the following:
<head> <title>Lorem Ipsum</title> <link rel = 'stylesheet' href = '../Styles/StyleSheetImporter.css' type = 'text/css'/> </head>
C.
Create CSS Definitions. Create within Stylesheet.css the styling and layout rules that will control the appearance of your book, in accordance with the material in ChaptersFour andFive.
D.
Insert <style> Element. This conditional step applies only if your content requires styling and layout rules that are specific to individual chapters. It entails inserting a <style> element into the <head> element, as Chapter Fourdemonstrates, and the code should look like the following:
<style type = 'text/css'> /* Your CSS code goes here. */ </style>
E.
Create Page-Specific Definitions. If you do follow Step D, you should populate each <style> element you have inserted with the CSS definitions that will control specific points of styling and layout within the chapter in question.
F.
Validate. You should validate your CSS at this point, and fix any problems that become evident before continuing with Stage Six. As with validating your HTML, you can use an online service provided by the W3C, which operates in exactly the same way as their HTML validator. That is, you select all the code in your Stylesheet.css, copy it and then paste it into the form on the W3C site. Clicking ‘Validate’ will then yield a report that indicates any errors in the code. The search-terms suggestion for locating this service is:
Note that Steps C to E above are never unitary procedures, where you add a lump of CSS code and then move swiftly on. Those steps encompass an iterative process where you add, update and remove code as you zero in on the presentation you seek. It follows that these steps are the point at which using a webbrowser to develop the styling and layout expedites matters greatly. As you refine your content's styling, you need only make a change to the CSS in your text editor, save, and then reload the chapter in question into the browser by switching to that application and then hitting the F5 key to see the result.
Moreover, this is also the point at which you can avail yourself of your browser's debugging tool. Assuming that you are using Google's Chrome browser, press the F12 key, which should cause the debugger to open up within the browser's window. The display should look something like this:
Note that you can change the debugger's settings, and so it is a good idea to configure things such that they are as they appear in the screen shot above, where the actual content part of the display (the part on the left in the image above) is constrained to be relatively tall and thin. This gives the content an aspect ratio that approximates an actual e-reader's display. Note here that, while it is true that such devices allow you to read in landscape rather than portrait mode, it is harder to set-up such an aspect ratio in the browser because the debugger display then becomes too small in the vertical axis to be useful.
Moreover, portrait mode is more demanding when it comes to developing technical and reference books (such as this one) which may have broad tables, wide diagrams and long lines of code that must not wrap around. This means that you should always test in the most constrained setting; if the content works in that context then it should work in a context that is more relaxed.
Aspect ratios aside, one of the debugger's strengths is the ability it gives you to see in situ which CSS rules affect which elements. To use this feature, click the magnifying glass symbol, and then hover your mouse over any element in the chapter. If using Firebug, you will see in the Definitions View the set of rules that apply to the element in question; if using Chrome, you will have to click on the element first. Crucially, you can turn a given rule off and on again by clicking at the left-hand side of the rule with the mouse, and if you click within a rule you can edit it and see instantly what effect the change has on the content's styling and layout. You can even enter additional rules on an ad hoc basis.
Remember, however, that changing CSS rules in this way does not change the code in the stylesheet or HTML file in question. The idea is that you use the debugger to determine the optimum settings for a given aspect of the styling and layout, and then edit the code in your text editor subsequently to make the change permanent.
You are very close to seeing the finished product at this point, as around 99% of the entire project is behind you. That is, once you have converted your book's content into HTML format, you should combine the files that comprise your content and the cover art into an integrated whole – an EPUB file.
The instructions given here assume that you are using Sigil to achieve this, but the procedure is essentially the same if you are using Calibre, and you should proceed according to the flow chart given in the sidebar, and by referring to the annotated Sigil screen-shot you see below.
To explain each step:
A.
Optimise SVGs. If you are using SVG images, remember to convert them to their optimised forms, and to change the corresponding href attributes in the HTML file you have created to indicate the optimised image files. Do consult Appendix Efor the relevant details on this in respect of validating the EPUB you generate.
B.
Import HTML Files into Text Folder. On starting Sigil, you will see a set of folders displayed in the left hand part of the window. This represents the structure and content of the EPUB file that Sigil will write out every time you instruct it to save your work. Remember here that the folder structure you see does not represent any folder structure that exists on your machine (aspointed out in Chapter One, Strategy), and that you should not think of it in this way.
To proceed, right-click on the Text folder you see to the top left of the display, or select ‘File/Add/Existing Files’ on the menu. A file selection box will appear (which does reflect the directory structure on your machine), through which you should navigate to the directory where the HTML files for your chapters reside. Select those files that you wish to import, and click ‘OK’.
If you are using Sigil, you do not have to import the stylesheet file explicitly, nor the image files to which <img> elements point, as the tool will analyse the HTML files as it pulls them in, and will detect any such dependencies, causing it to import images and stylesheets automatically. Currently, however, it does not import image files to which any CSS definitions refer (which is a defect in Sigil), so see Step D if you are using images as element backgrounds. If you are using Calibre, however, importing an HTML file does not cause that tool to import image and stylesheet files automatically, and so you will have to import all such files yourself, as detailed in Step D below.
Note that, if you have not followed the advice given above about prepending a number to each filename, you will now have to order the chapters manually by clicking and dragging in the chapter listing in Sigil. That is, numbering them prior to this stage is a great way to obviate a rather tedious process, because Sigil orders the files alphanumerically as it imports them, where 0, 1, 2, 3 etc. come before anything else.
C.
Delete Section0001.htm. The file you see in Sigil called Section0001.htm is simply an empty placeholder that forms part of every new EPUB file that Sigil generates. It is present at the outset because Sigil does not allow an empty Text folder and so you should delete it.
D.
Import Auxiliary Images. If, as mentioned in Step B above, your CSS code makes use of images (and you are using Sigil), you should import these explicitly. The same applies to all images if you are using Calibre, irrespective of any CSS.
To do this, follow the equivalent steps that you took when importing the HTML. That is, right-click on the Images folder in Sigil (or select ‘File/Add/Existing Files’ on the menu), then navigate to the directory where your book's images reside, and then select the files on which your book's CSS draws. (If you are using Calibre, you should select ‘File/Import Files into Book’ on the menu.)
E.
Import Font Files. If you use custom typefaces, you must also import those explicitly too (whether using Sigil or Calibre), using the same approach that you used to import the HTML files.
F.
Import Cover Image. Import the book's cover image in the same way that you import auxiliary images in Step D.
G.
Set Cover-Image Semantics. Locate the cover image in the Images folder that you see in Sigil's display, and right-click on it. A menu will appear, in which you should click ‘Add Semantics’. You should click on ‘Cover Image’ in the sub-menu that appears. (Note that this is an identical process in Calibre – you right-click on the image name and select the correct option on the menu that appears.)
H.
Set Metadata. Click ‘Tools’ on the main menu, and click ‘Metadata Editor’. A dialog box will appear, into which you need enter only the title of your book into the Title field, and the names of the author(s) into the Author field. Obviously, if your book is not in English, you should also select its principal language from the drop-down list. Then click ‘OK’.
I.
Create Logical ToC. The ‘logical’ table of contents is not the HTML file that contains the table-of-contents links to the book's chapters. It is an internal block of information (the ‘NCX’ file) that governs the chapter and section listing that you see when selecting Go To (or similar, such as a button marked ‘≡’) on a software or hardware e-reader, and it is mandatory.
To complete this step, select Tools again on the main menu, and select ‘Table of Contents/Generate Table of Contents’. A dialog box will appear, which lists all the <h1>, <h2> etc. elements in the chapters in your book. You can configure this listing by clicking ‘Select Headings to Include in ToC’, and choosing one of the options that appears. You can also elide items from the main listing by clicking on the check boxes that you see in the ‘Include’ column. If you make a mistake at any point, simply click ‘Cancel’ and repeat this entire step from the start.
Click ‘OK’ when you are satisfied with the table of contents that you have created, and save the EPUB by choosing ‘File/Save’ on the menus (there is a button that will do the same). Once saved, you will have on your machine an EPUB – the first version of your book in electronic format.
J.
Validate. To validate the EPUB, you can use the validators that are built-in to Sigil and Calibre. In the case of Sigil, select ‘Tools/Validate EPUB with Flightcrew’, on the main menu. A supplementary pane will appear in the application's window, which will give a report on any problems discovered. If you are using Calibre, click the ladybird icon in that application's EPUB editor.
A far better alternative to the in-built validators, however, is the online resource provided by IDPF (International Digital Publishing Forum), the search terms suggestion for which is:
On arrival at the IDPF's site, you will need to locate on your machine the EPUB you have created, and then tell the validator to get cracking. You machine will then upload the EPUB to the validator, which will provide you subsequently with a report. As with the built-in validators, it is impracticable to enumerate here all the possible problems you may discover, so you will have to read any error notifications you receive and act accordingly.
Do note that, if you update an image, CSS or HTML file externally (i.e. not by altering anything within Sigil), you must delete and re-import the affected components, as Sigil and Calibre cannot detect such external changes automatically. For example, if you were to change something in an HTML file, the copy that you imported previously into the EPUB file will remain untouched, and the same applies to CSS and image files. In the light of that, do note that, in the event that you make many changes in a number of locations in the book's content, it is easier to delete the contents of the Text/Style/Images/Fonts folders, and then re-import the various contents. Alternatively, you can start afresh by creating a new EPUB file.
With the EPUB version of your book in hand, you can upload that without any further work to retailers that sell e-books in that format. However, it is overwhelmingly likely that you will wish to sell through Amazon, and so you must create a Mobi/KF8 version of the book too.
To proceed with that stage, start Kindle Previewer, locate on your machine the EPUB file that Sigil created, and drag-drop that on to the Previewer window. A dialogue box will appear, informing you that it is compiling the file. You should click on the little button to the bottom right, as the following screen shot shows:
The dialogue box will expand to display a messaging area, in which the Previewer application (KindleGen, more accurately) displays messages describing the compilation process. When compilation is complete, you will see a message in the main part of the dialogue box, indicating success or otherwise, but do note that a success notification does not mean that compilation was error free. For example, if the book contains one or more links that point to a non-existent target (a ‘broken’ link), you will still see a success message (when, in fact, you should not).
This means that you can be certain of success only by scrolling down the list of messages in the messaging area, checking for any error or warning notifications. You can ignore the ones that start with ‘Info’, but you must pay attention to those that start with ‘Warning’ or ‘Error’. For example, you will see a message that states the following if the compiler detects a broken link:
Warning(prcgen):W14001: Hyperlink not resolved:
Where the remainder of the message will cite the targetless link. Similarly, the EPUB may be missing an image file, in which case you will see:
Warning(prcgen):W14010: media file not found
Alternatively, if an SVG image is missing, you will see:
Warning(svgparser):W25001: SVG Parser could not find the referenced file
You must resolve the causes of all warning and error messages, so once you have fixed the relevant problems, update the EPUB file and then re-compile in Kindle Previewer. When compilation completes with no warnings or errors, scroll down to the bottom of the messaging area where you will see notifications that give you the sizes of the Mobi and KF8 files that are contained within the file that KindleGen produced, and which look something like this:
Info(prcgen):I15000: Approximate Standard Mobi Deliverable file size : 0001093KB
Info(prcgen):I15001: Approximate KF8 Deliverable file size : 0002559KB
For a book that yields these compilation statistics, the older, Mobi part will cost $0.17 to deliver to a customer in the USA, and (currently) will cost £0.11 for delivery to a customer in the UK. Equivalently, delivery of the KF8 to those same customers will cost $0.39 and £0.26 respectively.
Note that you can find the deliverable in a sub-directory of the one in which the EPUB file resides. The name of that sub-directory starts with ‘converted’, and it contains all the Mobi/KF8 files that were generated each time you compiled the book file previously, and each filename will contain the date and time on which the file in question was created. The one you want is the most recent (it is safe to delete all the others), the name of which you can change to whatever you want.
Assuming successful compilation, and on clicking ‘OK’ in the compilation dialogue box, Kindle Previewer will display the book on-screen. The application allows you to choose the device you wish it to emulate, and you should give the book a thorough check in all settings (although you can ignore the first-/second-generation mode if you are not targeting those devices).
However, if you intend to sell the EPUB version too, you should proof the work in an appropriate emulator for that format, and an option here is Calibre. You need only drag-drop the EPUB file onto that application's main window, and then double-click on its title in the main part of the display. This is also the time to test the book on whatever hardware e-readers you have, as you need to check foroverlong paragraphs and other problems likefloated elements taking up too much lateral space, which will be especially apparent on a more-limited e-ink device.
To do this, you need to copy the book file to the device in question. In general, this entails connecting it to your development machine using a USB lead, whereupon the reader should appear on the computer as a storage device (just as if you plugged in a memory stick). You then copy the EPUB or Mobi/KF8 file to a directory on the device. The name of that may vary from device to device, so you will have to mosey around the reader's directory structure until you find the right location (it will contain all the other books that are on the device).
Following that, make sure that you complete a ‘safe removal’ or formal ejection step before un-plugging the e-reader from your machine. This is important because telling your operating system (Windows, for example) that you wish to unplug a USB storage device ensures that it completes any prior data-writing operations. That is, do not just yank the plug out of the socket, as this could leave the information structures in the e-reader in a corrupted (unreadable) state.
That aside, if you discover any problems when proofing the book, you will need to return to the appropriate stage above, and remedy matters before re-building the EPUB etc.
Beyond testing by direct copying to a hardware user-agent (‘sideloading’, as it is called), there is a final step that you should take in the interest of maximal quality assurance. The essence of the technique is that Amazon associates an email address with every Kindle device it sells, and the company provides a corresponding service that allows you to email a book file to any Kindle you wish, as long as you have the address of the device in question. As Chapter Four, Style,points out, uploading a book to Amazon causes it to perform some form of processing on the book, which is the point at which your book may lose any font files it carries, and appears that the same processing is visited on any Mobi/KF8 file that you email to a Kindle. The font stripping bug, for example, manifests during that process too.
Given that we cannot know what other bugs in Amazon's systems await the unsuspecting, it is a very good idea to email your book file to any hardware Kindle you may possess, as you can then see exactly how the book will appear to real customers before it appears on any product page. It takes only a few minutes for the file to appear on the device, which facilitates rapid turnaround – valuable if you have a set of possible solutions that you need to test one-by-one. Currently, you can access the email service by logging-in to your account with Amazon, selecting ‘Your Account’ on the home page, and then selecting ‘Manage your Content and Devices’ from the drop-down menu.
You may think that proofreading falls squarely before any production of the final deliverable, but this is not true. It is better to proofread after you have completed all production steps successfully, because, in dispatching the stages above, you may have introduced errors into the content itself. That is, your book may pass all validation steps possible, but validators check only for complicity with the various coding etc. rules that apply. For example, you may have misspelled an id or class attribute-value, causing any corresponding CSS selector to have no effect.
No HTML or CSS validator will trap such errors, nor will spelling and grammar checkers, and so you should, at the least, check that the entire body of content renders correctly. Moreover, you should proofread only once you are confident that you can produce the deliverable reliably in an entirely mechanical fashion.
Note too that it is far better to proofread a printed rather than electronic copy of the content (hard- rather than soft-copy), because we become accommodated to a work when it is always presented in the same medium. This contributes to the mind's tendency to ‘tune-out’ defects, thus causing you to see things as you expect them to be, not as they are. It follows that reviewing hard- rather than soft-copy of the work will yield an element of the ‘holiday effect’ that Chapter Two pointsout, and may thus help you see problems that were unapparent previously.
Moreover, Chapter Two also argues strongly for using the services of a second party during the proofing stage. Providing hard- rather than soft-copy here will allow that individual to annotate the document directly. You could also go for a double reading, where you pass the proofing copy to the second reader (and even a third if necessary), who can add further annotations. On return of that document, you will be able to create the best iteration yet of your work.
You could make a case here for using the annotation features that modern e-readers support. That is, you could distribute an electronic version of the deliverable to your proofreader(s), who would then record notes in the book file itself using touch-/click-drag actions to mark out possible problems. Obviously, this saves on toner and paper, but such parsimony is hardly appropriate given the scope of your project (if the book is successful, you will recoup such minimal production costs quickly). The true weight of this argument lies in the fact that e-readers excel at searching for words and phrases, which is invaluable for tracking down places where, say, you have repeated yourself redundantly (an important issue in a technical work such as this book).
However, the argument suffers from the following drawbacks:
1.
It requires passing a physical device of some sort (e-reader, laptop or tablet computer) to your proofreader, which precludes your using it again until proofreading is complete. That is, you cannot pass across just the EPUB or Mobi/KF8 file because any annotations created for that file are stored in a separate file on the user agent. This would mean that your proofreader(s) would have to pass back the annotations file, and there is scope here for error, as this assumes that your proofreader has the requisite technical understanding.
2.
You never see the final work in hard copy, which will cause you to miss out on seeing the material in a new light, and thus to miss an opportunity for product refinement.
3.
It is a lot faster for a person to use a good-old-fashioned pen or pencil to annotate the work – at times, there really is such a thing as too much technology.
4.
The text selection feature does not work on user agents like the Kindle Touch in the context offloated text. That is, if you touch and hold on the screen on a textual element that is floated to the left or right, you will find that dragging your finger does not have the usual effect of marking out a stream of content. This precludes proper electronic-only proofreading on at least some devices.
Assuming you accept these points, the only question remaining is how you should generate the hard copy. That is, should you print from your web browser, or from your EPUB editor? The second option is unavailable in Calibre, although you can print from Sigil, so for many, printing from the browser will be the only means available. However, CSS is of great value at this point in that you can use it temporarily to give wide margins and double spacing to the printed copy, which yields plenty of room for you and your proofreader(s) to insert annotations.
Achieving this is trivial. Simply put margin and line-height rules into a CSS definition that you apply to the <body> element, and place that definition in Stylesheet.css. That is:
body { line-height : 2; margin-left : 15%; margin-right : 15%; }
<body> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p> </body>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Obviously, you should remove that definition before generating the final deliverable that you upload to retailers, but the implication of this technique is that you need change only the master stylesheet temporarily. This means that printing from your browser requires only that you re-load each chapter file in that application, whereas printing from Sigil will require that you re-edit the EPUB file by re-inserting the altered stylesheet file.
Printing from your browser is therefore the easier option by far, and this underscores the value of adopting the three- rather than two-stage production process that Chapter Oneadvocates, and which this chapter lays out in full.
A final point on this issue: do not make changes to the HTML/CSS files until you have the fully-proofed version. Doing so is likely to cause great confusion over which version of the work is canon. It is a very simple principle: get it proofed by someone else only once absolutely everything else has been resolved within the work; get that person to proof a printed copy; and wait patiently until that is done before you make any final changes.
At the point that you finalise the work completely, you are almost at the end of your long trek. The final creative stage in the entire process is to compose some marketing blurb, which retailers will display when potential customers happen upon your product page on those retailers' web sites.
Once you have your blurb, you need to create accounts with the retailers or distributors though which you plan to sell your book. The details of this step are too numerous and varied to enumerate here, but they amount to providing banking information, a postal address, and, in the case of some retailers, a ‘tax code’ of some form. The next chapter, Infrastructure, discussesthe relevant details.
Having created the requisite account(s), you are ready for the big moment when you will upload your book. Again, enumerating the details of this process here is impracticable, but, broadly, a given retailer's site will presented you with a data-entry form, into which you should paste your marketing blurb, and through which you must set your pricing and other details. For the final step, you will need to locate the EPUB or Mobi/KF8 file on your machine and upload it.
And with that complete, you have reached the point where aspiration and reality coincide. It is time to make a break for the present. It's time to click that button…