gbranden pushed a commit to branch master
in repository groff.
commit 62718e09cd435632b6d05b751205fa24fc88e79f
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Mar 1 23:42:20 2024 -0600
[troff]: Document new `hydefault` feature.
* NEWS:
* doc/groff.texi.in:
* man/groff.7.man:
* man/groff_diff.7.man: Do it.
Fixes <https://savannah.gnu.org/bugs/?63635>.
---
ChangeLog | 9 +++++++++
NEWS | 20 ++++++++++++++++++++
doc/groff.texi.in | 31 ++++++++++++++++++++++++-------
man/groff.7.man | 25 +++++++++++++++----------
man/groff_diff.7.man | 16 ++++++++++++++++
5 files changed, 84 insertions(+), 17 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e1a3c5a2d..a84aa0907 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-03-01 G. Branden Robinson <[email protected]>
+
+ * NEWS:
+ * doc/groff.texi.in:
+ * man/groff.7.man:
+ * man/groff_diff.7.man: Document new `hydefault` feature.
+
+ Fixes <https://savannah.gnu.org/bugs/?63635>.
+
2024-03-01 G. Branden Robinson <[email protected]>
[tmac]: Migrate localization packages to `hydefault` request.
diff --git a/NEWS b/NEWS
index d7330d5fa..66267d4de 100644
--- a/NEWS
+++ b/NEWS
@@ -39,6 +39,23 @@ o The device-independent output now reports unbreakable
spaces (those
produced with the `\~` escape sequence) as word breaks with the
documentary 'w' command, just as it does for regular breakable spaces.
+o A new request, `hydefault`, and read-only register, `.hydefault`,
+ manage the default automatic hyphenation mode of an environment. This
+ resolves a long-standing problem of *roff formatting.
+
+ When processing input like this,
+ .nh
+ and we temporarily shut off automatic hyphenation,
+ .hy
+ the foregoing request does not do exactly what we expect.
+
+ AT&T and other troffs would set the hyphenation mode to 1 instead of
+ the previous value, nor, for GNU troff, was this an appropriate value
+ for the English hyphenation patterns. (For example, "alibi" would
+ break as "ali-bi" instead of "al-ibi" after this argumentless `hy`
+ invocation.) With updates to groff's localization files, the
+ foregoing input now works as desired.
+
o A new read-only, string-valued register, `.trap`, interpolates the
name of the next vertical position trap that will be sprung.
@@ -240,6 +257,9 @@ o Spanish language input documents are now supported,
including
hyphenation patterns from the hyph-utf8 project and localized strings
for the man, ms, me, mm, and mom packages. Thanks to Eloi Monta��s.
+o The localization macro files now set up an appropriate hyphenation
+ mode default. For Chinese and Japanese, this is zero.
+
o If groff programs have their current time overridden by the
SOURCE_DATE_EPOCH environment variable, then that time is always
displayed in UTC. That environment variable is normally only set when
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 1e83dc26e..c31fd548d 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -8694,11 +8694,12 @@ additional inter-word space (@code{hys}).
@DefreqList {hy, [@Var{mode}]}
@DefregListEndx {.hy}
Set automatic hyphenation mode to @var{mode}, an integer encoding
-conditions for hyphenation; if omitted, @samp{1} is implied. The
-hyphenation mode is available in the read-only register @samp{.hy}; it
-is associated with the environment (@pxref{Environments}). The default
-hyphenation mode depends on the localization file loaded when GNU
-@code{troff} starts up; see the @code{hpf} request below.
+conditions for hyphenation; if omitted, the configured hyphenation mode
+default (see below) is implied. The hyphenation mode is available in
+the read-only register @samp{.hy}; it is associated with the environment
+(@pxref{Environments}). The default hyphenation mode depends on the
+localization file loaded when GNU @code{troff} starts up; see the
+@code{hpf} request below.
Typesetting practice generally does not avail itself of every
opportunity for hyphenation, but the details differ by language and site
@@ -8823,7 +8824,19 @@ given by @code{hy}.
@Defreq {nh, }
Disable automatic hyphenation; i.e., set the hyphenation mode to@tie{}0
(see above). The hyphenation mode of the last call to @code{hy} is not
-remembered.
+remembered, but invoking @code{hy} without an argument restores the
+default hyphenation mode if it is configured; @code{groff}'s
+localization macro files do so for the languages listed above.
+@endDefreq
+
+@cindex hyphenation mode default register (@code{.hydefault})
+@DefreqList {hydefault, [@Var{mode}]}
+@DefregListEndx {.hydefault}
+Set hyphenation mode default to @var{mode}, configuring the value the
+automatic hyphenation mode takes if @code{hy} is invoked without an
+argument. The hyphenation mode default is available in the read-only
+register @samp{.hydefault}; it is associated with the environment
+(@pxref{Environments}).
@endDefreq
@need 200
@@ -17694,7 +17707,11 @@ hard-coded rules specific to English, while GNU
@code{troff} uses
language-specific hyphenation pattern files derived from @TeX{}.
Furthermore, in old versions of @code{troff} there was a limited amount
of space to store hyphenation exceptions (arguments to the @code{hw}
-request); GNU @code{troff} has no such restriction.
+request); GNU @code{troff} has no such restriction. When the @code{hy}
+request is invoked without an argument, GNU @code{troff} sets the
+automatic hyphenation mode to the value of the @code{.hydefault}
+register; the @acronym{AT&T} implementation sets it to @samp{1}, which
+is not suitable for some languages, including English.
@cindex output device name string (@code{.T}), in other implementations
GNU @code{troff} predefines a string @code{.T} containing the argument
diff --git a/man/groff.7.man b/man/groff.7.man
index 3bf4358f4..0c0a8f7f0 100644
--- a/man/groff.7.man
+++ b/man/groff.7.man
@@ -3418,8 +3418,9 @@ indicates a hyphenation point.
.
.TPx
.REQ .hy
-Set automatic hyphenation mode to
-.BR 1 .
+Set automatic hyphenation mode to the value of the
+.REG .hydefault
+register.
.
.TPx
.REQ .hy\~0
@@ -3434,6 +3435,12 @@ Set automatic hyphenation mode to
see section \[lq]Hyphenation\[rq] below.
.
.TPx
+.REQ .hydefault mode
+Set hyphenation mode default to
+.IR mode ;
+see section \[lq]Hyphenation\[rq] below.
+.
+.TPx
.REQ .hym
Set the (right) hyphenation margin to
.B 0
@@ -6201,6 +6208,10 @@ Maximum quantity of consecutive hyphenated lines allowed
in environment.
Automatic hyphenation mode in environment.
.
.TP
+.REG .hydefault
+Hyphenation mode default in environment.
+.
+.TP
.REG .hym
Hyphenation margin in environment.
.
@@ -7021,15 +7032,9 @@ see below for details),
and at which positions within that word automatically determined
hyphenation points are permissible.
.
-The default is
-.RB \[lq] 1 \[rq]
-for historical reasons,
-but this is not an appropriate value for the English hyphenation
-patterns used by
-.IR groff ;
-localization macro files loaded by
+The localization macro files loaded by
.I troffrc
-and macro packages often override it.
+configure a default hyphenation mode appropriate to the language.
.
.
.br
diff --git a/man/groff_diff.7.man b/man/groff_diff.7.man
index 101b8b63e..da4c4761a 100644
--- a/man/groff_diff.7.man
+++ b/man/groff_diff.7.man
@@ -2881,6 +2881,17 @@ which map to those for \[lq]a\[rq] to \[lq]z\[rq].
.
.
.TP
+.BI .hydefault\~ mode
+Set hyphenation mode default to
+.I mode.
+.
+When the
+.B hy
+request is invoked without an argument,
+this mode is selected.
+.
+.
+.TP
.BR .hym\~ [\c
.IR length ]
Set the (right) hyphenation margin
@@ -4151,6 +4162,11 @@ Interpolate automatic hyphenation mode of the
environment.
.
.
.TP
+.B \[rs]n[.hydefault]
+Interpolate hyphenation mode default of the environment.
+.
+.
+.TP
.B \[rs]n[.hym]
Inteprolate hyphenation margin of the environment.
.
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit