[latex3-commits] [git/LaTeX3-latex3-latex2e] longtable4.14: two patches to handle shrink glue issue #183 (6009e123)

David Carlisle d.p.carlisle at gmail.com
Sun Mar 8 23:01:19 CET 2020


Repository : https://github.com/latex3/latex2e
On branch  : longtable4.14
Link       : https://github.com/latex3/latex2e/commit/6009e1233fc319f80c0bf29d40602eb6bd417933

>---------------------------------------------------------------

commit 6009e1233fc319f80c0bf29d40602eb6bd417933
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Sun Mar 8 22:01:19 2020 +0000

    two patches to handle shrink glue issue #183


>---------------------------------------------------------------

6009e1233fc319f80c0bf29d40602eb6bd417933
 required/tools/longtable.dtx                       | 41 +++++++++++++++++++++-
 .../tools/testfiles/github-0183b.tlg               |  3 ++
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/required/tools/longtable.dtx b/required/tools/longtable.dtx
index cf886010..56b684cc 100644
--- a/required/tools/longtable.dtx
+++ b/required/tools/longtable.dtx
@@ -1244,6 +1244,34 @@
   \let\LT at start\endgraf
   \endgraf\penalty\z@\vskip\LTpre\endgraf
 %    \end{macrocode}
+% \changes{v4.14}{2020/02/07}
+%      {Guard against shrink glue on current page tools/3396 and github 183}
+% This next block was suggested by Lars Hellström in pr tools/3396
+% He documents it as:
+%
+% The original problem occurs because TeX has not yet found an awfully bad
+% "(b=*)" breakpoint and is therefore still collecting material to see if there
+% is a really good break somewhere just ahead. As we know there aren't, we
+% want to make it stop looking and break the page, so that "\pagetotal" will be
+% for the page  where the table will actually end up. To achieve this, we
+% need to give \TeX\ an awfully bad, but legal, breakpoint. The simplest way of
+% doing this seems to be to insert a "\kern" that counters the "\pageshrink" for
+% the page, followed by a "\penalty" and a "\par" (to exercise the page builder).
+% We also have to make sure that this breakpoint doesn't affect how the next
+% page is broken, so we make the penalty 9999 (10000 is infinite and thus not
+% a legal breakpoint) and cancel out the "\kern" with a new "\kern".
+% 
+% I don't think this is the \emph{right} solution to the problem (that would be
+% that the standard output routine has a feature for syncronizing with
+% typesetting, as part of the preparations for switching output routine), but
+% it's OK. Perhaps XOR will make it better.
+%    \begin{macrocode}
+   \ifdim \pagetotal<\pagegoal \else
+      \dimen@=\pageshrink
+      \advance \dimen@ 1sp %
+      \kern\dimen@\penalty 9999\endgraf \kern-\dimen@
+   \fi
+%    \end{macrocode}
 % Start a new page if there is not enough room for the table head, foot,
 % and one extra line.
 %    \begin{macrocode}
@@ -1275,7 +1303,18 @@
 %
 %    \begin{macrocode}
   \advance\dimen@ -\pagegoal
-  \ifdim \dimen@>\z@\vfil\break\fi
+  \ifdim \dimen@>\z@
+    \vfil\break
+  \else
+%    \end{macrocode}
+%
+% \changes{v4.14}{2020/02/07}
+%      {Guard against shrink glue on current page see github 183}
+% The LT output routine does not handle shrink on the page, which can cause
+% The first page to be over-long, so forget it is there.
+%    \begin{macrocode}
+    \ifdim\pageshrink>\z@\pageshrink\z@\fi
+  \fi
 %    \end{macrocode}
 % Store height of page minus table foot in  "\@colroom".
 % \changes{v3.14}{1995/05/02}
diff --git a/base/testfiles/github-0060.xetex.tlg b/required/tools/testfiles/github-0183b.tlg
similarity index 66%
copy from base/testfiles/github-0060.xetex.tlg
copy to required/tools/testfiles/github-0183b.tlg
index 1d0c6975..1a417169 100644
--- a/base/testfiles/github-0060.xetex.tlg
+++ b/required/tools/testfiles/github-0183b.tlg
@@ -1,2 +1,5 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
+> 2.
+l. ...\showthe\count0
+[2] (github-0183b.aux)





More information about the latex3-commits mailing list.