• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

GREP to remove a space after tab

Participant ,
Feb 06, 2024 Feb 06, 2024

Copy link to clipboard

Copied

I have a long document imported from a word doc. In the footer, sometimes there is a space character after the tab (shown in screenshot below).

Is there a way to add aGREP expression to the footnote paragraph style so it automatically deletes those, or would I have to do a find/change right at the end to get rid of them?

 

danielw42205661_0-1707280320672.png

 

TOPICS
How to

Views

143

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 06, 2024 Feb 06, 2024

Copy link to clipboard

Copied

LATEST

A GREP expression in the footnote would only serve to 'compress' the space but the space would still remain - as GREP expressions in styles cannot replace text. 

 

A find/change to tidy things up at the end is normal. 

 

You can find it by using 

\t\K\h

 

\t is a tab

\K is to ignore this

\h is any horizontal space character

 

instead of \h you could use a normal spacebar press instead

 

You can refine it more by only searching footnotes

 

You could add a ^ to target start of a sentence if the sentences are autonumbered

^\t\K\h

 

if not autonumbered and manully inserted numbers then

^\d+?\.\t\K\h 

 

You could set the Find Paragraph style to 'Footnotes' if you're using a Paragraph Styles for your footnotes.

 

Ultimately - you can do a blanket search like mentioned first - but might target areas where you have 2 tabs in a row.

 

I'd be ultra-careful and check a bunch before doing a Replace All

or just go through 1 at a time to ensure you're getting them all.

 

------------------

If you're happy to just compress the space and use a GREP expression in the Footnote Style

Then set your space after the tab to a Negative Tracking or a Horizontal Scale - select the space and create a new Character style and call it's 'compress tab space' or something familiar for yourself.

 

Then in the footnote Paragraph Sytle go to the GREP expression

 

Character Style (the one you just created)

\t\K\h

 

(or instead of \h a normal space)

 

And then the space will compress like you setup for the style - and can be controlled via the Character Style. 

 

This of course means if copy and pasted to another document the space would still be there.

For example, copying from PDF to Word, maybe, or copying from InDesign to another application or text editor.

 

------------

I usually do a comprehensive GREP search at the end of most documents to remove unwanted things etc.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines