Skip navigation
Currently Being Moderated

How to style text that is enclosed in space characters

Mar 21, 2013 11:28 AM

Tags: #cs5.5

Via a paragraph style sheet, I need to apply character styles to text that is enclosed in space characters.

 

 

For example:

The cat <<thinspace>> sat <<thinspace>> on the <<enspace>>mat<<enspace>>

 

In the above, "Sat" would have one character style while "Mat" will have another.

 

What's the best way of doing this?

 

I know Indesign has GREP styles but that doesn't seem to work to text enclosed in space characters.

 

Also the only reason I am using space characters is because they are invisible when printed.

Is there any other method for wrapping text to mark it out as needing to be tagged with a style?

 

 

Thanks!

 
Replies
  • Currently Being Moderated
    Mar 21, 2013 12:38 PM   in reply to big_smile

    I don't know why you think a GREP style won't work...

     

    Did you try (?<=~<).+?(?=~<) and (?<=~>).+?(?=~>) to find text strings (shortest match) between thin and en spaces, respectively?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2013 1:08 PM   in reply to Peter Spier

    There seems to be a bug here. Peter, I tried the same styles you did, applying them in the Paragraph pallete, and they had no effect at all. Then I used the styled paragraph to create a paragraph style containing the grep styles. Suddenly they worked. Select same paragraph and "break link to style" in the paragraph style panel, and the grep styles will no longer apply (even though they still show as being there.)

    Screen shot 2013-03-21 at 4.02.12 PM.pngScreen shot 2013-03-21 at 4.02.49 PM.png

     

    The difference in the formating of these two is that one on the right is set up in a paragraph style, and the one on the left is set through the paragraph pallet.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2013 1:29 PM   in reply to SRiegel

    I think you may be right about a bug in CS6. It appears to work as expected in CS5 where I tried if first, but not in CS6. I suspect if one knwo the unicode values for the spaces they could be substituted in CS6 for the metacharacter and that might work.

     

    Where's Jongware when we need him?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2013 1:34 PM   in reply to Peter Spier

    I don't think the code for the spaces was the problem. I tried a couple of other grep styles, and none of them worked when applied through the paragrah pallet.

    They all worked exactly as expected when applied as part of a paragraph style, including the one in my previous post.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2013 2:24 PM   in reply to SRiegel

    Sorry, misunderstood you, and I just went back and retyped the thin spaces in my sample text (I'd used copy/paste from CS5 and apparently they didn't come through correctly) and suddenly it worked, both as a GREP style in the paragraph style, and as a GREP style applied as local formatting -- something I just learned could be done from your post.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2013 2:55 PM   in reply to big_smile

    Would non-joiner characters surrounding target words work for you? In the GREP style dialog box in the paragraph style panel, the non-joiner is under the @button > Other. Non-joiners take no space and do not print.

     

    If there's a collection of words that need a specific character style for specific words, you could define each GREP action with @Locations > word boundary before and after the word. If there are many words in the collection, with many GREP style clauses, performance could slow.

     

    HTH

     

     

    Regards,

     

     

    Peter

    _______________________

    Peter Gold

    KnowHow ProServices

     

    big_smile wrote:

     

    Via a paragraph style sheet, I need to apply character styles to text that is enclosed in space characters.

     

     

    For example:

    The cat <<thinspace>> sat <<thinspace>> on the <<enspace>>mat<<enspace>>

     

    In the above, "Sat" would have one character style while "Mat" will have another.

     

    What's the best way of doing this?

     

    I know Indesign has GREP styles but that doesn't seem to work to text enclosed in space characters.

     

    Also the only reason I am using space characters is because they are invisible when printed.

    Is there any other method for wrapping text to mark it out as needing to be tagged with a style?

     

     

    Thanks!

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2013 5:08 PM   in reply to peter at knowhowpro

    Peter Spier wrote:

    Where's Jongware when we need him?

    Working?

     

    I cannot find anything wrong with the proposed styles in CS6, whether defined locally or in a style. Perhaps there was some invisible error in the original GREP style -- say, something like a space at the end.

     

    I agree with Peter, though, that you might want to try other codes. Because

     

    Also the only reason I am using space characters is because they are invisible when printed.

     

    that's not .. entirely true. Sure, you cannot see any markings on paper (or screen), but you can see the space between the words is smaller and larger!

    But you don't have to restrict yourself with 'invisible' codes; you can use this trick to emulate a HTML-like styling: http://indesignsecrets.com/using-grep-styles-to-format-html-code-in-in design.php

     

    A big advantage is that with a click of a button, you can make the 'invisible' codes visible again. Just disable the GREP style that hides the codes or edit its character style.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points