|
Hyphens, hard hyphens,
soft hyphens, hyphenation soft
returns, and hard spaces . . . what
they are and how they work
Related pages -
Using "Other
Codes" in WordPerfect (Format > Line > Other Codes)
Edit > Paste Special
> Unformatted Text helps solve formatting problems when copying
blocks of text or macro code from the Internet or between WordPerfect
documents |
"Hyphenation divides words
that span the hyphenation zone, a narrow area
that surrounds the right margin of a document. You can enable
automatic hyphenation [see below]. You can
also change the width of the hyphenation zone. Increasing the
hyphenation zone hyphenates fewer words, and decreasing the hyphenation
zone hyphenates more words. As well, you can create a nonbreaking
["hard"] hyphen." [- Corel WordPerfect X3 Help file.]
There are four forms of hyphenation in
WordPerfect:
- A hyphen is what you get when you press the "-"
key next to the "0" (zero) key. In Reveal Codes, it
produces a [- Hyphen] code. Words containing hyphen codes will
wrap at the hyphen to the next line. This type of hyphen is often
called a "regular hyphen" to distinguish it from the
other types below.
- Note:
- Sometimes WordPerfect's hyphens do not translate
to another program, so in those cases you may want to use hard
hyphens (next item below) in the source document instead of regular
hyphens.
- When you use Find and Replace to locate a
hyphenated word or number, you must use the same type of hyphen
in the Find and Replace fields as exists in the item to be searched
in the document. Hence, to find a regular hyphen, the item must
contain regular hyphens (i.e., codes). To find hard hyphens (see
next section below), the item must contain hard hyphens (which
are characters, not codes).
- Macro writers:
Searching for a word or phrase containing regular hyphens (i.e., [-Hyphen]
codes) stored in a variable causes the hyphen codes to be converted
to hard hyphens. Therefore, to use SearchString() in a macro
to find such an item, you must first use StrTransform() on the
variable to transform the regular hyphen code into something the macro can use. See the example in Footnote 1. Other
examples: See the code in the PageLine
macro in the Library. See this post at WordPerfect Universe,
here,
which demonstrates a macro that searches for two hyphens and
replaces them with an en-dash (or em-dash).
- A hard
hyphen (or "character hyphen"
or "non-breaking hyphen") is what you get when you
click Format, Line, Other codes, Hyphen character, or simply
press <Ctrl+hyphen>. It acts like any other "real"
keyboard character (a,b,c,1,2,3, etc.); therefore, it doesn't
produce any code in Reveal Codes (the hyphen you see there is
a text character, not a code). It is often used to "glue"
compound items together such as dates (2000-2003) or part numbers
(123-001) so that part of the item won't wrap to the next line.
It also can be useful to ensure that hyphens are translated as
hyphens in some other programs.
- Assign "Hyphenation
Character" to the <Ctrl+hyphen> keys, if it is not
already assigned to them.
(See
the tip below.)
- When you use Find and Replace to locate a
hard-hyphenated word or number, you must use hard hyphens (not
[-Hyphen] codes; see above section) in the Find and Replace fields.
- A soft
hyphen divides the word with a hyphen
only when the word spans the hyphenation zone,
a narrow area that surrounds the right margin of a document.
This can be done automatically (see Tools, Language, Hyphenation
to turn automatic hyphenation on and to adjust the zone) or you
can insert a soft hyphen manually wherever you decide
you might need one with Format, Line, Other codes, Soft hyphen.
In Reveal Codes, it produces a [- Soft Hyphen] code.
This type of hyphen only becomes visible on the main screen
and in print when the joined characters or words span the hyphenation
zone; otherwise you won't see it (but you can still see it
in Reveal Codes).
- Assign "Hyphenation
Soft" to the <Alt+hyphen> keys, if it is not already
assigned to them. (See the tip
below.)
- A hyphenation soft return (inserted when you click Format, Line, Other codes,
Hyphenation soft return; or just <Ctrl+Shift+hyphen>) divides
the word without using a hyphen only when the word spans the
hyphenation zone. In brief, it acts like
a hyphen by dividing a word but it does not show up on the main
screen or in print. In Reveal Codes, it produces a [Hyph SRt]
code. It is often used following a slash (stroke) mark ("/")
or a dash to allow wrapping at that location.
- Tip: You can use the author's SoftWrap
macro to add hyphenation soft returns at appropriate locations
in e-mail and web page addresses.
- Assign "Hyphenation
Soft Return" to the <Alt+hyphen>, <Ctrl+Shift+hyphen>
or <Ctrl+Alt+hyphen> keys, if it is not already assigned
to one of them. (See the tip
below.)
What is a "hard" space?
- Hard spaces, like hard hyphens, are useful
in several circumstances, to "glue" words, numbers
or dates together to prevent them from splitting to the next
line by word wrap.
- Hard spaces can be entered from the keyboard
by pressing <Ctrl+space>. Normally, pressing the <space>
key produces a space character (ASCII 32), not a WordPerfect
code; pressing the hyphen key produces a WordPerfect code, not
a hyphen character (ASCII 45).
Notes and tips
- Shortcut keys: Hard hyphens, soft hyphens, and hyphenation soft returns
can be assigned to the indicated keyboard
shortcuts (or any available shortcut keys) to make them easy
to access while typing. These three items are found under the
Features tab in the Features category "Format," when
you click on Tools, Settings, Customize, Keyboards tab, <keyboard
name>, Edit. Scroll down in the shortcut key list to find
the -+Ctrl, -+Alt, etc., shortcut keys, remove the old assignment
(if any), then Assign the feature to the key combination. (For
more help on assigning features, macros, etc., to shortcut keys,
see here.)
- Hyphenation zone. Hyphenation divides words that start before the left
boundary of this zone (a narrow area that surrounds the right
margin of a document) and extend past the right boundary of the
zone. You can change it with Tools, Language, Hyphenation
(earlier versions: Format, Line, Hyphenation). This is what the
dialog looks like:
- Enable the checkbox to turn automatic hyphenation
on.
- Adjustments.
The left dotted line represents the left boundary of the hyphenation
zone; the middle solid line represents the right margin; and
the right dotted line represents the right boundary of the hyphenation
zone. The zone is measured as a percentage of the line length
(determined by the current left and right margin settings).
- Place the cursor where you want to change
the zone.
- Specify new percentages. Increase the percentages
to hyphenate fewer words; decrease the percentages to hyphenate
more words.
- Re-hyphenate?
If Hyphenation was turned on before you made changes, WordPerfect
may prompt you to re-hyphenate some words. You can remove this
message from older documents where hyphenation was previously
turned on, but where it is currently turned off, with a macro:
See UPDATER.
- You have to insert some of these items
manually. Hard spaces (see above),
regular hyphens, soft hyphens, and hyphenation soft returns must
be deliberately inserted by the user in WordPerfect, while hard
hyphens can be either deliberately inserted, imported from an
external source, or converted by WordPerfect during certain paste operations.
- Changes WordPerfect might make without
telling you. If you paste material
as "unformatted text" you should note the way WordPerfect
11 and later versions treat regular hyphens, soft hyphens, hyphenation
soft returns, and hard spaces from a source document. See here for more (especially under the
"Notes" section on that page).
|
|
Footnote 1
Example macro to search for normal hyphens -- the first type of hyphen discussed above -- by
first transforming any normal hyphens found to a code
the macro can use.
As noted above, storing a word or phrase containing
regular hyphens (i.e., [-Hyphen] codes) in a variable causes
the hyphen codes to be converted to hard hyphens. Therefore,
to use SearchString() in a macro to find such an item, you must
first use StrTransform() on the variable.
The example macro will pause at each item
found until you press <Enter>.
IMPORTANT:
The "-" (between the double quote
marks) in the "Smith-Jones" variable was inserted in
the macro with the normal hyphen key (next to the zero key).
The "-" (between the double quote
marks) in the StrTransform() command below was inserted in the
macro with the normal hyphen key (next to the zero key).
That is, all "-" items in the macro
are actually normal hyphen codes, not hard hyphens [Ctrl+hyphen].
On the other hand, the [-Hyphen] (also between
two double quote marks) in the StrTransform() command below was
inserted with the Codes button on the macro toolbar. You need
to replace the text "placeholder" with the Code!
Tip: Instead of "Smith-Jones" you
can use just a single hyphen (inserted with the hyphen key) to
find all hyphen codes. For example: vStr:="-"
// Macro begins here
PosDocVeryTop
OnNotFound(End@)
vStr:="Smith-Jones"
vStr:=StrTransform(vStr; "-"; "[- Hyphen]")
MatchSelection
SearchString(vStr)
While(True)
SearchNext(Extended!)
Pausekey(Enter!)
Endwhile
Label(End@)
// Macro ends here |