bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: microtype for texinfo


From: Werner LEMBERG
Subject: Re: microtype for texinfo
Date: Mon, 26 Sep 2022 12:36:45 +0000 (UTC)

>> Thus, I don't think it's worth the trouble to add support when it's
>> only protrusion. So I won't be working on this. Sorry.
> 
> OK, I'll prepare a patch.

It turned out that character protrusion (for *all* TeX engines) was
neither activated nor working at all.  Here is a series of patches to
fix that.


    Werner
>From cb8867beaab487df05d5cac61e34f0c00df0aa14 Mon Sep 17 00:00:00 2001
From: Werner Lemberg <wl@gnu.org>
Date: Mon, 26 Sep 2022 13:58:09 +0200
Subject: [PATCH 1/3] * doc/texinfo.tex: Remove trailing spaces.

---
 ChangeLog       |   4 +
 doc/texinfo.tex | 199 ++++++++++++++++++++++++------------------------
 2 files changed, 103 insertions(+), 100 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e4756bacba..73fd64ff2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2022-09-26  Werner Lemberg  <wl@gnu.org>
+
+       * doc/texinfo.tex: Remove trailing spaces.
+
 2022-09-25  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm (_convert),
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index de59db7951..516a3d29fc 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -1,6 +1,5 @@
-
 % texinfo.tex -- TeX macros to handle Texinfo files.
-% 
+%
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
@@ -219,7 +218,7 @@
 % @errormsg{MSG}.  Do the index-like expansions on MSG, but if things
 % aren't perfect, it's not the end of the world, being an error message,
 % after all.
-% 
+%
 \def\errormsg{\begingroup \indexnofonts \doerrormsg}
 \def\doerrormsg#1{\errmessage{#1}}
 
@@ -433,7 +432,7 @@
   }%
 }
 
-% First remove any @comment, then any @c comment.  Pass the result on to 
+% First remove any @comment, then any @c comment.  Pass the result on to
 % \argcheckspaces.
 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
 \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
@@ -1052,8 +1051,8 @@ where each line of input produces a line of output.}
         end
       end
     }
-    % The -2 in the arguments here gives all the input to TeX catcode 12 
-    % (other) or 10 (space), preventing undefined control sequence errors. See 
+    % The -2 in the arguments here gives all the input to TeX catcode 12
+    % (other) or 10 (space), preventing undefined control sequence errors. See
     % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html
     %
   \endgroup
@@ -1147,7 +1146,7 @@ where each line of input produces a line of output.}
 % for display in the outlines, and in other places.  Thus, we have to
 % double any backslashes.  Otherwise, a name like "\node" will be
 % interpreted as a newline (\n), followed by o, d, e.  Not good.
-% 
+%
 % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
 % related messages.  The final outcome is that it is up to the TeX user
 % to double the backslashes and otherwise make the string valid, so
@@ -1435,7 +1434,7 @@ output) for that.)}
       % We use the node names as the destinations.
       %
       % Currently we prefix the section name with the section number
-      % for chapter and appendix headings only in order to avoid too much 
+      % for chapter and appendix headings only in order to avoid too much
       % horizontal space being required in the PDF viewer.
       \def\numchapentry##1##2##3##4{%
         \dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}%
@@ -1458,7 +1457,7 @@ output) for that.)}
       % their "best" equivalent, based on the @documentencoding.  Too
       % much work for too little return.  Just use the ASCII equivalents
       % we use for the index sort strings.
-      % 
+      %
       \indexnofonts
       \setupdatafile
       % We can have normal brace characters in the PDF outlines, unlike
@@ -1683,7 +1682,7 @@ output) for that.)}
       % We use node names as destinations.
       %
       % Currently we prefix the section name with the section number
-      % for chapter and appendix headings only in order to avoid too much 
+      % for chapter and appendix headings only in order to avoid too much
       % horizontal space being required in the PDF viewer.
       \def\partentry##1##2##3##4{}% ignore parts in the outlines
       \def\numchapentry##1##2##3##4{%
@@ -2708,7 +2707,7 @@ end
 }
 
 % Commands to set the quote options.
-% 
+%
 \parseargdef\codequoteundirected{%
   \def\temp{#1}%
   \ifx\temp\onword
@@ -2749,7 +2748,7 @@ end
 % If we are in a monospaced environment, however, 1) always use \ttsl,
 % and 2) do not add an italic correction.
 \def\dosmartslant#1#2{%
