Indents in ebooks

One of the most frequent questions we are asked by self-publishing authors concerns problems with paragraph indents. If you print out your Word document and everything looks OK, why do things get in a muddle when you turn it into an ebook? 

What causes the problem?
Word is a WYSIWYG program (what you see is what you get) so your document looks the same when you print it out on paper as it does when you look at it on screen.  This is great if you are going to produce a printed book. but these WYSIWYG properties don’t translate properly into ebooks. That’s because people read ebooks on a range of different reading devices with different capabilities, and they choose to read them using different font sizes and different line spacing. This variability means you can’t fix what people will see in the same way that you can with print books so you have to accept that you have less control.

To make it possible for ebooks to be used by devices with varying capabilities (including Braille and audio!), the underlying format for both epub and kindle ebooks is HTML – the same language used for web pages.  Instead of prescribing a fixed WYSIWYG layout, HTML marks each element of your document with its meaning (Heading, Subheading, Paragraph etc) and the device does its best  to display it sensibly. To help it do that, you need to mark those elements in your Word document.

Word marks a paragraph as a paragraph automatically at the moment that you press the ENTER key, but its default styling of paragraphs doesn’t provide an indent at the beginning.  The tempting way to put this right is to insert some spaces or tabs by hand so the Word document looks the way you want. Unfortunately this can cause problems when the file is converted to an ebook.

In HTML, all white spaces, including indents made by multiple spaces or tabs, are collapsed to a single space so they disappear. However, some conversion processes may try to compensate for this by adding non-breaking-spaces (spaces that are not ignored in HTML). If this happens, o some or all of the indents you’ve put in by hand will still exist, but they may not be the size you expected and/or they may be added to other indents the ereader puts in.

Solving the problem
To make your documents look the way you want in Word but, at the same time, make them convert nicely into HTML, you need to sort out the way you handle indents.

The first think to do is to turn on the formatting marks.  Lots of authors hate these, but if you’re trying to sort things out, they’re a huge help – and of course, you only need have them on for the duration of the exercise.

Click the ¶ button (if this is not on your main toolbar, expose the formatting tool bar to see it).  Now every space can be seen as light dot, every line break shows as ↵  and each paragraph ends with the ¶ mark.  There are a few other marks too but it’s the paragraphs that really matter.  Note that a line break (made with Shift + Enter) is quite different from a new paragraph even though the result might look the same in Word.

To tell Word the way you’d like paragraphs to look, you have to set a style.  The default style is ‘Normal’ and you’ll either need to modify this or create a new style of your own.  The exact set of key clicks may depend on your version of Word – what follows is the way it works for me:

On the main menu go to Format > Styles to open a ‘Titles and Formatting’ task pane.  Click ‘Normal’ in this pane to select it and then click the drop down arrow and select ‘Modify’.

To set an indent, choose ‘First line’ in the special box and put a value in the ‘By’ box.  Click OK to go back to the previous dialogue then click OK again to return to your document.

You should now see your document with indents applied automatically. But, if you originally had spaces or tabs at the start of every paragraph, they will still be there in addition to the indent that is part of the style you’ve just defined.

You can remove these using the search and replace operation. The process is quite straightforward and, if you do make a mistake, a few Control Zs (undo) will return you to your previous arrangement.

Getting rid of multiple spaces
If you used five spaces at the start of every paragraph, then you need to do a global search for five spaces with a replacement of nothing.  Because it’s just possible that five spaces were used somewhere else in your text and you don’t want to lose them,  a slightly better approach is to search for a paragraph mark (^p) followed by five spaces and replace with just the paragraph mark.

On your menu, click Edit > Replace.

In the ‘Find What’ box, type ^p followed by five spaces. Alternatively click the ‘More’ button, Then the ‘Special’ button and finally select ‘Paragraph Mark’ and type the five spaces.  Put a paragraph mark (^p) in the ‘Replace With’ box  (or do it via the ‘More’ button etc).  Click ‘Replace All’ and your extra spaces should disappear.

It’s quite likely though that you weren’t entirely consistent with your spacing so you may need to go through the exercise again with four and three spaces too.

Getting rid of tabs
If you used tabs, use the same procedure as above but this time search for the paragraph end followed by a tab (^p^t) and, as before, replace it with the paragraph mark (^p).  If you used more than one tab, you’ll need to increase the number of tabs in the ‘Find What’ box – e.g. ^p^t^t.

Converting line breaks to paragraphs
If you used line breaks (Shift + Enter) to make your document look as if it contained multiple paragraphs, you’ll need to convert the line breaks to paragraphs.  ‘Find What’ will be ^l, (i.e. lower case L, not a number 1) ‘Replace With’ will be ^p.  If you used double line breaks then you will need ^l^l in the ‘Find What’. box.  You might then also need to remove spaces (as previously) if you used these too.

Tidying up
After you’ve used any of these methods, you should skim through your document looking for instances where it doesn’t seem to have worked or where other text has gone wrong.

Indents that are still wrong are usually because you didn’t use quite the same formatting that you intended – for example, you used tabs in some places instead of spaces. They can also be caused by inconsistencies such as using six spaces in some places instead of five. In these cases, the simplest solution is to modify by hand.  The inclusion of formatting marks will allow you to see what needs to be done

It’s also possible that the pattern you searched for and replaced turned up in places  that you didn’t want to change. You can either put these problems right manually or if they are extensive  you may prefer to undo the changes (multiple replaces are undone with a single  undo command). Then you can highlight the document in sections doing the find/replace for all the individual sections that you want changed and leaving the others as they are.

I might not have covered every possibility here, but the principle will always be the same: find out what you did to augment Word’s paragraph style and remove it using the Find and Replace tool.  Your document should then convert accurately to whatever ebook format you choose.

Going a bit further
In many books, the convention is to omit the indent in the first paragraph of a chapter and you can automate this too.  Just create a new style – say ‘firstpara’ – that is exactly the same as your indented Normal except without indentation.  Make sure that the “Style for following paragraph” is set to Normal.  You can set your first paragraph to this firstpara style manually or you could go one step further and alter your headings (yes – they should be styled too, not just be Normal text made bold!) so that the “Style for following paragraph” is firstpara.

Then when you type a new chapter heading and select the style of heading you need (probably  Heading2),  your return key will automatically set the first para style for your first paragraph and go on to Normal thereafter.

You’d probably like your  chapter headings to start on a new page.  Never ever do this by padding out with empty paragraphs – they’ll turn up as unwanted space in ebooks because the ebook page size won’t match your printer paper size.  The proper way is to insert a page break (Insert > Break > Page Break in Word) but you can automate this too.  Just modify the Heading2 style’s format to include  ‘page break before’ in the ‘Line and Page Break’ dialogue.