bug-texinfo
[Top][All Lists]
Advanced

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

Re: comments on texinfo.tex changes


From: Karl Berry
Subject: Re: comments on texinfo.tex changes
Date: Tue, 23 Sep 2003 20:38:11 -0400

I'm out of time for today, but I think this change is a help.
It removes my misbegotten idea (from years ago) of "propagating" the
penalty past an index whatsit.

I looked at the first 100 pages of the manual and didn't see any widowed
headings.  Please let us know if you notice it further on.  There are a
lot of complicated interactions with the indexing commands and other
stuff, so it's hard to be sure there's no problematic case remaining.

However, it's not done yet, because on p.32, the Margin Settings
unnumbered section is followed by a "Register" defun entry for \n[P0]
and that is orphaned.  More \nobreak investigations tomorrow ...  for
the toc problems too.

Thanks,
k

P.S. Doesn't it seem the line spacing is cramped in this @smallbook
mode?  It has always bothered me.


*** texinfo.tex.~1.89.~ Tue Sep 23 05:55:21 2003
--- texinfo.tex Tue Sep 23 17:33:07 2003
***************
*** 3160,3232 ****
      \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
    \fi
    {%
!     \count255=\lastpenalty
      {%
!       \indexdummies % Must do this here, since \bf, etc expand at this stage
!       \escapechar=`\\
!       {%
!         \let\folio = 0% We will expand all macros now EXCEPT \folio.
!         \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined 
now
!         % so it will be output as is; and it will print as backslash.
!         %
!         % The main index entry text.
!         \toks0 = {#2}%
!         %
!         % If third arg is present, precede it with space in sort key.
!         \def\thirdarg{#3}%
!         \ifx\thirdarg\emptymacro \else
!            % If the third (subentry) arg is present, add it to the index
!            % line to write.
!           \toks0 = \expandafter{\the\toks0 \space #3}%
          \fi
          %
!         % Process the index entry with all font commands turned off, to
!         % get the string to sort by.
!         {\indexnofonts
!          \edef\temp{\the\toks0}% need full expansion
!          \xdef\indexsorttmp{\temp}%
!         }%
!         %
!         % Set up the complete index entry, with both the sort key and
!         % the original text, including any font commands.  We write
!         % three arguments to \entry to the .?? file (four in the
!         % subentry case), texindex reduces to two when writing the .??s
!         % sorted result.
!         \edef\temp{%
!           \write\csname#1indfile\endcsname{%
!             \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
!         }%
!         %
!         % If a skip is the last thing on the list now, preserve it
!         % by backing up by \lastskip, doing the \write, then inserting
!         % the skip again.  Otherwise, the whatsit generated by the
!         % \write will make \lastskip zero.  The result is that sequences
!         % like this:
!         % @end defun
!         % @tindex whatever
!         % @defun ...
!         % will have extra space inserted, because the \medbreak in the
!         % start of the @defun won't see the skip inserted by the @end of
!         % the previous defun.
!         %
!         % But don't do any of this if we're not in vertical mode.  We
!         % don't want to do a \vskip and prematurely end a paragraph.
          %
!         % Avoid page breaks due to these extra skips, too.
!         %
!         \iflinks
!           \ifvmode
!             \skip0 = \lastskip
!             \ifdim\lastskip = 0pt \else \nobreak\vskip-\skip0 \fi
!           \fi
!           %
!           \temp % do the write
!           %
!           \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
!         \fi
!       }%
      }%
-     \penalty\count255
    }%
  }
  
--- 3160,3235 ----
      \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
    \fi
    {%
!     \indexdummies % Must do this here, since \bf, etc expand at this stage
!     \escapechar=`\\
      {%
!       \let\folio = 0% We will expand all macros now EXCEPT \folio.
!       \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
!       % so it will be output as is; and it will print as backslash.
!       %
!       % The main index entry text.
!       \toks0 = {#2}%
!       %
!       % If third arg is present, precede it with space in sort key.
!       \def\thirdarg{#3}%
!       \ifx\thirdarg\emptymacro \else
!          % If the third (subentry) arg is present, add it to the index
!          % line to write.
!         \toks0 = \expandafter{\the\toks0 \space #3}%
!       \fi
!       %
!       % Process the index entry with all font commands turned off, to
!       % get the string to sort by.
!       {\indexnofonts
!        \edef\temp{\the\toks0}% need full expansion
!        \xdef\indexsorttmp{\temp}%
!       }%
!       %
!       % Set up the complete index entry, with both the sort key and
!       % the original text, including any font commands.  We write
!       % three arguments to \entry to the .?? file (four in the
!       % subentry case), texindex reduces to two when writing the .??s
!       % sorted result.
!       \edef\temp{%
!         \write\csname#1indfile\endcsname{%
!           \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
!       }%
!       %
!       % If a skip is the last thing on the list now, preserve it
!       % by backing up by \lastskip, doing the \write, then inserting
!       % the skip again.  Otherwise, the whatsit generated by the
!       % \write will make \lastskip zero.  The result is that sequences
!       % like this:
!       % @end defun
!       % @tindex whatever
!       % @defun ...
!       % will have extra space inserted, because the \medbreak in the
!       % start of the @defun won't see the skip inserted by the @end of
!       % the previous defun.
!       %
!       % But don't do any of this if we're not in vertical mode.  We
!       % don't want to do a \vskip and prematurely end a paragraph.
!       %
!       % Avoid page breaks due to these extra skips, too.
!       %
!       \iflinks
!         \ifvmode
!           \skip0 = \lastskip
!           % If \lastskip is nonzero, that means the last item was a
!           % skip.  And since a skip is discardable, that means this
!           % -\skip0 glue we're inserting is preceded by a
!           % non-discardable item, therefore it is not a potential
!           % breakpoint, therefore no \nobreak needed.
!           \ifdim\lastskip = 0pt \else \vskip-\skip0 \fi
          \fi
          %
!         \temp % do the write
          %
!         % Since this glue would be preceded by a non-discardable item
!         % (the whatsit from the \write), we must insert a \nobreak.
!         \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
!       \fi
      }%
    }%
  }
  




reply via email to

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