[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Within `@code`, `@-` and `@/` are handled the same
From: |
Werner LEMBERG |
Subject: |
Re: Within `@code`, `@-` and `@/` are handled the same |
Date: |
Thu, 15 Dec 2022 17:50:02 +0000 (UTC) |
> As can be seen in the attached output, there is no hyphen in the
> split word. I consider this a bug, since there is zero reason for
> such a surprising (and undocumented) behaviour.
>
> BTW, you get exactly the same output if you replace `@code` with `@t`
> – and *this* is definitely a bug :-)
Attached are two patches that fix both issues. Note that the bug with
no hyphenation in `@t` is at least 20 years old...
I've also attached a sample document, together with an image of it.
Werner
>From 414d2fd0d06383d6574163cdee564175a87a15c2 Mon Sep 17 00:00:00 2001
From: Werner Lemberg <wl@gnu.org>
Date: Thu, 15 Dec 2022 18:28:00 +0100
Subject: [PATCH 1/2] texinfo.tex: Make `\restorehyphenation` actually work.
After leaving a group, `\font` is usually a different font. Without this
patch, the action of `\nohyphenation` was never reset in that case.
---
doc/texinfo.tex | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index dbd5166014..a94e50c365 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -2821,8 +2821,12 @@ end
% the end of a paragraph. Restore normal hyphenation at the end of the
% group within which \nohyphenation is presumably called.
%
-\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
-\def\restorehyphenation{\hyphenchar\font = `- }
+\def\nohyphenation{%
+ \hyphenchar\font = -1
+ \xdef\nohyphenationfont{\the\font}%
+ \aftergroup\restorehyphenation \aftergroup\nohyphenationfont}
+\def\restorehyphenation#1{%
+ \hyphenchar#1 = `- }
\newif\iffrenchspacing
\frenchspacingfalse
--
2.39.0
>From e366314336a2c155bc64afcd82cd1b4dc77ff565 Mon Sep 17 00:00:00 2001
From: Werner Lemberg <wl@gnu.org>
Date: Thu, 15 Dec 2022 18:31:26 +0100
Subject: [PATCH 2/2] texinfo.tex: Make `@-` work in `@code`.
---
doc/texinfo.tex | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index a94e50c365..d62dd02ee1 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -2899,9 +2899,12 @@ end
% But `\ ' produces the large typewriter interword space.
\def\ {{\spaceskip = 0pt{} }}%
%
- % Turn off hyphenation.
+ % Turn off pattern-based hyphenation ...
\nohyphenation
%
+ % ... but allow explicit insertion of hyphenation points.
+ \def\-{\discretionary{\normaldash}{}{}}%
+ %
\plainfrenchspacing
#1%
}%
--
2.39.0
\input texinfo
@verb{|@t|}:
This is a @t{Long@-Long@-Word};
this is a @t{Long@-Long@-Word};
this is a @t{Long@-Long@-Word};
this is a @t{Long@-Long@-Word};
this is a @t{Long@-Long@-Word};
this is a @t{Long@-Long@-Word};
this is a @t{Long@-Long@-Word};
this is a @t{Long@-Long@-Word}.
This is a @t{Long-Long-Word};
this is a @t{Long-Long-Word};
this is a @t{Long-Long-Word};
this is a @t{Long-Long-Word};
this is a @t{Long-Long-Word};
this is a @t{Long-Long-Word};
this is a @t{Long-Long-Word};
this is a @t{Long-Long-Word}.
@sp 1
@verb{|@code|}:
This is a @code{Long@-Long@-Word};
this is a @code{Long@-Long@-Word};
this is a @code{Long@-Long@-Word};
this is a @code{Long@-Long@-Word};
this is a @code{Long@-Long@-Word};
this is a @code{Long@-Long@-Word};
this is a @code{Long@-Long@-Word};
this is a @code{Long@-Long@-Word}.
This is a @code{Long-Long-Word};
this is a @code{Long-Long-Word};
this is a @code{Long-Long-Word};
this is a @code{Long-Long-Word};
this is a @code{Long-Long-Word};
this is a @code{Long-Long-Word};
this is a @code{Long-Long-Word};
this is a @code{Long-Long-Word}.
@sp1
@verb{|@code & @allowcodebreaks false|}:
@allowcodebreaks false
This is a @code{Long@-Long@-Word};
this is a @code{Long@-Long@-Word};
this is a @code{Long@-Long@-Word};
this is a @code{Long@-Long@-Word};
this is a @code{Long@-Long@-Word};
this is a @code{Long@-Long@-Word};
this is a @code{Long@-Long@-Word};
this is a @code{Long@-Long@-Word}.
This is a @code{Long-Long-Word};
this is a @code{Long-Long-Word};
this is a @code{Long-Long-Word};
this is a @code{Long-Long-Word};
this is a @code{Long-Long-Word};
this is a @code{Long-Long-Word};
this is a @code{Long-Long-Word};
this is a @code{Long-Long-Word}.
@bye
- Within `@code`, `@-` and `@/` are handled the same, Werner LEMBERG, 2022/12/06
- Re: Within `@code`, `@-` and `@/` are handled the same, Gavin Smith, 2022/12/07
- Re: Within `@code`, `@-` and `@/` are handled the same,
Werner LEMBERG <=
- Re: Within `@code`, `@-` and `@/` are handled the same, Werner LEMBERG, 2022/12/15
- Re: Within `@code`, `@-` and `@/` are handled the same, Werner LEMBERG, 2022/12/16
- Re: Within `@code`, `@-` and `@/` are handled the same, Gavin Smith, 2022/12/17
- Re: Within `@code`, `@-` and `@/` are handled the same, Gavin Smith, 2022/12/17
- Re: Within `@code`, `@-` and `@/` are handled the same, Werner LEMBERG, 2022/12/17