GREP help requested
Learn / Forums / General InDesign Topics / GREP help requested
Tagged: grep style
- This topic has 3 replies, 3 voices, and was last updated 8 years, 3 months ago by Chris Court.
-
AuthorPosts
-
-
December 11, 2015 at 9:50 am #80127ToddMember
I’m starting to learn GREP styles and have a problem with one I can’t figure out. On the first line of a copy block, I have a price followed by a space followed by a descriptor (like SALE, EACH, etc.) that could be one or more words and could include punctuation. After the first line, there is more copy for the product description, etc., but none of this requires a GREP style; only the price line does. There are five character styles to be applied within the price line: DOLLAR SIGN (to superscript the dollar sign at the start of the price), DISAPPEAR (to make the decimal point seemingly vanish), DECIMALS (to reduce the point size and baseline shift the decimals of the price), BUFFER SPACE (to track the space after the price to tuck the descriptor under the superscripted decimals of the price), and DESCRIPTOR.
My problem is with the GREP style for the descriptor. I need all the characters in the descriptor (including spaces and punctuation) AFTER the buffer space to use the DESCRIPTOR character style. I can get the words to work by using \u|\l, but then the punctuation is unchanged. Using \w or . messes up the other character styles.
Here are my GREP styles for the other character styles:
DOLLAR SIGN: \$
DISAPPEAR: \.
DECIMALS: (?<=\.)\d{1,2}
BUFFER SPACE: (?<=\d)\sAny and all help is greatly appreciated. Thanks in advance.
-
December 12, 2015 at 10:12 am #80134Peter KahrelParticipant
I think the problem is the order in which you apply the GREP styles. Start with the descriptor, applying your style to .+$
Then do the other parts. The effect is that the descriptor style is applied to the whole paragraph, then the dollar sign, disappear, etc. styles override the descriptor at the beginning of the paragraph.Peter
-
December 14, 2015 at 12:54 pm #80167ToddMember
Peter, thank you very much for your help. I moved the DESCRIPTOR style to the top of the GREP styles, tweaked the DESCRIPTOR code a little (to include punctuation and spaces), and now everything works perfectly. Thanks again! :D
-
December 16, 2015 at 5:30 am #80231Chris CourtMember
Fan of inDesign GREP that I am, this seems to me to be an ideal use-case for nested styles. Am I missing something?
C
-
-
AuthorPosts
- You must be logged in to reply to this topic.