How do I create fractions in InDesign?

Digitip 075 – Adobe InDesign

InDesign out-of-the-box, does not contain a ‘Make Fraction” command, like other applications such as QuarkXPress have, so if you’re a Quark converter (Welcome a-board by the way!!!), how do you go abouts creating fractions in InDesign?

So how can setting fractions be made easier? Well, there are a number of options available. Let me take you through five different methods…

Option 1 – Use OpenType font with fraction support

Quite a few OpenType fonts you use a font such as Adobe Garamond Pro, which has really good fraction support, creating fractions is pretty easy. Type the fraction e.g. 1/2, highlight the text, then from the Character panel menu select OpenType > Fractions.

fraction_01.png

Alternatively, select OpenType > Fractions from the Control Panel menu or select OpenType > Fractions in the Character Style Options dialog.

If you regularly use this feature consider applying a shortcut to this comment, by choosing Edit > Keyboard Shortcuts, then select Product Area > Panel Menus and scroll down to Character:OpenType:Fractions, set Context to Text, seen as you’d only apply this shortcut when working with text and for instance choose shortcut Command+Shift+F (Mac) or Ctrl+Shift+F (Win). Click Assign, to add the shortcut to your shortcut set. If you’ve not yet created a new shortcut set you’ll be prompted to create a new set. Click OK to acknowledge the changes made and close the Keyboard Shortcuts dialog.

The advantage of using the OpenType Fraction feature, is that you can easily resize your text and the fractions will remain typographically correct. Something the “Make Fraction” command in QuarkXPress for instance doesn’t do, as it simpley resizes the text before and after the ‘/’ and amends the baseline shift when generating fraction.

Option 2 – Find/Change with OpenType support

Ok, so you’re using a OpenType font with fraction support. Yay!!!
With Find/Change you can to set your all fractions in one hit! Using the GREP feature, now, that would save some time.
Set Find what:
Wildcards > Any digit \d
that is Repeated > One or More Times \d+
followed by a slash-character \d+/
followed by another Wildcards > Any digit \d+/ \d
that is Repeated > One or More Times \d+/ \d+

Set Change to:
Select Found > Found Text $0

Set Change Format:
Style Options:
Character Style > fraction.

This fraction Character style, would just enable the OpenType Features setting for Fractinos.When using Superscript Position setting, you’ll have to have a bit of a play with the Edit > Preferences > Advanced Type, superscript Position and Size settings for the document to ensure you generate the best looking fraction for the font you’re using.

Next… click Change All.

fraction_04.png

Option 3 – Use a Script

You’re using a font that doesn’t support Fractions? Bummer… Naaaaah… not really… Dan Rodney developed a Proper Fraction script that helps you generate fractions. The Proper Fraction script is available in Free format as well as low cost Pro Script (that finds all fractions and formats automatically).

The Free Script allows you to highlight some text, then generate the fraction either by running the ProperFraction 2.0-Size DanRodney.js script which really replicates what the “Make Fraction” command in QuarkXPress does (e.g. reduce font size, set baseline shift). I’d vote for not using this particular script as it has the same limitations when text is resized later on.

fraction_02.png

The second sript ProperFraction 2.0-HScale-VScale DanRodney.js is a bit better in that it utilises a combination of horizontal and vertical scaling and baseline shift. Although text resizing is still an issue, due to the baseline shift, which Rodney acknowledges in his notes for the script, he also recommends the quick fix to use after resizing text, which is utilising Find/Change to correct the baseline shift values as required.

Option 4- Find/Change no OpenType support

Ok, you want to set fractions for your core body text and don’t want to pay for a script and are not using an OpenType font with Fractions support?

Well here’s one way of fixing things… still a multi-step process…

Let’s look at using Edit > Find/Change again… and use GREP once more…

Set Find what:
Wildcards > Any digit \d
that is Repeated > One or More Times \d+
followed by a slash-character \d+/

Set Change to:
Select Found > Found Text $0

Set Change Format:
Style Options:
Character Style > superscript.

fraction_03.png

This superscript Character style, would just set the Basic Character Position to Superscript and if I may recommend, also set the Kerning setting to Optical. If your text is formatted with an OpenType font that supports Denominator and Nominator font settings, then utilise the Nominator OpenType feature.

