1 Reply Latest reply on Jan 4, 2013 4:34 AM by Peter Spier

    Using Nested Styles for Prices

    Jack Snips

      I wish to easily plug in Prices and have them automatically edited to fit the style I want.


      For example:  If I typed $3.59. . . .I would want it to show up as Price.jpg automatically.


      I am mainly concerrned with being able to apply Superscripts and Subscripts and erasing the decimal.


      A step-by-step explaination would be amazing!


      Thank you,


      - Jack

        • 1. Re: Using Nested Styles for Prices
          Peter Spier Most Valuable Participant (Moderator)

          Sorry, you can't do this with styles. Styles can change formatting of text, but cannot add or delete. For that you need to run find/change.


          You can search for (\.)(\d\d) and replace with $2 and set the change format to your superscript (probably with a local override rather than a style, as will become clear in a moment). It would be nice to limit this to only prices by adding a lookbehind for the dollar sign and dollar amounts, but lookbehinds cannot have varable length strings, so you would have to do one for each possible number of digits, like this:




          (?<=[$]\d{2})(\.)(\d{2}) for 0, 1 and 2 digits in front of the decimal.


          You'll need a second query to add the "ea" if you don't type it, probably find \d with the find format set to superscript and change to $0ea This will leave the "ea" also in superscript, so you'll need a second query to fix that: (?<=\d)ea with the find format again set to superscript. Leave the change field blank and set the change format for normal position.


          All of these queries can be chained together to run in one operation using tools you'll find at http://www.kahrel.plus.com/indesign/chain_queries.html


          I WOULD use an ordinary nested style, however, to style make the prices large and orange. That would be None up to 1 $ and then your big orange style through 1 word (this may at first only make the $and dollar portion of the price big and orange, but once the decimal point is removed it shoould fix itself. If you add a space before the "ea" you'll need to apply the style through 2 words.