Skip navigation
Jack Snips
Currently Being Moderated

Using Nested Styles for Prices

Jan 3, 2013 8:31 PM

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

 
Replies
  • Currently Being Moderated
    Jan 4, 2013 4:34 AM   in reply to Jack Snips

    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)(\.)(\d{2})

    (?<=[$]\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.

     
    |
    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