Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map | Donate

Barry MacDonnell's
Toolbox for WordPerfect

Macros, tips, and templates for Corel® WordPerfect® for Windows®
© Copyright 1996-2017 by Barry MacDonnell. All Rights Reserved.

Page updated Jan 31, 2014

Convert any typed fraction to super- and subscripted format like those created with QuickCorrect and the WordPerfect symbol set

Download FRACTION.ZIP (v1.02; 01/18/14; 17,905 bytes)

Compatible with WordPerfect 9 and later versions. The older version of this macro (v1.0) works in WP8 and is included in a separate ZIP download file, Fraction-WP8.zip (9,378 bytes). Users of WP9 and later should use the newer version above.

WordPerfect 11 users: See important information about using macros in the first release of WP11 (11.0.0.233) at the top of this page.

Downloading, Documentation, Modifications, and Support

Purpose

This WordPerfect 9+ macro automatically converts any typed fraction (e.g., 15/100) to a super- and subscripted number. (WordPerfect 8 users: See left sidebar for the early version of this macro.)

Fraction.wcm produces fractions very similar in appearance to those in the WordPerfect symbol set: 1/2, 1/3, 1/4, etc. That is, the fractions will be similar to the small set of fractions that are created with QuickCorrect (if turned on with Tools, QuickCorrect, Replace words as you type) or that can be inserted with Insert, Symbol (or Ctrl+W), Typographical Symbols.

This example compares "1/200" after it was converted by the macro, and "1/2" after it was automatically inserted as a WordPerfect symbol by QuickCorrect:

Fraction examples

See Advantages below.

Instructions

To use it, either -

(A) type the desired fraction (without a following space) --
e.g., 1 5/8 (one and five-eighths) -- and play the macro;

or -

(B) place the cursor on an existing typed fraction -- or just after the last number of the fraction -- and play the macro.

Note

QuickCorrect fraction symbols or fractions inserted with Insert, Symbol (or Ctrl+W) are not the same as typed fractions, so the macro will not convert them if it sees them at the cursor location.

If you type the fraction ((A) above), don't add a space or other character immediately after the last number. While WordPerfect's QuickCorrect requires this, the Fraction macro does not require it (and will not convert the numbers to a fraction if you type a following space just before playing the macro). If there is a following space, you can move the cursor back to (or on top of) the fraction before playing the macro (#2 above).

For compound fractions (i.e., mixed numbers), such as 1 ½, type a normal space (i.e., not a hard space) between the whole number (the integer) and the fraction. The macro needs to know where the fractional part of the number begins, and the space does that. (See also the Tips below about automatically removing this space, if desired.) Typing a hyphen after the integer is okay (in WP9+):

Advantages

•  Any typed fraction can be converted -- 1/2, 3/4, 10/250, 10 5/16, 12-1/32, etc.

Notes and related tips

¤  In contrast to the Fraction macro, WordPerfect's QuickCorrect depends on a small set of built-in fraction symbols: 1/8, 1/4, 1/3, 3/8, 1/2, 5/8, 2/3, and 7/8 (but curiously, not 3/4).

¤  WordPerfect's own fraction symbols can be used automatically by QuickCorrect (assuming it is enabled) when you type one of the fractions that is also in the symbol set (assuming the symbol has been included as an entry in the QuickCorrect list). They can also be inserted with Insert, Symbol, Typographical Symbols. If they are used in a document, they can be seen in Reveal Codes.

¤  These WordPerfect symbols will not be converted by the Fraction macro; instead, you must use typed fractions in the document if you want the Fracion macro to convert them.

¤  Since the Fraction macro can convert any typed fraction, you might wish to remove the aforementioned fraction symbols from the QuickCorrect entry list: Click on Tools, QuickCorrect; then highlight (left click on) the entry; then click Delete Entry.

•  The fraction produced by the macro more closely resembles the fractions created by WordPerfect's QuickCorrect than if you simply used superscript and subscript formatting (i.e., Format, Font).

For example, the denominator "sits" on the text baseline when you use this macro, rather than below it. You can see this more exactly if you increase the document's View, Zoom setting (or simply hold down the <Ctrl> key while you rotate the mouse wheel).


•  The macro can convert an existing fraction elsewhere in the text as well as the one just typed, with no need for a menu or other dialog. Just place the cursor on the existing fraction and play the macro.

Note that the existing fraction must have been typed; a WordPerfect symbol fraction (see Notes above) will not be converted.

Tips

☼  On some monitors at certain screen resolutions, the fraction may appear too small or "cramped". Try a test printout and see if the macro produces an acceptable printed fraction. The fraction looks best at font sizes in the range of about 10-14 points. With font sizes outside this range you may want to adjust the vertical and horizontal advance commands in the User Modification Area of the macro's code. There, you can also remove the [Small] relative font size attribute if you want the fraction to appear in normal size text.

☼  The macro can be assigned to a toolbar button or keystroke combination for easy access while typing.

☼  You can set an option in the redlined User Modification Area of the macro's code to have the macro automatically remove any spaces between a whole number and the fraction. You can also have the space replaced with a regular hyphen or a hard hyphen. (See limitations below.)

    Known limitations and workarounds

    •  Numbers with commas (e.g., 1/1,000) or other text (e.g., 1/1000th) will not be converted since the macro does not see them as fractions.
        Workaround:
    Convert the fraction first, then add the comma or other text to the converted fraction.


    •  If you choose the option in the
    User Modification Area of the macro's code to remove spaces between any whole number and the following fraction (e.g., the space between 1 and 3/4 in a number such as 1 3/4), and there are format codes already applied to the whole number or the fraction, the macro will not remove the spaces or may otherwise become confused. (It cannot anticipate every possible thing you might do to format the item.)
        Workaround: Use regular spaces (press the <spacebar>) between the whole number and the fraction, and without using additional format codes.


    •  Playing the macro a second time on a mixed number (an integer plus a fraction) where the space between the integer and the fraction has been (1) removed or (2) replaced with a hyphen can produce erroneous results: In the first case the integer and the numerator will be combined; in the second case, the integer might be bolded (if bold was used in the fraction). However, if an intervening space or hyphen is present, the macro should work properly no matter how often the macro is played on that compound fraction.

    •  Typing a fraction on the first line of a Header, Footer, Watermark or Text Box will cause the denominator of the fraction to display slightly below the baseline. This is apparently due to the way these items are structured.
        Workaround: You can add a vertical advance code (with Format, Typesetting) at the beginning of the first line in these items to move all text down a fraction of an inch (try 0.02") to compensate.


    •  The macro does not work in footnotes (but it does work in endnotes).
        Workaround: You can cut-and-paste a converted fraction (with all its format codes) into a footnote.