Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Nobody likes dealing with fractions in text but typesetting fractions doesn't have to be a pain. I created a plug-in, part of my Blatner Tools Suite, that automates formatting fractions. But I am just going to show you how you can do it manually in InDesign using the tools you already have. The key to making fractions easy in InDesign is having the right font. Some fonts have fractions built right into them, so it's easy to swap out a fake fraction for a real one. I am going to double-click on this to switch to the Type tool and then I can select that fraction and I can see that this font is Chaparral Pro.
Chaparral Pro is one of Adobe's Pro OpenType fonts, which has lots of fraction functionality built into it. So to turn this fake fraction into a real fraction, I will go to the right side of the Control Panel, all the way over here to the Control Panel menu, choose the OpenType submenu, and then choose Fractions. That's all it takes and it looks much better. So this is great. Really easy, unless you happen to have about 500 of these fonts throughout your document, you would not want to choose that menu 500 times.
So let me show you a trick to how you can turn these fractions into good looking fractions really quickly. Let me undo this with a Command+Z or Ctrl+Z on Windows, and instead, I am going to go to the Paragraph Styles panel, double-click on the Paragraph Style and I am going to build a GREP Style into this paragraph style. GREP Style is not that hard, it's not going to hurt, and here is how it woks. First, I am going to click on New GREP Style. That creates a new rule. Now the basic idea of GREP Styles is that it's going to search for a particular pattern and text, and the pattern we're looking for is a fraction, something that looks like a fraction, and it's going to apply a character style to whatever it finds.
What character style do you want it to apply? Well that's what we choose right here. I will click on None and I will choose a character style from this pop-up menu. We don't have a fraction style yet, so I will choose New Character Style and I am going to call it fraction. All this character style is going to do is apply the OpenType feature called Fractions, just like pulling it out of that OpenType menu. I will click OK and now we need to type the GREP code for finding a fraction. Here is how it works.
Click on this code down here to highlight it and then type this code, \d+, it actually already typed that for me, followed by a slash and then do the same thing again; \d+, just simple as that. That code really means find one or more digits followed by a slash, followed by one or more digits. That wasn't that hard, was it, because that's exactly what we're looking for; one or more digits, followed by a slash, followed by one or more digits. When I click OK, you will see that every fraction in this paragraph style gets turned into a real fraction.
I see one problem here that's really bugging me, and that is, some of these fractions have spaces before them between the main number and the fraction. I am going to get really geeky here with GREP Styles to get rid of that space. I will go back to my GREP Style pane, I am going to create a new GREP Style and this GREP Style is going to apply a new character style called Disappear. I like using the disappear character style whenever I want something to disappear in my text, in this case, I want that space to go away. And in order to make the text disappear, I change the size to about 1 point, I change the color to None, so it really disappears no matter what it is, and I usually go in here and change the Horizontal Scale to maybe 1%.
I am going to apply that Disappear style to anything that is a space, of course it can't just be any space, because all my spaces would disappear. I want it to be a space, so I just removed that code there and I just typed a space, and it only has to be a space that's followed by a fraction. Here's how we do that. I am going to go out to my @ sign pop-up menu, I am going to scroll down here to Match, and then I am going to choose Positive Lookahead. Again, that sounds scary, but all it really means is, look for a space that's followed by something.
It needs to come after that equal. What is it looking for? Well, I need to specify a fraction, right? So I am going to grab that text up here, copy it, come down here, and paste it, and now I am done. It's going to apply the Disappear character style to every space that's followed by a fraction. Let's try it out. I will click out here to make it take effect, I will click OK and we can see that all those spaces disappeared before the fraction. Of course, this space disappeared as well, so I think I made a little mistake there, I better fix that.
Let's go back and say this is going to be a edit to the GREP Style. I need to change this, so it's a space that's followed by a fraction and comes after a number. So I better go in here and say this is going to be a Match > Positive Lookbehind, so look behind a space, and it has to be a number which is that \d, let's try that. Click OK, ah! Now that's much better. If the space comes after a number and is followed by a fraction, the space disappears, but, if it's just a number, a fraction with outer number before it, the space stays.
Now as I said earlier, some fonts have fractions built in and some fonts don't. So what happens if I have to change my font? I will change this section blurb paragraph style to something else like Times, and all of a sudden, we'll see that this doesn't have fractions built into it. Now we're going to have to build those fractions manually in this kind of font. I am going to show you a way using character styles so it's repeatable and easy. I am going to create one character style for my numerator and a different character style for the denominator.
Let's start with a numerator. First, I am going to create a character style by Option or Alt+Clicking on this button and I am going to say this is my numerator. I could change the size of this manually, but instead, I prefer to change it based on the horizontal and vertical scale. That's because as the text around it gets bigger or smaller, the fraction will get bigger or smaller too because it's all based on the scale. I usually like my fractions a little bit wider than they are tall. So I will set this to a Horizontal Scale of 70 and a Vertical of 60, but it's completely up to you.
Use your judgment based on what font you're using. I will set this Baseline Shift of let's say 4. I also like giving the numerator and the denominator a stroke, just a little stroke. In fact, I am going to set this to black and just a tenth of a point here, just to give it a little bit of weight. That way it will match the text around it a little bit better. I will click OK and then apply that to the text. Now we'll do the denominator. I will select the 2, create a new style, I am going to base this on the numerator, but I am going to call it denominator.
This is going to be slightly different because of course it will not have a baseline shift. There we go! I have set the numerator and the denominator and I've applied it to the text. Now I need to change this middle character from a regular slash to a true fraction bar. Let me zoom in here so we can really see what's going on. I am going to press Command+4, or Ctrl+4 on Windows to go to 400% and I am going to type Option+Shift+1 or Alt+Shift+1 on Windows to get a fraction slash, not the regular slash. Now that took a lot of work, creating those character styles and applying it to one fraction but the good news is, once I have them, it's easy to apply those using GREP Styles or manually, simply by selecting the text and applying the character style.
There is my numerator, there is my denominator, and there is my fraction bar. Now if you have to use these non-OpenType fonts, or fonts that don't have fractions built into them and you have a lot of fractions, I really would recommend using Blatner Tools at blatnertools.com. But for most people, if you don't have too many fractions, these manual techniques will really be all you need.
Get unlimited access to all courses for just $25/month.Become a member
119 Video lessons · 47415 Viewers
117 Video lessons · 34392 Viewers
113 Video lessons · 80284 Viewers
116 Video lessons · 70203 Viewers