No Break using InDesign’s FindChangeByList script

It is possible to apply the “no break” attribute using the FindChangeByList script in InDesign.

What is FindChangeByList?

The FindChangeByList script is incredibly useful when making a standard set of changes over several documents. Multilingual typesetting in particular benefits from this method to ensure consistent application of typographic styles relevant to the language at hand.

Every InDesign user has this script ready to go – it comes with the program! You can find it in your Scripts panel under Samples / Javascript. As the name suggests, it works through a list of find/change commands. These are stored as text in separate file called FindChangeList.txt (within a folder called FindChangeSupport).

The default list contains nine useful sample searches, such as this one to remove multiple spaces:

grep {findWhat:” +”} {changeTo:” “} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double spaces and replace with single spaces.

Different sequences of searches can be defined by altering this text file (or a copy of it). You can even “record” Find/Changes as outlined in this useful InDesign Secrets article, Find-Change Scripting Goodness.

Adding non-breaking spaces with FindChangeByList

For instance, many prepositions in some Slavic languages should “take over” with the following word if they occur at the end of a line. In the Czech phrase, for instance, “z krabice”. So we can use this line in our Find Change List:

grep {findWhat:” (z) “} {changeTo:” $1~S”} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} non-breaking space

That adds a non-breaking space. But what if we want to apply a non-breaking character attribute instead?

Applying no break with FindChangeByList

You can apply a no break character attribute using noBreak:true in the Change field. Take the example of the French for “sub-process”: “sous-processus”. To set that to be non breaking, use this line in your FindChangeByList

grep {findWhat:”(sous-processus)”} {noBreak:true} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} non-breaking

The key is that nobreak:true is the ONLY item in the Change options. If you try to combine the no break with changing the text or another attribute, it might not work. To change something else as well, write two separate changes.

For instance, if we have a document with the English “sub-process” and we want to change it to a non-breaking “sous-processus”, it seems to be necessary to:

grep {findWhat:”sub-process”} {changeTo:”sous-processus”} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
grep {findWhat:”(sous-processus)”} {noBreak:true} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} non-breaking

The FindChangeByList script is a powerful and useful tool. As with all such tools, back up your file before using if in doubt and check the results carefully. If you are still unsure, then play safe and do the Find/Change manually.

Leave a Reply

Your email address will not be published. Required fields are marked *