Making a Custom Composition Highlighter to Find Invisible Characters

Trog, in a tweet, wrote:

is there a way to add custom composition highlights ex. soft & hard return invis. characters?

Interesting question! Highlights are usually used to find special or problematic formatting. We’ve talked about InDesign’s composition highlights feature several times (such as this overview, and this clever tip from Mr. Rankin). But this is an interesting question: why not use highlights to quickly see special invisible characters?!

My first thought was, sure, you could make a special highlight character style and then apply it using GREP Styles to characters such as the new line (Shift-Return/Enter) character. Unfortunately, this doesn’t work because those characters are technically zero width — so the highlighting just disappears.

However, then I thought of a workaround: You could apply the highlighting to the character before the carriage return or new line character.

For example, here’s the original text:

HighlighterA4

It’s hard to tell from this what is a new line (shift-enter) and what is a carriage return (enter). So let’s make a couple of highlighter character styles like this one:

HighlighterA1

and then let’s apply those character styles to the character just before the invisible characters with two GREP styles inside the paragraph style definition:

HighlighterA2

Those codes are kind of strange, aren’t they? The first one .(?=) means “any character that immediately precedes a shift-return” (some folks call this a soft return, others a hard line break). The second one is the same, but for a hard carriage return.

Here’s the result:

HighlighterA3

Of course, you’ll also notice that I have turned on Type > Show Invisible Characters in the image above so that you can see that the pink is applied to shift-returns and blue shows up at the hard carriage return.

Although the Show Invisible Characters already shows you what’s what, this kind of highlighting can be far easier to see, especially at a glance.

The only problem with this kind of highlighting is that it’s annoying to have to turn it off when you want to print or export a PDF. Sandee Cohen showed a clever workaround to this problem at the recent PePcon: The Print + ePublishing Conference.

Bookmark
Please login to bookmark Close

This article was last modified on December 30, 2021

Comments (2)

Leave a Reply

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

Loading comments...