1 Reply Latest reply on Nov 6, 2012 8:17 AM by Jeffrey_Smith

    Adding 100 Kern either side of /

    BlueFunk74 Level 1



      A few weeks back I wanted to search through my document and find all em dashes and remove any spacing either side, and add 100 kern, and I got the following brilliant answer,


      You cannot do this in one step, I think, but you can use the following to find and remove whitespace around the dash in the middle of a line:

      Find   (.)\s*(~_)\s*(.) and change to $1$2$3


      This will not work, though if the dash starts or ends a paragraph because the \s wildcard picks up the paragraph return and will delete it. If you need to include thoses cases, you'd need to build a class for the spaces instead of using the wildcard.


      The reason you need to use a second step is that you only want to change the kerning betweeing the dash and the surrounding characters, and not change the kerning on the third character itself. Also you can't assign a kerning value via find/change/ so you have to settle for assigning None to kerning and adding a tracking value to simulat the kerning you want, in this case 100. If you were to apply that to the whole found string from the first query it would also space out the two characters following the dash.


      So now Find .~_ and in the cahnge formatting section under basic text formatting set kerning to None and tracking to 100. You can leave the change field blank.


      Now I want to do the same, not with the spacing, but just locate all '/' within the document and apply 100 kerning either side. Can someone recode this script to enable me to do so please?


      Thanks in advance



        • 1. Re: Adding 100 Kern either side of /
          Jeffrey_Smith Most Valuable Participant

          For this particular search, I would create a character style with 100 pt tracking as the only attribute applied. Then you could do a GREP search, find: ./ and replace with $0 including change format to new character style.


          But this could be done with a simply text search: find / and replace with ^>/^>   , where ^> is a thin space and is pretty close to 100 pt kerning. Also when you are composing your search and replace queries, use the flyout for the codes necessary for the various White Space, i.e. hair, sixth, thin, etc.