4

See the underline continues after each word before a line-break? How can I automatically remove that underlined whitespace?

underlined whitespaces on line-break in Indesign

4

It's an issue, but there's nothing automated you can do.

I've filed several bug reports for InDesign and Illustrator about using spaces for centering, underlines, etc. and in years Adobe hasn't corrected the issue.

The only thing you can do is delete the trailing space on that line or manually remove the underline from the space. There's no automated solution.

  • Welcome back from your sabbatical! – Ryan Feb 13 '14 at 18:55
1

It's an issue, but it can be fixed – although not automatically/unattended.

The JavaScript in the answer to the exact same question from 2009 on InDesignSecrets applies a special character style to underlined end-of-line spaces, and switches Underline off for that style. That way, you can easily restore/remove the patch when the text gets edited and you need to run the script again.

Unfortunately, posts in the forum on InDesignSecrets get quote and dash beautifications (curly quotes and en-dashes) and so the script is not ready-to-copy. Here it is with fixes:

//DESCRIPTION: Begone, Ugly End Of Line Underlining!
// (c) Jongware 16-Dec-2009

var blankStyle = app.activeDocument.characterStyles.item("NoUnderline");

try { blankStyle.index; } catch(_)
{
    blankStyle = undefined;
}

if (blankStyle == undefined)
{
    blankStyle = app.activeDocument.characterStyles.add();
    blankStyle.name = "NoUnderline";
    blankStyle.underline = false;
} else
{
    blankStyle.underline = false;
}

for (a=0; a<app.selection[0].lines.length; a++)
{
    if (app.selection[0].lines[a].characters.item(-1).contents == " ")
    app.selection[0].lines[a].characters.item(-1).appliedCharacterStyle = blankStyle;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.