When using Superscript Position setting, you’ll have to have a bit of a play with the Edit > Preferences > Advanced Type, superscript Position and Size settings for the document to ensure you generate the best looking fraction for the font you’re using.

Next… click Change All.

Continue with the following Find/Change command:

Set Find what:
A slash-character /
followed by Wildcards > Any digit / \d
that is Repeated > One or More Times /\d+

Set Change to:
Select Found > Found Text $0

Set Change Format:
Style Options:
Character Style > subscript.

This subscript Character style, would just set the Basic Character Position to Subscript and if I may recommend, also set the Kerning setting to Optical. If your text is formatted with an OpenType font that supports Denominator and Nominator font settings, then utilise the Denominator OpenType feature.

When using Subscript Position setting, you’ll have to have a bit of a play with the Edit > Preferences > Advanced Type, superscript Position and Size settings for the document to ensure you generate the best looking fraction for the font you’re using.

Next, click Change All.

Ok, so at this stage you would have ended up with a document that has fractions looking like this:

fraction_05.png

What we really need to do at this stage is locate all the /-characters in the fractions and turn the default slash character to a “fraction slash”.

Set Find what:
A slash-character /

Set Find Format:
Style Options: Character Style > subscript.

What we’d like to do at this stage is change that slash to a Fraction Slash. We’ll have to discover what the Unicode character for that is.

fraction_06.png

For my font ‘2044’. We’re now ready to set the Change To settings.

Set Change to:
\x{2044} (use \x{nnnn} and replace nnnn with the Unicode).

Set Change Format:
Style Options: Character Style > [None]. (to remove the subscript style).
Basic Character Formats: Normal (to remove the subscript)

Change All…

Wow, that is a lot of steps to get some fractions set in your document.

Luckily InDesign comes pre-installed with the FindChangeByList.jsx script that allows you to perform multiple finds in ONE hit! So yes, you can perform all of the preceding tasks in a single hit.

Option 5 – FindChangeByList

The FindChangeByList.jsx script utilises a text file located in the InDesign CS3/Scripts/Scripts Panel/Sample Scripts/JavaScripts/FindChangeSupport directory, called FindChangeList.txt as way of setting a series of Find/Changes and applying them as a single command.

If you rename the default .txt file in this directory – which is the text file containing instructions the script uses by default – and create a new file called ‘fractions.txt’ somewhere, you’ll prompted to point to the .txt file that contains your Find/Changes when running the script.

Rather than typing out all of the previously set Find/Change settings (option 4), I’ve attached a sample .txt file for you to use, simply change your style names and the script will work for you too!

The one thing that you’ll have to do is to adjust your Preferences > Advanced Type > Character Settings for Superscript and Subscript to provide the best positioning and sizing for the core font you’re using.

