Removing Forced Line Breaks & Nonbreaking Hyphenation in InDesign to ePUB
When converting the InDesign file of a book created for print, you need to be aware of the choices the print designer made, including how and where they have used forced line breaks and forced hyphenation. If these tools were used by the print designer, you will need to clean the files up, either prior to ePUB export or after export.
One of the great things about the general ePUB format is that text is reflowable; there is no fixed page in the ePUB. The page will reflow based on the eReader device or software that a reader is using and the reader’s personal preferences in font and font size.
This is very different from a print book in which a designer may use forced line breaks or soft returns and forced hyphenation to make lines and pages break at certain points, often to avoid loose or tight lines, widows, orphans, or bad breaks. Designers may also add forced breaks to heads so that if they break across multiple lines, the lines are relatively equal in length or the break occurs at a point that improves readability and understanding of the head’s meaning.
Before we start, a reminder: If you are going to make substantial changes to the print InDesign file before exporting to ePUB, it would be best if you created a copy of the print file and use the copy when making changes and exporting to ePUB. You have been warned.
The best way to add a forced line break (shift + Enter/Return) is to do so after the space separating two words. If all forced line breaks are done this way, it should be relatively painless to remove them in InDesign using Find/Change with the Text tab:
You can also use the GREP tab to do the same thing:
This will delete the forced line break. The text from the line following the deleted forced line break should roll back and there will be a space between the last word before the forced line break and the first word after the forced line break.
Unfortunately, it is not uncommon to find that the forced line break was placed immediately following a word in the print ID file. When this happens, the space following the forced break is often deleted since the text of the following line will no longer be flush left in the print ID file. If you do a simple Find and Replace to delete the forced break, you will close the two words together.
In Cari Jansen’s post I mention below, she provides GREP you can use to fix this. Go to the GREP tab. Simply Find what: (\S)\n, where (\S) is any character that is not a space, and Change to: $1[single space], where $1 simply means include the character found in (\S). This will add a space after the word immediately preceding the forced line break and delete the forced line break.
Print designers may do something similar with word breaks by adding forced hyphenation. This is usually done to ensure that words that normally appear with hyphens in them break only after the hyphen or to prevent bad breaks in words (before single vowel syllables, before liquid el syllables, etc.).
My suggestion is that you remove both nonbreaking/forced hyphenation (^~/~~) and discretionary hyphenation (^-/~-) from the InDesign file prior to ePUB export. Unfortunately, you will probably want to perform the Find/Change on each occurrence individually since a hyphen may or may not be need at the place where the nonbreaking or discretionary hyphen has been added. If there should be a hyphen in the word at the point where the nonbreaking hyphen appears, replace with a hyphen; it there shouldn’t be a hyphen, delete the character and close the word.
You may also find that non-breaking spaces (^S/~S or ^s/~s [fixed width]) have been used to control where lines break. You may want to replace these with normal spaces to remove any chance of incorrect or unintentional rendering in an eReader. In CS5.5, both will export as
. In CS3 and 4, the regular nonbreaking space will export as as
; the fixed width nonbreaking space will not.
If you don’t want to make changes to the InDesign file before export to ePUB, you can have InDesign remove forced line breaks on ePUB export by checking the Remove Forced Line Breaks box on the EPUB Export Options/Contents dialog box.
Cari Jansen has a wonderful post at carijansen.com on this titled “Building EBooks with InDesign—Forced Line Breaks.” In this post, Jansen suggests using GREP to insert a space after the last letter of the word proceeding a forced line break if it is not there to ensure that you do not close two words that should remain open.
If you neglect to remove forced line breaks in the InDesign files prior to export or during export, you will find that a break tag,
<br />, will be inserted wherever a forced line break occurs in InDesign. Don’t lose hope; you can always edit them out of your ePUB using your text editor and Find/Replace or RegEx.
Are you dealing with these issues in other ways? What else have you found in InDesign files that were created for print that you need to delete or replace for export to ePUB?