Copy link to clipboard
Copied
Hi,
I'm using quite a few fractions in a text, and I'd like to properly format them. I don't want to use the Proper Fraction script because it's no good --apparently-- if you change the font size, which I'm sure I'll eventually do. If I use the free version, then I'd have to redo all fractions manually, one by one.
The font I'm using does have denominators and numerators and the "fraction" option is available in the Open Type panel. But if I use it, the slash is properly changed but the numbers are unchanged. See below:
Right before applying the "Fraction" option that appears when I select the fraction:
Right after applying the "Fraction" option:
As you can see, the slash is fine, but the numbers are not.
Now, if I select each number individually, I'm able to modify them to get the proper-looking fraction:
I tried to add the proper fraction to the glyph panel by double-clicking on it, but no luck.
If I copy the proper fraction to the Search and Find box, when I replace an unformatted fraction, it only replaces the slah, the numbers are unchanged.
Now, is there any way to either create a brand new glyph for the fractions I need (5/16 and so on) or to "copy" the fraction that I properly formatted into the glyph panel?
Alternatively, is there any way to find&replace the unformatted fractions with the fraction I manually created?
Thanks!
I was able to replicate what I think you want using three character styles and one paragraph style. This is using the font shown in your Glyphs panel.
Numerator: \d+(?=/\d)
Fraction bar: (?<=\d)/(?=\d)
Denominator: (?<=\d/)\d+
Copy link to clipboard
Copied
Another approach is to add a GREP style to format fractions for you automatically. Add it to the paragraph style that contains the equations, and note that while it will correctly format 5/16, it will also match dates that are typed in using the same number slash number sequence, like today's date of 8/6 if they are included in the same paragraph style.
https://www.rockymountaintraining.com/adobe-indesign-cs4cs5-got-fractions/
~Barb
Copy link to clipboard
Copied
Hi Barb,
Thanks for the tips!
I did what you say in your guide, but no luck. First, when I type any fraction at all, they're not automatically formatted, not even the common ones such as 1/2 or 4/8. But if I select them, they're easily formatted as proper fractions. However, if it's an uncommon fraction, such as 5/16, only the slash is properly formatted, the numbers remain unchanged.
If I select any uncommon fraction and I apply the new character style I created following your guide, I get the same result: the slash is formatted, the numbers are not.
My guess is, the GREP style only formats the fractions that are currently in the Glyph panel, that is, the common ones. Any other fraction is unchanged.
Copy link to clipboard
Copied
This is entirely dependent on the glyphs included in the font you use.
You can assign Alternatives for Selection for common fractions if they are included in the font. Examples:
–OR–
As per the end of the blog post, for uncommon fractions with the GREP style, you must font with numerators and denominators. I am showing my Glyphs panel with the filter set to numbers. Minion Pro and Garamond Pro have them, Cabin Sketch does not.
~Barb
Copy link to clipboard
Copied
Barb,
Thanks!
As you can see below, the font I'm using has both numerators and denominators, and all the common fractions are available in the Glyph panel.
I don't know what I'm doing wrong, but I can't make this work.
Copy link to clipboard
Copied
I don't have that particular font so I can't test it on my computer. Can you try this to see if it is your GREP style? Change the font to one I know works. Minion Pro, Adobe Caslon Pro or Adobe Garamond Pro are available with your subscription from fonts.adobe.com.
If you change the font, do the fractions work? If no, it's an issue with the GREP style, which should be easy to resolve.
~Barb
Copy link to clipboard
Copied
Barb,
I tried a couple of Pro fonts, and the fractions do work. I then tried another couple of Pro fonts, including the one I was using before, and fractions do NOT work.
I must use this font for the project I'm working on. What would be my best bet to properly format fractions with this font? I'd be happy to send it to you, if you feel like giving it a try.
Thanks!
Copy link to clipboard
Copied
Well, that tells us that the font you are using is not going to work for the automatic fractions. Can you change the font for just the fractions and not the text that surrounds it? That can be built into the GREP style.
~Barb
Copy link to clipboard
Copied
No, I'm afraid I can't change the font for the fractions.
I do not mind replacing all fractions manually as long as it's doable via a script or something similar. That's why I wanted to build into the Glyph panel the fraction I did manually, but I couldn't find a way to set it to the panel. And the Find/Change function does not seem to work with a OPen Type manual fraction, either.
Copy link to clipboard
Copied
Ok. I understand. I'm not a scripter but let me add the scripting tag to your original question, which will alert those who can help. I wish you the best.
~Barb
Copy link to clipboard
Copied
I was intrigued by your question, and did a few experiments to see if I could duplicate your issue.
I set a series of fractions using various OpenType fonts at InDesign's default type setting of 12/14.4 (auto) pt.
I could, kinda, depending on the OpenType font I used to express my fractions:
I thought I was onto something when I saw that the "Pro" typefaces gave me the expected fractionals but the "Std" faces did not, then I tried Adobe Fonts' Kari Display Pro cut and it didn't set the expected fractional either. So I'm making the assumption (and we all know the bromide associated there) that it varies by the individual type cut, and not necessarily as a function of InDesign itself.
Not that things couldn't be fixed the old fashioned way with a little extra attention. It took a little lovin' — I set the numerator as superscript, then apply -200/1000 em negative kerning between the numerator and the slash; set the denominator as subscript, then applying Baseline Shift of +4 pt and negative kerning between the slash and the denominator of -50/1000 em negative kerning. That's a lot of work, and I couldn't get it to set as a glyph either.
But I could place it in a CC Library and drag a text frame containing the fraction onto the document. From there it was just cut and paste to put the fraction wherever I wanted it in a text thread. I also found that I couldn't use InDesign's Find/Change functions to make the swap; the dialog box offers the capability to search for many character style attributes, but OpenType attributes aren't among them. But I could use the Find function to navigate to the errant fractions, then paste my expected fractionals from the clipboard to replace them.
I'm hopeful that maybe you could use this info to "mess things up until they work right" for you. It'll take a little work, but at least you can make it easier than correcting each fraction from scratch.
Hope this helps,
Randy
Copy link to clipboard
Copied
Thanks, Randy, much appreciated.
A lot of hard work, indeed. I have way too many uncommon fractions --and too many of them-- to do this manually. That's why it's a pity the Find/Change panel won't allow to use the manual fractions to replace the remaining ones.
What I don't get is why a manually-designed fraction cannot be built into the Glyph panel. Not only that, I think it would be ideal to simply edit any existing fraction glyph to one's needs. Say, pick 3/8, edit it into 5/16, save it as a new glyph and then use it automatically in the text. Maybe it's doable, but I haven't found out how.
Copy link to clipboard
Copied
Then it might just come down to picking a font cut that will give you the fractions you're looking for ... Making the assumption (there I go using that word again) that you're looking for a sans-serif font, I can recommend either Myriad Pro or Source Sans Pro, two Adobe font cuts, that might serve your needs. If you'd consider using a serifed font, Adobe offers a number of cuts with OpenType Pro features.
Good luck,
Randy
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Nicely done, Scott!
~Barb
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Works wonders! Thanks a lot! Now the fractions appear automatically as I type them.
Could this be used in a script of sorts to automatically change a few hundred fractions? (hopefully skipping dates) Or is that wishful thinking?
Copy link to clipboard
Copied
Explanation…
Numerator: \d+(?=/\d)
Fraction bar: (?<=\d)/(?=\d)
Denominator: (?<=\d/)\d+
Copy link to clipboard
Copied
A number of Adobe fonts support arbitrary fractions. You could pick a font that matches your desired font as close as possible, then create a character style that applies the font to the text.
For more info: https://creativepro.com/downloads/OTFractionsGuide.pdf
Find more inspiration, events, and resources on the new Adobe Community
Explore Now