-  \ifusingtt 
+  \ifusingtt
     {{\ttsl #2}\let\next=\relax}%
     {\def\next{{#1#2}\smartitaliccorrection}}%
   \next
@@ -2937,14 +2936,14 @@ end
   \gdef\codedash{\futurelet\next\codedashfinish}
   \gdef\codedashfinish{%
     \normaldash % always output the dash character itself.
-    % 
+    %
     % Now, output a discretionary to allow a line break, unless
     % (a) the next character is a -, or
     % (b) the preceding character is a -.
     % E.g., given --posix, we do not want to allow a break after either -.
     % Given --foo-bar, we do want to allow a break between the - and the b.
     \ifx\next\codedash \else
-      \ifx\codedashprev\codedash 
+      \ifx\codedashprev\codedash
       \else \discretionary{}{}{}\fi
     \fi
     % we need the space after the = for the case when \next itself is a
@@ -3034,7 +3033,7 @@ end
         % For pdfTeX and LuaTeX
         \ifurefurlonlylink
           % PDF plus option to not display url, show just arg
-          \unhbox0             
+          \unhbox0
         \else
           % PDF, normally display both arg and url for consistency,
           % visibility, if the pdf is eventually used to print, etc.
@@ -3047,7 +3046,7 @@ end
           % For XeTeX
           \ifurefurlonlylink
             % PDF plus option to not display url, show just arg
-            \unhbox0             
+            \unhbox0
           \else
             % PDF, normally display both arg and url for consistency,
             % visibility, if the pdf is eventually used to print, etc.
@@ -3105,10 +3104,10 @@ end
   }
 }
 
-% By default we'll break after the special characters, but some people like to 
-% break before the special chars, so allow that.  Also allow no breaking at 
+% By default we'll break after the special characters, but some people like to
+% break before the special chars, so allow that.  Also allow no breaking at
 % all, for manual control.
-% 
+%
 \parseargdef\urefbreakstyle{%
   \def\txiarg{#1}%
   \ifx\txiarg\wordnone
@@ -3127,10 +3126,10 @@ end
 \def\wordnone{none}
 
 % Allow a ragged right output to aid breaking long URL's.  There can
-% be a break at the \allowbreak with no extra glue (if the existing stretch in 
+% be a break at the \allowbreak with no extra glue (if the existing stretch in
 % the line is sufficient), a break at the \penalty with extra glue added
 % at the end of the line, or no break at all here.
-%   Changing the value of the penalty and/or the amount of stretch affects how 
+%   Changing the value of the penalty and/or the amount of stretch affects how
 % preferable one choice is over the other.
 \def\urefallowbreak{%
   \penalty0\relax
@@ -3345,7 +3344,7 @@ $$%
 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
 % except specified as a normal braced arg, so no newlines to worry about.
-% 
+%
 \def\outfmtnametex{tex}
 %
 \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
@@ -3353,7 +3352,7 @@ $$%
   \def\inlinefmtname{#1}%
   \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
 }
-% 
+%
 % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
 % FMTNAME is tex, else ELSE-TEXT.
 \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
@@ -3369,7 +3368,7 @@ $$%
 % *right* brace they would have to use a command anyway, so they may as
 % well use a command to get a left brace too.  We could re-use the
 % delimiter character idea from \verb, but it seems like overkill.
-% 
+%
 \long\def\inlineraw{\tex \doinlineraw}
 \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
 \def\doinlinerawtwo#1,#2,\finish{%
@@ -3655,7 +3654,7 @@ $$%
 % for non-CM glyphs.  That is ec* for regular text and tc* for the text
 % companion symbols (LaTeX TS1 encoding).  Both are part of the ec
 % package and follow the same conventions.
-% 
+%
 \def\ecfont{\etcfont{e}}
 \def\tcfont{\etcfont{t}}
 %
@@ -3734,7 +3733,7 @@ $$%
               after the title page.}}%
 \def\setshortcontentsaftertitlepage{%
   \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
-              command; move your @shortcontents and @contents commands if you 
+              command; move your @shortcontents and @contents commands if you
               want the contents after the title page.}}%
 
 \parseargdef\shorttitlepage{%
@@ -3789,7 +3788,7 @@ $$%
 % don't worry much about spacing, ragged right.  This should be used
 % inside a \vbox, and fonts need to be set appropriately first. \par should
 % be specified before the end of the \vbox, since a vbox is a group.
-% 
+%
 \def\raggedtitlesettings{%
   \rm
   \hyphenpenalty=10000
@@ -4625,7 +4624,7 @@ $$%
 % Like \expandablevalue, but completely expandable (the \message in the
 % definition above operates at the execution level of TeX).  Used when
 % writing to auxiliary files, due to the expansion that \write does.
-% If flag is undefined, pass through an unexpanded @value command: maybe it 
+% If flag is undefined, pass through an unexpanded @value command: maybe it
 % will be set by the time it is read back in.
 %
 % NB flag names containing - or _ may not work here.
@@ -4649,7 +4648,7 @@ $$%
 
 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
 % with @set.
-% 
+%
 % To get the special treatment we need for `@end ifset,' we call
 % \makecond and then redefine.
 %
@@ -4682,7 +4681,7 @@ $$%
 % without the @) is in fact defined.  We can only feasibly check at the
 % TeX level, so something like `mathcode' is going to considered
 % defined even though it is not a Texinfo command.
-% 
+%
 \makecond{ifcommanddefined}
 \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
 %
@@ -4791,7 +4790,7 @@ $$%
 \def\docodeindexxxx #1{\docind{\indexname}{#1}}
 
 
-% Used for the aux, toc and index files to prevent expansion of Texinfo 
+% Used for the aux, toc and index files to prevent expansion of Texinfo
 % commands.
 %
 \def\atdummies{%
@@ -5137,7 +5136,7 @@ $$%
   \let\value\indexnofontsvalue
 }
 
-% Give the control sequence a definition that removes the {} that follows 
+% Give the control sequence a definition that removes the {} that follows
 % its use, e.g. @AA{} -> AA
 \def\indexnofontsdef#1#2{\def#1##1{#2}}%
 
@@ -5182,7 +5181,7 @@ $$%
   \ifx\suffix\indexisfl\def\suffix{f1}\fi
   % Open the file
   \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
-  % Using \immediate above here prevents an object entering into the current 
+  % Using \immediate above here prevents an object entering into the current
   % box, which could confound checks such as those in \safewhatsit for
   % preceding skips.
   \typeout{Writing index file \jobname.\suffix}%
@@ -5234,7 +5233,7 @@ $$%
   \ifx\segment\isfinish
   \else
     %
-    % Fully expand the segment, throwing away any @sortas directives, and 
+    % Fully expand the segment, throwing away any @sortas directives, and
     % trim spaces.
     \edef\trimmed{\segment}%
     \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
@@ -5295,12 +5294,12 @@ $$%
 % the current value of \escapechar.
 \def\escapeisbackslash{\escapechar=`\\}
 
-% Use \ in index files by default.  texi2dvi didn't support @ as the escape 
-% character (as it checked for "\entry" in the files, and not "@entry").  When 
-% the new version of texi2dvi has had a chance to become more prevalent, then 
-% the escape character can change back to @ again.  This should be an easy 
-% change to make now because both @ and \ are only used as escape characters 
in 
-% index files, never standing for themselves. 
+% Use \ in index files by default.  texi2dvi didn't support @ as the escape
+% character (as it checked for "\entry" in the files, and not "@entry").  When
+% the new version of texi2dvi has had a chance to become more prevalent, then
+% the escape character can change back to @ again.  This should be an easy
+% change to make now because both @ and \ are only used as escape characters in
+% index files, never standing for themselves.
 %
 \set txiindexescapeisbackslash
 
@@ -5323,7 +5322,7 @@ $$%
   \def\}{\rbracechar{}}%
   \uccode`\~=`\\ \uppercase{\def~{\backslashchar{}}}%
   %
-  % Split the entry into primary entry and any subentries, and get the index 
+  % Split the entry into primary entry and any subentries, and get the index
   % sort key.
   \splitindexentry\indextext
   %
@@ -5504,18 +5503,18 @@ $$%
     \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
       \ifflagclear{txiskipindexfileswithbackslash}{%
 \errmessage{%
-ERROR: A sorted index file in an obsolete format was skipped.  
+ERROR: A sorted index file in an obsolete format was skipped.
 To fix this problem, please upgrade your version of 'texi2dvi'
 or 'texi2pdf' to that at <https://ftp.gnu.org/gnu/texinfo>.
-If you are using an old version of 'texindex' (part of the Texinfo 
+If you are using an old version of 'texindex' (part of the Texinfo
 distribution), you may also need to upgrade to a newer version (at least 6.0).
 You may be able to typeset the index if you run
 'texindex \jobname.\indexname' yourself.
-You could also try setting the 'txiindexescapeisbackslash' flag by 
+You could also try setting the 'txiindexescapeisbackslash' flag by
 running a command like
-'texi2dvi -t "@set txiindexescapeisbackslash" \jobname.texi'.  If you do 
+'texi2dvi -t "@set txiindexescapeisbackslash" \jobname.texi'.  If you do
 this, Texinfo will try to use index files in the old format.
-If you continue to have problems, deleting the index files and starting again 
+If you continue to have problems, deleting the index files and starting again
 might help (with 'rm \jobname.?? \jobname.??s')%
 }%
       }{%
@@ -5588,7 +5587,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   % bottom of a column to reduce an increase in inter-line spacing.
   \nobreak
   \vskip 0pt plus 5\baselineskip
-  \penalty -300 
+  \penalty -300
   \vskip 0pt plus -5\baselineskip
   %
   % Typeset the initial.  Making this add up to a whole number of
@@ -5704,7 +5703,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
       \advance\dimen@ii by 1\dimen@i
       \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
       \ifdim\dimen@ > 0.8\dimen@ii   % due to long index text
-        % Try to split the text roughly evenly.  \dimen@ will be the length of 
+        % Try to split the text roughly evenly.  \dimen@ will be the length of
         % the first line.
         \dimen@ = 0.7\dimen@
         \dimen@ii = \hsize
@@ -5912,7 +5911,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 \newbox\balancedcolumns
 \setbox\balancedcolumns=\vbox{shouldnt see this}%
 %
-% Only called for the last of the double column material.  \doublecolumnout 
+% Only called for the last of the double column material.  \doublecolumnout
 % does the others.
 \def\balancecolumns{%
   \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
@@ -5940,7 +5939,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
     }%
     % Now the left column is in box 1, and the right column in box 3.
     %
-    % Check whether the left column has come out higher than the page itself.  
+    % Check whether the left column has come out higher than the page itself.
     % (Note that we have doubled \vsize for the double columns, so
     % the actual height of the page is 0.5\vsize).
     \ifdim2\ht1>\vsize
@@ -6237,7 +6236,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 \let\top\unnumbered
 
 % Sections.
-% 
+%
 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
 \def\seczzz#1{%
   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
@@ -6260,7 +6259,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 }
 
 % Subsections.
-% 
+%
 % normally calls numberedsubseczzz:
 \outer\parseargdef\numberedsubsec{\numhead2{#1}}
 \def\numberedsubseczzz#1{%
@@ -6285,7 +6284,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 }
 
 % Subsubsections.
-% 
+%
 % normally numberedsubsubseczzz:
 \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
 \def\numberedsubsubseczzz#1{%
@@ -7340,7 +7339,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 
 % @indentedblock is like @quotation, but indents only on the left and
 % has no optional argument.
-% 
+%
 \makedispenvdef{indentedblock}{\indentedblockstart}
 %
 \def\indentedblockstart{%
@@ -7634,7 +7633,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 % @deftypefnnewline on|off says whether the return type of typed functions
 % are printed on their own line.  This affects @deftypefn, @deftypefun,
 % @deftypeop, and @deftypemethod.
-% 
+%
 \parseargdef\deftypefnnewline{%
   \def\temp{#1}%
   \ifx\temp\onword
@@ -7802,7 +7801,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
       \tclose{\temp}% typeset the return type
       \ifrettypeownline
         % put return type on its own line; prohibit line break following:
-        \hfil\vadjust{\nobreak}\break  
+        \hfil\vadjust{\nobreak}\break
       \else
         \space  % type on same line, so just followed by a space
       \fi
@@ -7949,7 +7948,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \scantokens{#1@comment}%
   %
   % The \comment is to remove the \newlinechar added by \scantokens, and
-  % can be noticed by \parsearg.  Note \c isn't used because this means 
cedilla 
+  % can be noticed by \parsearg.  Note \c isn't used because this means cedilla
   % in math mode.
 }
 
@@ -8144,7 +8143,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 % list to some hook where the argument is to be expanded.  If there are
 % less than 10 arguments that hook is to be replaced by ##N where N
 % is the position in that list, that is to say the macro arguments are to be
-% defined `a la TeX in the macro body.  
+% defined `a la TeX in the macro body.
 %
 % That gets used by \mbodybackslash (above).
 %
@@ -8178,8 +8177,8 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 %
 % Read recursive and nonrecursive macro bodies. (They're different since
 % rec and nonrec macros end differently.)
-% 
-% We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro 
+%
+% We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
 % body to be transformed.
 % Set \macrobody to the body of the macro, and call \defmacro.
 %
@@ -8213,7 +8212,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 % twice the \macarg.BLAH macros does not cost too much processing power.
 \def\parsemmanyargdef@@#1,{%
   \if#1;\let\next=\relax
-  \else 
+  \else
     \let\next=\parsemmanyargdef@@
     \edef\tempb{\eatspaces{#1}}%
     \expandafter\def\expandafter\tempa
@@ -8298,7 +8297,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 
 % Replace arguments by their values in the macro body, and place the result
 % in macro \@tempa.
-% 
+%
 \def\macvalstoargs@{%
   %  To do this we use the property that token registers that are \the'ed
   % within an \edef  expand only once. So we are going to place all argument
@@ -8322,9 +8321,9 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
   }
 
-% Define the named-macro outside of this group and then close this group. 
-% 
-\def\macargexpandinbody@{% 
+% Define the named-macro outside of this group and then close this group.
+%
+\def\macargexpandinbody@{%
   \expandafter
   \endgroup
   \macargdeflist@
@@ -8362,7 +8361,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 }
 
 % Trailing missing arguments are set to empty.
-% 
+%
 \def\setemptyargvalues@{%
   \ifx\paramlist\nilm@
     \let\next\macargexpandinbody@
@@ -8439,7 +8438,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \else % at most 9
     \ifnum\paramno<10\relax
       % @MACNAME sets the context for reading the macro argument
-      % @MACNAME@@ gets the argument, processes backslashes and appends a 
+      % @MACNAME@@ gets the argument, processes backslashes and appends a
       % comma.
       % @MACNAME@@@ removes braces surrounding the argument list.
       % @MACNAME@@@@ scans the macro body with arguments substituted.
@@ -8483,11 +8482,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 % Call #1 with a list of tokens #2, with any doubled backslashes in #2
 % compressed to one.
 %
-% This implementation works by expansion, and not execution (so we cannot use 
-% \def or similar).  This reduces the risk of this failing in contexts where 
-% complete expansion is done with no execution (for example, in writing out to 
+% This implementation works by expansion, and not execution (so we cannot use
+% \def or similar).  This reduces the risk of this failing in contexts where
+% complete expansion is done with no execution (for example, in writing out to
 % an auxiliary file for an index entry).
-% 
+%
 % State is kept in the input stream: the argument passed to
 % @look_ahead, @gobble_and_check_finish and @add_segment is
 %
@@ -8509,11 +8508,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 % #3 - NEXT_TOKEN
 % #4 used to look ahead
 %
-% If the next token is not a backslash, process the rest of the argument; 
+% If the next token is not a backslash, process the rest of the argument;
 % otherwise, remove the next token.
 @gdef@look_ahead#1!#2#3#4{%
   @ifx#4\%
-   @expandafter@gobble_and_check_finish 
+   @expandafter@gobble_and_check_finish
   @else
    @expandafter@add_segment
   @fi#1!{#2}#4#4%
@@ -8537,9 +8536,9 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 % #3 - NEXT_TOKEN
 % #4 is input stream until next backslash
 %
-% Input stream is either at the start of the argument, or just after a 
-% backslash sequence, either a lone backslash, or a doubled backslash.  
-% NEXT_TOKEN contains the first token in the input stream: if it is \finish, 
+% Input stream is either at the start of the argument, or just after a
+% backslash sequence, either a lone backslash, or a doubled backslash.
+% NEXT_TOKEN contains the first token in the input stream: if it is \finish,
 % finish; otherwise, append to ARG_RESULT the segment of the argument up until
 % the next backslash.  PENDING_BACKSLASH contains a backslash to represent
 % a backslash just before the start of the input stream that has not been
@@ -8551,13 +8550,13 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   % append the pending backslash to the result, followed by the next segment
   @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
   % this @fi is discarded by @look_ahead.
-  % we can't get rid of it with \expandafter because we don't know how 
+  % we can't get rid of it with \expandafter because we don't know how
   % long #4 is.
 }
 
 % #1 - THE_MACRO
 % #2 - ARG_RESULT
-% #3 discards the res of the conditional in @add_segment, and @is_fi ends the 
+% #3 discards the res of the conditional in @add_segment, and @is_fi ends the
 % conditional.
 @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
 
@@ -8569,7 +8568,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 % for reading the argument (slightly different in the two cases).  Then,
 % to read the argument, in the whole-line case, it then calls the regular
 % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
-% 
+%
 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
 \def\braceorlinexxx{%
   \ifx\nchar\bgroup
@@ -8623,7 +8622,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 
 % Used so that the @top node doesn't have to be wrapped in an @ifnottex
 % conditional.
-% \doignore goes to more effort to skip nested conditionals but we don't need 
+% \doignore goes to more effort to skip nested conditionals but we don't need
 % that here.
 \def\omittopnode{%
    \ifx\lastnode\wordTop
@@ -8700,7 +8699,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 % automatically in xrefs, if the third arg is not explicitly specified.
 % This was provided as a "secret" @set xref-automatic-section-title
 % variable, now it's official.
-% 
+%
 \parseargdef\xrefautomaticsectiontitle{%
   \def\temp{#1}%
   \ifx\temp\onword
@@ -8869,24 +8868,24 @@ might help (with 'rm \jobname.?? \jobname.??s')%
     \fi
   \else
     % node/anchor (non-float) references.
-    % 
+    %
     % If we use \unhbox to print the node names, TeX does not insert
     % empty discretionaries after hyphens, which means that it will not
     % find a line break at a hyphen in a node names.  Since some manuals
     % are best written with fairly long node names, containing hyphens,
     % this is a loss.  Therefore, we give the text of the node name
     % again, so it is as if TeX is seeing it for the first time.
-    % 
+    %
     \ifdim \wd\printedmanualbox > 0pt
       % Cross-manual reference with a printed manual name.
-      % 
+      %
       \crossmanualxref{\cite{\printedmanual\unskip}}%
     %
     \else\ifdim \wd\infofilenamebox > 0pt
       % Cross-manual reference with only an info filename (arg 4), no
       % printed manual name (arg 5).  This is essentially the same as
       % the case above; we output the filename, since we have nothing else.
-      % 
+      %
       \crossmanualxref{\code{\infofilename\unskip}}%
     %
     \else
@@ -8922,20 +8921,20 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 \endgroup}
 
 % Output a cross-manual xref to #1.  Used just above (twice).
-% 
+%
 % Only include the text "Section ``foo'' in" if the foo is neither
 % missing or Top.  Thus, @xref{,,,foo,The Foo Manual} outputs simply
 % "see The Foo Manual", the idea being to refer to the whole manual.
-% 
+%
 % But, this being TeX, we can't easily compare our node name against the
 % string "Top" while ignoring the possible spaces before and after in
 % the input.  By adding the arbitrary 7sp below, we make it much less
 % likely that a real node name would have the same width as "Top" (e.g.,
 % in a monospaced font).  Hopefully it will never happen in practice.
-% 
+%
 % For the same basic reason, we retypeset the "Top" at every
 % reference, since the current font is indeterminate.
-% 
+%
 \def\crossmanualxref#1{%
   \setbox\toprefbox = \hbox{Top\kern7sp}%
   \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
@@ -9012,9 +9011,9 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \fi
 }
 
-% This is the macro invoked by entries in the aux file.  Define a control 
-% sequence for a cross-reference target (we prepend XR to the control sequence 
-% name to avoid collisions).  The value is the page number.  If this is a 
float 
+% This is the macro invoked by entries in the aux file.  Define a control
+% sequence for a cross-reference target (we prepend XR to the control sequence
+% name to avoid collisions).  The value is the page number.  If this is a float
 % type, we have more work to do.
 %
 \def\xrdef#1#2{%
@@ -9030,10 +9029,10 @@ might help (with 'rm \jobname.?? \jobname.??s')%
   \bgroup
     \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
   \egroup
-  % We put the \gdef inside a group to avoid the definitions building up on 
-  % TeX's save stack, which can cause it to run out of space for aux files 
with 
+  % We put the \gdef inside a group to avoid the definitions building up on
+  % TeX's save stack, which can cause it to run out of space for aux files with
   % thousands of lines.  \gdef doesn't use the save stack, but \csname does
-  % when it defines an unknown control sequence as \relax. 
+  % when it defines an unknown control sequence as \relax.
   %
   % Was that xref control sequence that we just defined for a float?
   \expandafter\iffloat\csname XR\safexrefname\endcsname
@@ -10265,7 +10264,7 @@ directory should work if nowhere else does.}
     \countUTFz = "#1\relax
     \begingroup
       \parseXMLCharref
-    
+
       % Give \u8:... its definition.  The sequence of seven \expandafter's
       % expands after the \gdef three times, e.g.
       %
@@ -10277,7 +10276,7 @@ directory should work if nowhere else does.}
       \expandafter\expandafter
       \expandafter\expandafter
       \expandafter\gdef       \UTFviiiTmp{#2}%
-      % 
+      %
       \expandafter\ifx\csname uni:#1\endcsname \relax \else
        \message{Internal error, already defined: #1}%
       \fi
@@ -10316,7 +10315,7 @@ directory should work if nowhere else does.}
     \divide\countUTFz by 64
     \countUTFy = \countUTFz  % Save to be the future value of \countUTFz.
     \multiply\countUTFz by 64
-    
+
     % \countUTFz is now \countUTFx with the last 5 bits cleared.  Subtract
     % in order to get the last five bits.
     \advance\countUTFx by -\countUTFz
@@ -10351,7 +10350,7 @@ directory should work if nowhere else does.}
 % U+0080..U+00FF = 
https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
 % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
 % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
-% 
+%
 % Many of our renditions are less than wonderful, and all the missing
 % characters are available somewhere.  Loading the necessary fonts
 % awaits user request.  We can't truly support Unicode without
@@ -11547,7 +11546,7 @@ directory should work if nowhere else does.}
 \def\texinfochars{%
   \let< = \activeless
   \let> = \activegtr
-  \let~ = \activetilde 
+  \let~ = \activetilde
   \let^ = \activehat
   \setregularquotes
   \let\b = \strong
-- 
2.37.3

>From 77dcf47f37e299a696d0dea962858b9388b2cc36 Mon Sep 17 00:00:00 2001
From: Werner Lemberg <wl@gnu.org>
Date: Mon, 26 Sep 2022 14:10:33 +0200
Subject: [PATCH 2/3] * doc/texinfo.tex: Fix character protrusion in
 `@microtype`.

First of all, character protrusion wasn't activated at all.
Additionally, the code from the original `protcode.tex` was added
incompletely, causing far too large protrusion values.

* doc/texinfo.tex (\countB): New counter.
(\mtadjustprotcode, \mtadjustcp): New macros.
(\mtsetprotcode): Call `\mtadjustprotcode` to scale protrusion
values correctly.
(\microtypeON, \microtypeOFF): Switch on or off character
protrusion.
---
 ChangeLog       | 15 ++++++++++++
 doc/texinfo.tex | 62 +++++++++++++++++++++++++++++++++++++------------
 2 files changed, 62 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 73fd64ff2a..02e7f4fb21 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2022-09-26  Werner Lemberg  <wl@gnu.org>
+
+       * doc/texinfo.tex: Fix character protrusion in `@microtype`.
+
+       First of all, character protrusion wasn't activated at all. 
+       Additionally, the code from the original `protcode.tex` was added
+       incompletely, causing far too large protrusion values.
+
+       * doc/texinfo.tex (\countB): New counter.
+       (\mtadjustprotcode, \mtadjustcp): New macros.
+       (\mtsetprotcode): Call `\mtadjustprotcode` to scale protrusion
+       values correctly.
+       (\microtypeON, \microtypeOFF): Switch on or off character
+       protrusion.
+
 2022-09-26  Werner Lemberg  <wl@gnu.org>
 
        * doc/texinfo.tex: Remove trailing spaces.
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index 516a3d29fc..034428b9ed 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -11418,21 +11418,49 @@ directory should work if nowhere else does.}
 
 % protrusion, from Thanh's protcode.tex.
 \def\mtsetprotcode#1{%
-    \rpcode#1`\!=200  \rpcode#1`\,=700  \rpcode#1`\-=700  \rpcode#1`\.=700
-    \rpcode#1`\;=500  \rpcode#1`\:=500  \rpcode#1`\?=200  \lpcode#1`\`=700
-    \rpcode#1`\'=700
-    \lpcode#1 92=500  % ``
-    \rpcode#1 34=500  % ''
-    \rpcode#1 123=300 % --
-    \rpcode#1 124=200 % ---
-    \rpcode#1`\)=50   \rpcode#1`\A=50   \rpcode#1`\F=50   \rpcode#1`\K=50
-    \rpcode#1`\L=50   \rpcode#1`\T=50   \rpcode#1`\V=50   \rpcode#1`\W=50
-    \rpcode#1`\X=50   \rpcode#1`\Y=50   \rpcode#1`\k=50   \rpcode#1`\r=50
-    \rpcode#1`\t=50   \rpcode#1`\v=50   \rpcode#1`\w=50   \rpcode#1`\x=50
-    \rpcode#1`\y=50   \lpcode#1`\(=50   \lpcode#1`\A=50   \lpcode#1`\J=50
-    \lpcode#1`\T=50   \lpcode#1`\V=50   \lpcode#1`\W=50   \lpcode#1`\X=50
-    \lpcode#1`\Y=50   \lpcode#1`\v=50   \lpcode#1`\w=50   \lpcode#1`\x=50
-    \lpcode#1`\y=0
+  \rpcode#1`\!=200  \rpcode#1`\,=700  \rpcode#1`\-=700  \rpcode#1`\.=700
+  \rpcode#1`\;=500  \rpcode#1`\:=500  \rpcode#1`\?=200
+  \rpcode#1`\'=700
+  \rpcode#1 34=500  % ''
+  \rpcode#1 123=300 % --
+  \rpcode#1 124=200 % ---
+  \rpcode#1`\)=50   \rpcode#1`\A=50   \rpcode#1`\F=50   \rpcode#1`\K=50
+  \rpcode#1`\L=50   \rpcode#1`\T=50   \rpcode#1`\V=50   \rpcode#1`\W=50
+  \rpcode#1`\X=50   \rpcode#1`\Y=50   \rpcode#1`\k=50   \rpcode#1`\r=50
+  \rpcode#1`\t=50   \rpcode#1`\v=50   \rpcode#1`\w=50   \rpcode#1`\x=50
+  \rpcode#1`\y=50
+  %
+  \lpcode#1`\`=700
+  \lpcode#1 92=500  % ``
+  \lpcode#1`\(=50   \lpcode#1`\A=50   \lpcode#1`\J=50   \lpcode#1`\T=50
+  \lpcode#1`\V=50   \lpcode#1`\W=50   \lpcode#1`\X=50   \lpcode#1`\Y=50
+  \lpcode#1`\v=50   \lpcode#1`\w=50   \lpcode#1`\x=50   \lpcode#1`\y=0
+  %
+  \mtadjustprotcode#1\relax
+}
+
+\def\mtadjustprotcode#1{%
+  \countA=0
+  \loop
+    \ifcase\lpcode#1\countA\else
+      \mtadjustcp\lpcode#1\countA
+    \fi
+    \ifcase\rpcode#1\countA\else
+      \mtadjustcp\rpcode#1\countA
+    \fi
+    \advance\countA 1
+  \ifnum\countA < 256 \repeat
+}
+
+\newcount\countB
+\def\mtadjustcp#1#2#3{%
+  \setbox\boxA=\hbox{%
+    \ifx#2\font\else#2\fi
+    \char#3}%
+  \countB=\wd\boxA
+  \multiply\countB #1#2#3\relax
+  \divide\countB \fontdimen6 #2\relax
+  #1#2#3=\countB\relax
 }
 
 \ifx\luatexversion\thisisundefined
@@ -11456,9 +11484,11 @@ directory should work if nowhere else does.}
   \ifx\luatexversion\thisisundefined
     \ifpdf % pdfTeX
       \pdfadjustspacing=2
+      \pdfprotrudechars=2
     \fi
   \else % LuaTeX
     \adjustspacing=2
+    \protrudechars=2
   \fi
   \mtfontexpand\textrm
   \mtfontexpand\textsl
@@ -11472,9 +11502,11 @@ directory should work if nowhere else does.}
   \ifx\luatexversion\thisisundefined
     \ifpdf % pdfTeX
       \pdfadjustspacing=0
+      \pdfprotrudechars=0
     \fi
   \else % LuaTeX
     \adjustspacing=0
+    \protrudechars=0
   \fi
 }
 
-- 
2.37.3

>From a366554f50fb28ef8be5e550b525fb7be9898227 Mon Sep 17 00:00:00 2001
From: Werner Lemberg <wl@gnu.org>
Date: Mon, 26 Sep 2022 14:14:23 +0200
Subject: [PATCH 3/3] * doc/texinfo.tex: Add character protrusion support for
 XeTeX.

(top-level, \microtypeON, \microtypeOFF): Do it.
---
 ChangeLog       |  6 +++++
 doc/texinfo.tex | 59 ++++++++++++++++++++++++++++++-------------------
 2 files changed, 42 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 02e7f4fb21..a4853da13d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-09-26  Werner Lemberg  <wl@gnu.org>
+
+       * doc/texinfo.tex: Add character protrusion support for XeTeX.
+
+       (top-level, \microtypeON, \microtypeOFF): Do it.
+
 2022-09-26  Werner Lemberg  <wl@gnu.org>
 
        * doc/texinfo.tex: Fix character protrusion in `@microtype`.
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index 034428b9ed..95bafb36c0 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -11463,16 +11463,21 @@ directory should work if nowhere else does.}
   #1#2#3=\countB\relax
 }
 
-\ifx\luatexversion\thisisundefined
-\ifpdf  % pdfTeX
-    \mtsetprotcode\textrm
-    \def\mtfontexpand#1{\pdffontexpand#1 20 20 1 autoexpand\relax}
-\else  % TeX
-    \def\mtfontexpand#1{}
-\fi
-\else  % LuaTeX
+\ifx\XeTeXrevision\thisisundefined
+  \ifx\luatexversion\thisisundefined
+    \ifpdf % pdfTeX
+      \mtsetprotcode\textrm
+      \def\mtfontexpand#1{\pdffontexpand#1 20 20 1 autoexpand\relax}
+    \else % TeX
+      \def\mtfontexpand#1{}
+    \fi
+  \else % LuaTeX
     \mtsetprotcode\textrm
     \def\mtfontexpand#1{\expandglyphsinfont#1 20 20 1\relax}
+  \fi
+\else % XeTeX
+  \mtsetprotcode\textrm
+  \def\mtfontexpand#1{}
 \fi
 
 
@@ -11481,32 +11486,40 @@ directory should work if nowhere else does.}
 \def\microtypeON{%
   \microtypetrue
   %
-  \ifx\luatexversion\thisisundefined
-    \ifpdf % pdfTeX
-      \pdfadjustspacing=2
-      \pdfprotrudechars=2
+  \ifx\XeTeXrevision\thisisundefined
+    \ifx\luatexversion\thisisundefined
+      \ifpdf % pdfTeX
+        \pdfadjustspacing=2
+        \pdfprotrudechars=2
+      \fi
+    \else % LuaTeX
+      \adjustspacing=2
+      \protrudechars=2
     \fi
-  \else % LuaTeX
-    \adjustspacing=2
-    \protrudechars=2
+  \else % XeTeX
+    \XeTeXprotrudechars=2
   \fi
+  %
   \mtfontexpand\textrm
   \mtfontexpand\textsl
   \mtfontexpand\textbf
-  %
 }
 
 \def\microtypeOFF{%
   \microtypefalse
   %
-  \ifx\luatexversion\thisisundefined
-    \ifpdf % pdfTeX
-      \pdfadjustspacing=0
-      \pdfprotrudechars=0
+  \ifx\XeTeXrevision\thisisundefined
+    \ifx\luatexversion\thisisundefined
+      \ifpdf % pdfTeX
+        \pdfadjustspacing=0
+        \pdfprotrudechars=0
+      \fi
+    \else % LuaTeX
+      \adjustspacing=0
+      \protrudechars=0
     \fi
-  \else % LuaTeX
-    \adjustspacing=0
-    \protrudechars=0
+  \else % XeTeX
+    \XeTeXprotrudechars=0
   \fi
 }
 
-- 
2.37.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]