Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Paragraph Style with auto fractions and normal integers

Return to Member Forum

  • Author
    Posts
    • #57038
      Chuck Nigash
      Member

      I thought I had seen this in a Lynda tutortial but maybe not. I have an OTF font that allows fractions to be automatic (when checked). However, when a user enters another integer, i.e. 45, the numerals are also small just as the fractions were displayed. Is there a combination of Paragraph Styles settings that offer us arbitrary fractions (6/128 for instance) as well as normal-size numerals?

      I have already executed the character-style workaround for this, but I am looking for something more efficient. The character style workaround is to take a font that allows for fractions and save that parameter (OTF > Fractions), then apply it to each instance within the paragraph style. But it's my hope that it can be all done within the Paragraph Style.

    • #57046
      kfhking
      Member

      From what I recall i did see it in Lynda.com tutorials but they use the character styles to fix this problem. To make this a much fast you should use the find and replace GREP tool to apply the style to the need parts of the text.

      For Example to a find all fractions:

      d+/d+

      Will find the fractions then at the bottom change the style.

      Hope this is useful

    • #57047
      Chuck Nigash
      Member

      Hrumph! I set that up and tried it but it returned a zero.

      Find: d+/d+

      Change: d+/d+

      Find format: Ch Style = any style, Prgh Style = Basic Para (you'd normally input your desired style)

      Change format: Ch Style = fractions, Prgh Style = Basic Para (you'd normally input your desired style)

      kfhking, did you get a positive result?

    • #57048
      Chuck Nigash
      Member

      Here is what I've tried. We need a GREP wizzard. :-)

      d+[/] will find something as weird as 1024/

      d+[/]+d will find 1024/1 but it wont find 1024/128 for instance. Getting the GREP to look to the end of the last digit is the key.

      I experimented with Positive Look Behind among other Matches, but did not find a good result.

      I also experimented with undocumented GREPs such as p{decimal_digit_number} for digits 0 to 9 but that had no impact as well. That is not capturing whole numbers such as 1024. The GREP must capture all the digits so we can convert them to the character style and create the fraction.

    • #57049
      Chuck Nigash
      Member

      It is interesting to follow this post and ironic. I have included the all-important backslash key as did kfhking. But the web template here on InDesign Secrets is knocking it out and it significantly alters how you code.

    • #57050
      Chuck Nigash
      Member

      Nailed it ! ! !

      d+[/]+d* is the equation you want.

      It will find any digit, add the forwardslash character in the mundane fraction 123/190 for instance, find any digit again and Repeat Zero or More Times, thus capturing the last digits.

      Guys, I've tried editing the html to show, visually, the backslash-d code (twice) in the GREP, but it's not sticking. Additionally, upping an image doesn't seem possible if the image does not have a URL. I hope anyone who follows this thread puts this together.

    • #57052

      Odd. d+/d+ appears to work just fine …

      You really shouldn't be using your d+/d*, because that will match 1024/ — since the asterisk stands for zero or more characters … But perhaps the Opentype coding in your particular font is protecting you against this. The below image is Minion Pro:

      You must keep in mind the “Fraction” Opentype feature isn't really strictly defined, and may well work quite good in one font (when done by a good Opentype-savvy designer) and not-at-all in other fonts. There are long discussions on 'how to write good Fraction code' on Typophile, but actually implementing all that code is left to the designer.

      (Double backslashes show up as one. Be careful when editing, because then they'll be single ones and you'll have to double them before re-posting. I dunno about the images, I can upload one if I want to. It's possible David rigged that up for me ;-) )

    • #57053

      Aside, Chuckie:

      Find: d+/d+

      Change: d+/d+

      (with backslashes in the most likely positions) Nope :-)

      GREP codes only are there for finding, not for replacing. Either type any replacement text, or use a special code for 'what was found' in the Replace field. The code '$0' will insert the entire found item, and, when working with parenthesized groups in the Find field, you can use $1, $2..$9 to move them around or insert stuff between them. In your case I'd say every occurrence of a fraction would have gotten replaced with the literal text “d+/d+”, but your comment says it didn't work at all, which is A Bit Strange.

      If you only want to apply formatting to found text, you don't even need '$0'. Just make sure the Replace field is empty. And, of course, provide some formatting, or else the text will get replaced with nothing.

    • #57054
      Chuck Nigash
      Member

      Jongware, I'll try other fonts and see if it's a consistent solution all around. But for at least 8 of my clients, this is going to give them a global switch & replace rather than a fraction by fraction input of a char style. I'll keep my eyes posted to see if anyone will throw in something even easier.

    • #57056
      kfhking
      Member

      Sorry to take so long, to reply i tried it before i posted it the first time.

      [backslash]d is a single digit wild card example “5″

      [backslash]d+ is any number of digit wild card example “2589″

      / is /

      so it should work i used it it use to find the fractions

      [backslash]d+/[backslash]d+ should return all fractions

      i use indesign cs 3 i dont know if they changed the GREP in the new versions

      i just relize it did not have any [backslash] in the original post!

      Jongware how do you include backslash

    • #57058
      Chuck Nigash
      Member

      It appears Jongware bypassed the brackets and it worked for him. “d+/d*” I used [/] … “any character”

    • #59686
      Anoop Patel
      Participant

      or you could just install this GREAT TIMER SAVER script https://www.danrodney.com/scrip…..ction.html

      hope helps :D

    • #59688
      Tim Hughes
      Member

      But using a grep style means the fractions happen on the fly and no script ever needs to be run, plus the grep style is not $75.

Viewing 12 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads