[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: |
Fri, 16 Dec 2022 07:37:06 +0000 (UTC) |
>> Attached are two patches that fix both issues. Note that the bug
>> with no hyphenation in `@t` is at least 20 years old...
>
> And here's a better fix for the `@t` issue.
Aaand a hopefully final version that takes care of nesting.
Werner
>From c49decc31ff2c4b97b08b01d1ad9125b3b7b2ec0 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 `\nohyphenation` work as expected.
After leaving a group, `\font` is usually a different font. Before this
patch, the action of `\nohyphenation` was never reset in that case.
---
doc/texinfo.tex | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index dbd5166014..e5f6b18583 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -2817,12 +2817,24 @@ end
% @sansserif, explicit sans.
\def\sansserif#1{{\sf #1}}
+\def\splitnumber#1#2#3{%
+ \edef\numfirst{#1}%
+ \edef\numsecond{#2}%
+ \edef\numthird{#3}}
+
% We can't just use \exhyphenpenalty, because that only has effect at
% 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{%
+ \expandafter \splitnumber\the\hyphenchar\font \relax \relax
+ \hyphenchar\font = -1
+ % We can't use a global macro with `\aftergroup` due to possible nesting.
+ \aftergroup\hyphenchar
+ \expandafter\aftergroup\the\font
+ \expandafter\aftergroup\numfirst
+ \expandafter\aftergroup\numsecond
+ \expandafter\aftergroup\numthird}
\newif\iffrenchspacing
\frenchspacingfalse
--
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}.
@sp1
@verb{|@t in @code & @allowcodebreaks false|}:
@allowcodebreaks false
This is a @code{@t{Long@-Long@-Word}};
this is a @code{@t{Long@-Long@-Word}};
this is a @code{@t{Long@-Long@-Word}};
this is a @code{@t{Long@-Long@-Word}};
this is a @code{@t{Long@-Long@-Word}};
this is a @code{@t{Long@-Long@-Word}};
this is a @code{@t{Long@-Long@-Word}};
this is a @code{@t{Long@-Long@-Word}}.
This is a @code{@t{Long-Long-Word}};
this is a @code{@t{Long-Long-Word}};
this is a @code{@t{Long-Long-Word}};
this is a @code{@t{Long-Long-Word}};
this is a @code{@t{Long-Long-Word}};
this is a @code{@t{Long-Long-Word}};
this is a @code{@t{Long-Long-Word}};
this is a @code{@t{Long-Long-Word}}.
@sp1
@verb{|@code in @code & @allowcodebreaks false|}:
@allowcodebreaks false
This is a @code{@code{Long@-Long@-Word}};
this is a @code{@code{Long@-Long@-Word}};
this is a @code{@code{Long@-Long@-Word}};
this is a @code{@code{Long@-Long@-Word}};
this is a @code{@code{Long@-Long@-Word}};
this is a @code{@code{Long@-Long@-Word}};
this is a @code{@code{Long@-Long@-Word}};
this is a @code{@code{Long@-Long@-Word}}.
This is a @code{@code{Long-Long-Word}};
this is a @code{@code{Long-Long-Word}};
this is a @code{@code{Long-Long-Word}};
this is a @code{@code{Long-Long-Word}};
this is a @code{@code{Long-Long-Word}};
this is a @code{@code{Long-Long-Word}};
this is a @code{@code{Long-Long-Word}};
this is a @code{@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, 2022/12/15
- Re: Within `@code`, `@-` and `@/` are handled the same, Werner LEMBERG, 2022/12/15
- Re: Within `@code`, `@-` and `@/` are handled the same,
Werner LEMBERG <=
- 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