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 June 6, 2008

WordPerfect Tips
Main tips page | Browse tips

Preventing long web addresses (URLs) and e-mail addresses from wrapping to the next line as a single block of text

Download SoftWrap.zip (v1.0; 08/05/02; 7,121 bytes) to automate this process on selected text

Web site and e-mail addresses normally don't have spaces in them, so WordPerfect treats them as a single block of text. Wrapping such long text strings can result in a large empty space left behind in the line above, or a wrapped address that is split in the middle of a component word. To prevent this from happening, use a hyphenation soft return [Hyph SRt] after each slash mark or double slash mark.

Note: In WordPerfect a hyphenation soft return is not a hyphen, it is a soft return placed where a hyphen would be inserted. If the line that contains these codes should break apart because of the length of the web site address (the URL) or the e-mail address, it will do so without adding a hyphen. As The Chicago Manual of Style's FAQ website at http://www.press.uchicago.edu/Misc/Chicago/cmosfaq/ (see under "URLs") explains:

Q. Have you established any rules for breaking Web addresses at ends of lines? I would be inclined to break at the slash where possible, with no hyphen (keeping the address intact), but what about the “dots”? Example: eic.edu.gov.on.ca/html/dsbmaps.html (I’ve got another one that’s a line and a quarter long!).

A. Your instincts are the same as ours -- when a URL must be broken over a line in a printed work, breaking after a slash is preferable (also break after a double slash). On the other hand, breaking a URL after a dot (leaving what looks like a period at the end of a line) might cause difficulties for the reader. It would be better to place the dot at the beginning of the next line. Using a hyphen to break a long word at the end of a line is not a good idea, since some URLs contain hyphens as part of the address; moreover, a hyphen that’s part of a URL should never appear at the end of a line. Further rules are as follows: break before a tilde (~), a hyphen, an underline (_), a question mark, or a percent symbol; or before or after an equals sign or an ampersand.

One easy way to do this -- and type in the slash at the same time -- is to create a small "slash macro." It will type a slash (or "stroke") mark followed by a hyphenation soft return. Then assign the macro to a keystroke combination (see below).

Either record the macro (manually type a slash, then click Format, Line, Other Codes, Hyphenation soft return), or write one with these commands in it:

Type("/")
HyphenationSoftReturn ()

Play it when you need a slash in a long web site address or similar. In the Reveal Codes window, you'll see something like this after the macro plays:  /[Hyph SRt]

From now on, if the block of text is too long to fit between its starting location and the right margin, it will automatically break after the slash mark.

For a macro that places a hyphenation soft return after all slashes (single or double) and ampersands (@), or in front of a period, tilde (~), hyphen(-), question mark(?), percent sign(%) or equals sign(=), download SoftWrap.zip.

Notes

1. This process works with dashes, too. For dashes, you can replace the slash in the above Type() command with a dash, inserted with Ctrl + W (but be sure to keep the quote marks if you are editing the macro). You might create two "dash macros" -- one for "m" dashes (the normal size dash) and one for "en" dashes (shorter, and useful for dates such as 1900-2000, etc.). These are part of the Typographical Symbol set (4,34 and 4,33, respectively).

2. To assign the macro to a keystroke combination (such as Alt + /) for easy access while you type:

  • Either select Tools, Settings, Customize, or right-click anywhere on the top menu and select Settings from the context menu that pops up.
  • Click the "Keyboards" tab in the Customize Settings window, then select the keyboard definition you are using (such as the <WPWin9 Keyboard>). Either click Copy to make a copy of the default keyboard and save it under a different name, or click Edit to edit the existing keyboard. The Keyboard Shortcuts dialog box will open.
  • Choose a key or key combination combination from the left-hand list (you can remove any current assignment if you don't like it, but unless you are working on a copy of the keyboard definition you may be better off choosing a key or combination that has no current assignment). Next, click the Macros tab on the right side of the Keyboard Shortcuts window, then click the Assign Macro to Key button. A file list window will appear. Browse for the macro you just created (and saved in your macros folder), select it, and click on the Select button.
  • Click OK until you are back to the main document screen.

Option: For the shorter "slash macro" above, you could simply modify the normal slash key's defintion to play the macro every time the slash is typed. You would always get a hyphenated soft return after a slash mark. Just check the "Allow assignment of character keys" in the Keyboard Shortcuts dialog; scroll down to the "/" key and assign the macro to it. (You can always remove the assignment later if you don't like the effect the macro produces.)