Here’s a link to the fractions.txt file I’ve created as a sample for you.




Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This Post Has 18 Comments

  1. businesses says:

    Yet, there are grants that are made for equipment and training.
    When job offers do come and I’ll admit, some companies may fear hiring you because they fear a former owner
    being an employee, negotiate the best salary you can along
    with the best benefits you can for you and your family.
    When travelling, for instance, it would
    be possible to login to your accounting database and enter transactions on the road.

  2. Thanks a million Cari for such an extensive post on this subject.

    Cheers,

    Stephen

  3. Cari Jansen says:

    @Jodi you’re welcome. Glad this post was helpful. — Cari

  4. Jodi says:

    Thank you for this! I would never have figured out how to do the GREP find/change to fix my fractions, but following your directions this worked perfectly! (I used Minion Pro.)

  5. Matt Mayerchak says:

    Actually, in Option #2 above, if your typeface has the fractions built in, changing the setting for super/subscript in the preferences will not have any effect. OpenType fractions are not composed by super/subscripting, but by using the special numerator/denominator glyphs from the OpenType font set. This may not be true for all fonts, but it is the case for the ones I’ve seen.

    Applying Opentype Fractions is all you need to do if it’s a basic fraction like 7/8; but for anything beyond the x/2, x/4, x/8 fractions, such as 11/32, you need to apply a “numerator” character style and a “denominator” character style.

    • Cari Jansen says:

      @Matt I’m trying to remember why I added that for option 2 :-) it’s been 2 years since I wrote that post. I think it had to do with some OpenType fonts being limited in their fraction support. E.g. there are quite a few that when Fractions is enabled would not change 12/24 into a fraction. I might edit that post to make things a little clearer. The Find/Change inte last case you describe would work very much like option 4, but instead apply the num/den char styles :-)

  6. MM says:

    Never mind – I knew as soon as I asked I would stumble upon the answer. I was using the GID/CID code instead of the unicode. Now it works beautifully!

  7. Abhinandan says:

    Hi, I am new to Indesign and was wondering if someone can help. I import a lot of text from MS Word and at many places the language set is English US. I want to find and change it to English UK. I know I can just search and change it from the find change menu, but how can I add the same to my FindChangeList.txt file? Please help

  8. thunter says:

    Never mind – I knew as soon as I asked I would stumble upon the answer. I was using the GID/CID code instead of the unicode. Now it works beautifully!

  9. thunter says:

    Cari,

    I am trying to change text to a glyph, & I thought the fractions.txt file above would be exactly what I needed – especially the last line, changing a slash to a glyph fraction slash. But in my changeTo, it is not reading the backslash-u as the glyph unicode – it is actually inserting backslash-u and the unicode number.

    I’ve also tried using the {glyphID:##} in the change properties, as per your InDesign Magazine article (dog-eared copy lives on my desk). Does that only apply if your findType is glyph? I’ve tried it with findType set to text (since that’s what I’m searching for) and to glyph (since that’s what I’m changing to!).

    If I can just get this to work, it will save me so much time. Thanks for your help!

  10. Johan says:

    Hi,

    I like this article, but i was wondering. Is it possible to make fractions like people did on school?
    So no slashes, but with a horizontale division?

    Thx in advance

    Johan

    • Cari Jansen says:

      Hi Johan,

      To set fractions or rather equations at more advanced level, you’d probably be best off investing in a plug-in for InDesign that supports the setting of equations.

      [Math+Magic] from InfoLogic is a commonly referenced application that works well with InDesign. Another application that works with InDesign is MathType from Design Science.

      To decide which one works best for you and suits your particular needs, I’d suggest you trial both applications.
      InfoLogic also contains a comparison document comparing its MathMagic application with MathType.

      Cheers,

      Cari

  11. Dan Rodney says:

    Taco241… The free version of my Proper Fraction script has a default size that may work for certain fonts and sizes, but can’t be perfect for everyone. That’s why it can be changed! In the free script this can be edited by opening the script in a text editor (such as the ExtendToolkit included with the Creative Suite) and editing a value near the top. I commented the script fairly well so you should be able to find it.

    Of course the Pro version of my script has a nice Preferences window to edit this value. There are other things my Pro script offers such as the ability to search a whole document and convert all fractions. It can use OpenType formatting or it can use horizontal/vertical scale if not using OpenType fonts. If it must fake a fraction for non OpenType fonts it can apply a slight stroke to thicken up the numbers to match the weight of full size characters. Another benefit of my Pro script is that it can apply custom kerning to the number before and after the slash. For people that need to make a lot of fractions, I honestly haven’t seen a solution that offers as much flexibility with the ease of my Pro script. It does cost $75 so I know it’s not for everyone, but that is not much for all the time it can save someone that deals with lot of fractions.

    On another note, be careful when trying to Grep search fractions. You may also format dates accidently because they look a lot like fractions (think 1/11/2009). I know this because I had to program my Pro script to avoid formatting dates!

    Best wishes everyone! Dan

  12. Taco241 says:

    As an Art Director in the magazine industry, I do not like the ProperFraction script by Rodney. Although it does work, and I have used it, the fractions are not nearly as legible as they should be. They are simply too small and unbalanced for copy at or below 9 point size.

    I find importing fractions typed in Microsoft Word the better option.

  13. Boris says:

    Cari Jansen, hello!

    Try this script:
    http://adobeindesign.ru/wp-content/uploads/2008/11/find_change_by_lists.zip

    This script works with several lists of Find/Change

  14. Hello there,
    I am designing a 700 page cookbook and many of the fonts I want to use aren’t open type but do have some fractiosn built into the type: 1/2, 1/4 and 3/4. But if I need 2/3 and 1/8 etc, is there a way to create these and add them to the glyph palette with the rest, or do I need to run the scripts you have showed above?
    Thanks for you help,
    Rachel Pedersen

Leave A Reply