Advertisements



« | Main

Building EBooks with InDesign – Forced Line Breaks

Org. posted 1-Jan-2012,
Updated 3-Jan-2012 / Postscript added

One of the pitfalls of converting print publications to EBooks, is that designers often use forced line breaks (Shift+Return/Enter) in print-layouts to control where headings and even paragraph lines are broken. Doing so can cause problems when the same document is also converted to EPUB later on. Problems can occur when we leave the line breaks in the document, but also when we simply opt to remove them. Let’s have a look at what issues we encounter… and how we can fix things in InDesign without altering our layout :) prior to EPUB export.

EPUB Export Options dialog

The EPUB Export dialog provides us with an option to Remove these Forced Line Breaks on the fly if preferred.

Show hidden characters displays forced line breaks in InDesign text

Forced line breaks in InDesign document (Colour code explained later on).

Let’s assume we are working with a publication that has been originally prepared for Print and must now be converted for EBook publishing (be it for EPUB or Kindle)… what happens to the forced line breaks that were inserted?

  1. if we opt to leave the forced line breaks in the InDesign document
  2. if we opt to remove them from the InDesign document

1. Retain Forced Line Breaks during EPUB export

What happens when we export the EPUB and retain the forced line breaks? Well in a nutshell, the resulting HTML will include  <br /> characters. And with altering font-size these characters might generate some very unpredictable (read: unwanted) line breaks in our text.

Resulting BR elements in EPUB export from InDesign

Break characters inserted in EPUB HTML.

 Forced line breaks pointed out in screenshot

 Some unwanted line breaks appearing in the EBook.

 2. Remove Forced Line Breaks during EPUB export

Looking at the example above, it seems clear that you’d want to remove the forced line breaks during export right? So let’s see what else can happen.

Some line breaks ok, some not.

 Possible result in EBook after line break removal (some ok, some not ok).

Yup, you’re not seeing things… (image above). Removing the forced line breaks can result in words being ‘fused’ together. Why does this happen in some cases and not others? Well, it’s all to do with the way the designer originally inserted the forced line breaks in InDesign:

No matter what happened, the removal of the space character as part of the forced line break insertion is causing a problem. So it’s important that we check our document for missing preceding spaces and fix things before we export our InDesign file to EPUB.

GREP Find/Change to the rescue

My preferred export way is to have the remove forced line break option enabled… it means less work in EPUB editing… IF we apply one essential step first before we export our InDesign document.

Basically we want to look for any forced line breaks in our document that are NOT preceded by a space character, and then we’d like to insert a space character in front of this break.

Tip: If you find yourself performing a ton of these Find/Changes prior as part of the EBook clean-up… consider purchasing Multi-Find Change plug-in for InDesign and you’ll be able to store all your EBook clean-up Find/Changes in a single set and apply them all in one hit :) see: www.automatication.com

Here we go…

Find what?

So our Find what string ends up looking like: “(\S)\n”

(\S)\n entered in Find what field.

Change to?

We now need to change things to:

So our Change to string ends up looking like: “$1 \n

$1 \n set in Change to field.

Next click the Change All button in the Find/Change dialog and…

You can now safely Remove all Forced Line Breaks when exporting your InDesign document to EPUB. Best bit about this: There  is no need to fiddle  with <br /> tags in the HTML afterwards :)

Postscript – Removing Selected Forced Line Breaks only

Doug (comments below) mentions that there are indeed cases where you’d like to retain the Forced Line Breaks. Poetry for example. In that case you’d probably be more likely to remove the forced line breaks all together in InDesign for those paragraphs that are NOT  poetry :) , and opt not to remove them during the EPUB export. Once again I’m a big fan of trying to get the export as clean as possible from InDesign so there’s less to do with HTML/CSS later on. The one side-note here is that removing those forced line breaks would result in text reflow in the InDesign document. So if you’re looking at a single InDesign file for Print and EBook export, you’ll need to refrain yourself from using forced line breaks as a designer :) As Keith mentions in his comment below. You could  apply a ‘no break’ as an alternative.

Assuming you find yourself working with a document that has its text formatted with paragraph styles, you can selectively replace the forced line breaks in the text and replace them by a single space. We’ll cover both the scenario where we don’t have a preceding space and do have a preceding space in a single Find/Change action.

Find/Change replace All forced line breaks with a single space

Once again we look for

If we turn the non-space character and space character into a Marking subexpression ‘()’, we can then set our Change to to just ‘$1′ :)

The only thing we still need to do is set the Find Format. If you don’t see this option in the Find/Change dialog, click the More Options button.

Find what: (\S)\n|(\s)\n

You’d need to repeat this Find/Change query for each relevant paragraph style.

Note: Tina Hender (@tinahender) tweets, that forced line breaks are also used for URL breaks. My guess would be that in this case you’re likely to see the forced line break at a ‘/’. I’d opt to perform a Find/Change that fixes these first of all. Again… Multi-Find Change for pre-EPUB clean-up will become a handy tool, as you can build this massive Find/Change Query Set in which a multitude of queries are run in one hit ;-)

Topics: Adobe, EPUB, GREP, InDesign, Publishing Technology | 9 Comments »

9 Responses to “Building EBooks with InDesign – Forced Line Breaks”

  1. Naomi Kennedy says:
    January 2nd, 2012 at 3:11 am

    Watch out for forced hyphenation though. Some designers use hard hyphens and forced line breaks instead of discretionary hyphens (which also need to be removed).

  2. Cari Jansen says:
    January 2nd, 2012 at 7:17 am

    Hi Naomi,
    That’s a valid point indeed :)
    Problem I have with those is that the only way to tell whether they are ‘hard-hyphens’ that should become discretionary hyphens is by reviewing the text itself after ‘space-insertion’ … I tend to run a document wide Find/Change for ‘hyphen followed by space’ after… using the Find, then Find Next option… so I can review each of those. Luckily I don’t come across those too often :) as most documents I work on have hyphenation disabled…
    Cari

  3. Keith says:
    January 2nd, 2012 at 11:17 pm

    Designers who aren’t us cause SO many problems…

    If I may offer a couple more tricks along these lines?

    You can also replace all the soft-returns with spaces, and then replace all double-spaces with single-spaces–or replace all soft-returns with some weird character not used elsewhere ( ß ? ? ) and then replace weird-character+space with just the space.

    If you’re the person making the print file, it’s good practice to avoid soft-returns in body copy altogether by creating a “no break” character style and applying it to the words causing the bad rags. In addition to making epub export easy (you just delete the character style), it also doesn’t override InDesign’s excellent type-spacing algorithms.

  4. Keith says:
    January 2nd, 2012 at 11:18 pm

    Two of my examples of weird characters not used elsewhere rendered as question marks, but hopefully the idea still comes across.

  5. Doug Smith says:
    January 2nd, 2012 at 11:29 pm

    This can get tricky when a book contains poetry or song lyrics. Poetry is often entered with each stanza as a paragraph and each line within the stanza having a hard return at the end. We wouldn’t want to remove the forced line breaks in that case because it would destroy the poetry’s structure. So we either have to not use that feature or change the way the poetry is styled.

    Unfortunately, I haven’t found an ideal solution yet to format poetry well and also avoid fiddling with the ePub markup to correct it or fix other markup problems caused be keeping the line breaks to make the poetry work.

  6. Cari Jansen says:
    January 3rd, 2012 at 8:15 am

    @Keith I try and teach people to be cautious with using soft-returns, but old-habits seem to die hard :) It’s quite amazing what I see in documents at times :) If the print-layout needs to be retained, I’d opt to leave the soft-returns in the document, but ensure they are preceded by a space. As Naomi points out, you’d need to consider whether there are other occurrences that you’ve not accounted for (e.g. hard-hyphens inserted by a designer to ‘hyphenate’ words)

  7. Cari Jansen says:
    January 3rd, 2012 at 8:21 am

    @Doug

    Ha, poetry… I’ve managed to stay away from that thus far :) But poetry to EPUB is tricky. :)
    In that case you’d leave the forced-line-breaks in during export to EPUB.

    However, if you were to use a separate paragraph style to set poetry, you could still use the GREP Find/Change trick, but this time to entirely remove the unwanted forced line breaks in InDesign and replace them with a space (this does mean you’ll see some text reflow in the InDesign document where the forced line breaks are removed).

    Ensure you set the ‘Paragraph Styles\’ in the Find Format for which you DO want to perform this particular fix. You’d need to run one query for each paragraph style (unless you use Multi-Find/Change – see link above – and create a query set).

    Find what: ‘(\S)\n’
    Change to: ‘$1 ‘

    p.s. I’ve added a Postscript to my blogpost Doug :) In which I describe how you can remove forced line breaks in selected paragraphs only before EPUB export :)

  8. Neil says:
    January 26th, 2012 at 10:33 am

    I do a lot of poetry book conversions from ID to ePub and this blog is going to be a godsend to me.. Likeminded people, wow.

    The earlier comment about designers ‘not like us’really resonates.

  9. Cari Jansen says:
    February 17th, 2012 at 10:49 pm

    Thanks Neil… I’ve been pretty busy lately… hence no more than one post added for the year… but keep an eye out after mid next week for some new stuff :)

Comments

Trademarks: Adobe, the Adobe logo, Acrobat, Creative Suite, Illustrator, InDesign, Photoshop, PostScript are trademarks of Adobe Systems Incorporated.

Disclaimer: While every precaution has been taken in the preparation of this web-site, the creator shall not have any liability to any person or entity with respect to any liability, loss, or damage caused or alleged to be caused directly or indirectly by the information or instructions contained in this web-site, or by the computer software and hardware products described therein.