texlive[56774] Master/texmf-dist: latex (26oct20)

commits+karl at tug.org commits+karl at tug.org
Mon Oct 26 21:59:30 CET 2020


Revision: 56774
          http://tug.org/svn/texlive?view=revision&revision=56774
Author:   karl
Date:     2020-10-26 21:59:29 +0100 (Mon, 26 Oct 2020)
Log Message:
-----------
latex (26oct20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/sttools/README.md
    trunk/Master/texmf-dist/doc/latex/sttools/flushend.pdf
    trunk/Master/texmf-dist/source/latex/sttools/flushend.dtx
    trunk/Master/texmf-dist/tex/latex/sttools/flushend.sty

Modified: trunk/Master/texmf-dist/doc/latex/sttools/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/sttools/README.md	2020-10-26 20:59:05 UTC (rev 56773)
+++ trunk/Master/texmf-dist/doc/latex/sttools/README.md	2020-10-26 20:59:29 UTC (rev 56774)
@@ -1,4 +1,4 @@
-README for sttools, v2.0 2017/03/27
+README for sttools, v2.1 2020/10/16
 
 INTRODUCTION
 ============
@@ -17,7 +17,7 @@
 * floatpag.sty, v1.1 2012/05/29:
   – sets pagestyle for floats page;
 
-* flushend.sty, v3.3 2017/03/27:
+* flushend.sty, v3.5 2017/10/16:
   – balances page in twocolumn mode;
    (2014/03/03): totally rewritten with new algorithm to support footnotes,
         top floats and column break before one line section title;
@@ -28,6 +28,8 @@
    (2015/04/14): set debug option off by default; keeplastbox modified;
    (2016/06/21): bugfix compatibility with luatexja package;
    (2017/03/27): bugfix version with new options for some checks on/off;
+   (2020/10/14): bugfix development and test;
+   (2020/10/16): bugfix version: modern with noautobase;
 
 * marginal.sty, v1.1 2012/05/29:
   – enlarges room for marginal inserts;

Modified: trunk/Master/texmf-dist/doc/latex/sttools/flushend.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/sttools/flushend.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/sttools/flushend.dtx	2020-10-26 20:59:05 UTC (rev 56773)
+++ trunk/Master/texmf-dist/source/latex/sttools/flushend.dtx	2020-10-26 20:59:29 UTC (rev 56774)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment/*%    \end{macrocode}*/
 %
-% Copyright (C) 2017 by Sigitas Tolu\v{s}is <sigitas at vtex.lt>
+% Copyright (C) 2020 by Sigitas Tolu\v{s}is <sigitas at vtex.lt>
 % ---------------------------------------------------------------------------
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3
@@ -26,7 +26,16 @@
 %<*batchfile>
 \input docstrip.tex
 \keepsilent\askforoverwritefalse
-\nopreamble\nopostamble
+\preamble
+%%
+%% This is file `flushend.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% flushend.dtx  (with options: `package')
+%% 
+\endpreamble
 \generate{\file{flushend.sty}{\from{flushend.dtx}{package}}}
 %</batchfile>
 %<batchfile>\endbatchfile
@@ -38,9 +47,8 @@
 \ProvidesFile{flushend.dtx}
 %</driver>
 %<*package>
-%% Copyright (C) 1997-2017 by Sigitas Tolu\v{s}is <sigitas at vtex.lt>
+%% Copyright (C) 1997-2020 by Sigitas Tolu\v{s}is <sigitas at vtex.lt>
 %% VTeX Ltd., Mokslinink\k{u} 2a, Vilnius, Lithuania
-%% http://www.vtex.lt/tex/download/macros/
 %% --------------------------------------------------------------------------
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3
@@ -56,12 +64,12 @@
 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
 %<package>\ProvidesPackage{flushend}
 %<*package>
-    [2017/03/27 v3.3 Balancing columns in twocolumn mode]
+    [2020/10/16 v3.5 Balancing columns in twocolumn mode]
 %</package>
 %
 %<*driver>
 \documentclass{ltxdoc}
-\usepackage{flushend}[2016/06/21]
+\usepackage{flushend}[2020/10/16]
 \EnableCrossrefs
 \CodelineIndex
 %%\RecordChanges
@@ -74,7 +82,7 @@
 %</driver>
 % \fi
 %
-% \CheckSum{1855}
+% \CheckSum{2020}
 %
 % \CharacterTable
 %  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -104,9 +112,11 @@
 %                            ancient/modern,
 %                            spread/nospread,
 %                            removelastbox/keeplastbox}
-% \changes{v3.1}{2015/04/14}{set debug option off by default; keeplastbox modified;} 
-% \changes{v3.2}{2016/06/21}{bugfix compatibility with luatexja} 
-% \changes{v3.3}{2017/03/27}{bugfix for get@@footnoterule@@box; options for some checks on/off} 
+% \changes{v3.1}{2015/04/14}{set debug option off by default; keeplastbox modified;}
+% \changes{v3.2}{2016/06/21}{bugfix compatibility with luatexja}
+% \changes{v3.3}{2017/03/27}{bugfix for get@@footnoterule@@box; options for some checks on/off}
+% \changes{v3.4}{2020/10/14}{bugfix development and test}
+% \changes{v3.5}{2020/10/16}{bugfix version: modern with noautobase}
 %
 % \DoNotIndex{\newcommand,\newenvironment}
 %
@@ -121,16 +131,16 @@
 % \section{Introduction}
 %
 % The package is used to balance columns on any page in twocolumn
-% mode. By default it is switched on at the end of document. It is 
-% expected to work with footnotes, top floats and column break 
+% mode. By default it is switched on at the end of document. It is
+% expected to work with footnotes, top floats and column break
 % before one line section title.
 %
 % \section{Usage}
 %
-% Just load the package to balance the last page: that's all. 
+% Just load the package to balance the last page: that's all.
 % To balance some page in middle of document use command
-% \cs{flushcolsend} at that page. 
-% 
+% \cs{flushcolsend} at that page.
+%
 % \medskip
 % \DescribeMacro{\flushend}
 %
@@ -168,7 +178,7 @@
 % Adds \meta{tokens} at the end of right column.
 %
 % \medskip
-% \textit{Example}: |\atColsEnd{\vfil}|. 
+% \textit{Example}: |\atColsEnd{\vfil}|.
 %
 % \medskip
 % \DescribeMacro{\showcolsendrule}
@@ -176,24 +186,24 @@
 % It can be used just for debugging: adds rule to the bottom of columns.
 %
 % \subsection{Package options}
-% 
+%
 % \medskip
 % \DescribeMacro{ancient}
 %   It is used to switch on old version of balancing algorithm.
 %   This version is not so accurate or "clever" but quite safe.
-% 
+%
 % \medskip
 % \DescribeMacro{modern}
 %   [default] It is used to switch on new version of balancing algorithm.
 %   This version has some heuristic guesses for footnotes, floats
 %   and section like head skip. So it is more dangerous in the case
-%   for text misplace or disappear. 
+%   for text misplace or disappear.
 %
 % \medskip
 % \DescribeMacro{autobase}
 %   [default] It is used to guess |\baselineskip| value on original columns
 %   break. On failure just use |\atColsBreak{...}|.
-% 
+%
 % \medskip
 % \DescribeMacro{noautobase}
 %   It is used to switch off the previous option behaviour.
@@ -201,7 +211,7 @@
 % \medskip
 % \DescribeMacro{spread}
 %   [default] It adds extra glue to the rightcolumn trying to balance.
-% 
+%
 % \medskip
 % \DescribeMacro{nospread}
 %   It skips adding extra glue to the last column.
@@ -209,11 +219,11 @@
 % \medskip
 % \DescribeMacro{removelastbox}
 %   [default] It tries to remove an empty box (some more material) from the last column bottom.
-% 
+%
 % \medskip
 % \DescribeMacro{keeplastbox}
-%   It skips removing anything from the last column. As example it is usefull and can be used 
-%   then document ends by reference item and last line of text should be with indend. 
+%   It skips removing anything from the last column. As example it is usefull and can be used
+%   then document ends by reference item and last line of text should be with indend.
 %
 % \medskip
 % \DescribeMacro{checkfootnote}
@@ -241,7 +251,7 @@
 %   [default] Skips putting debuging lines.
 %
 % \StopEventually{}
-% 
+%
 % \section{Implementation}
 %
 % \iffalse
@@ -257,10 +267,10 @@
 \newif\if at balance@debug \@balance at debugfalse
 \DeclareOption{autobase}{\global\@auto at baselineskiptrue}
 \DeclareOption{noautobase}{\global\@auto at baselineskipfalse}
-\DeclareOption{ancient}{\global\@ancient at balance@versiontrue} 
-\DeclareOption{modern}{\global\@ancient at balance@versionfalse} 
-\DeclareOption{spread}{\global\@right at column@spreadtrue} 
-\DeclareOption{nospread}{\global\@right at column@spreadfalse} 
+\DeclareOption{ancient}{\global\@ancient at balance@versiontrue}
+\DeclareOption{modern}{\global\@ancient at balance@versionfalse}
+\DeclareOption{spread}{\global\@right at column@spreadtrue}
+\DeclareOption{nospread}{\global\@right at column@spreadfalse}
 \DeclareOption{removelastbox}{\global\@remove at lastbox@at at balancingtrue}
 \DeclareOption{keeplastbox}{\global\@remove at lastbox@at at balancingfalse}
 \DeclareOption{checkfootnote}{%
@@ -293,9 +303,11 @@
 \newskip\flushend@@lastskip at b
 \newskip\flushend@@lastskip at c
 \newcount\flushend@@penalty at a
+\newcount\var@@loop at iter
 \newdimen\flushend@@lastkern at a
 \newdimen\var@@temp at spread
 \newdimen\var@@temp at a
+\newdimen\var@@temp at loop
 \def\top@@skip@@limit{.7\topskip}
 \newdimen\flushend@@page at rule \flushend@@page at rule\z@
 \def\showcolsendrule{\global\flushend@@page at rule=.4\p@}
@@ -353,7 +365,7 @@
     }
 \def\set at split@topskip at to#1{%
     \splittopskip#1\relax \vfuzz\maxdimen \vbadness\maxdimen
-    }	
+    }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -373,28 +385,28 @@
 %
 % To get more or less proper result we need to know about footnotes at
 % the left column end, top floats at the right column top, skips and
-% so on. This part of the package is responsible for such analysis. 
+% so on. This part of the package is responsible for such analysis.
 %
 %    \begin{macrocode}
 \gdef\analyze at lastbox@box#1{%
     \setbox\flushend@@varbox at a\vbox{%
         \unvbox#1%
-        \global\flushend@@lastskip at a\lastskip 
+        \global\flushend@@lastskip at a\lastskip
         \unskip
-        \global\var@@temp at a\lastkern 
+        \global\var@@temp at a\lastkern
         \unkern
-        \global\flushend@@penalty at a\lastpenalty 
+        \global\flushend@@penalty at a\lastpenalty
         \unpenalty
         \ifdim\lastskip>\z@
-            \global\flushend@@lastskip at a\lastskip 
-        \fi 
+            \global\flushend@@lastskip at a\lastskip
+        \fi
         \unskip
         \ifdim\lastkern>\z@
-            \global\var@@temp at a\lastkern 
-        \fi 
+            \global\var@@temp at a\lastkern
+        \fi
         \unkern
         \ifnum\lastpenalty>\z@
-            \global\flushend@@penalty at a\lastpenalty 
+            \global\flushend@@penalty at a\lastpenalty
         \fi
         \unpenalty
         \global\setbox\flushend@@tempbox at a\lastbox
@@ -402,7 +414,7 @@
     \wlog at balance@debug{^^J::analyze at lastbox@box::\log at box@info{#1}%
                         ^^J ::unvbox: \log at box@info{\flushend@@varbox at a}%
                         ^^J::lastbox: \log at box@info{\flushend@@tempbox at a}%
-                        ^^J::lastskip: \the\flushend@@lastskip at a; 
+                        ^^J::lastskip: \the\flushend@@lastskip at a;
                             lastkern: \the\var@@temp at a;
                          lastpenalty: \the\flushend@@penalty at a
                        }%
@@ -425,11 +437,11 @@
     \wlog at balance@debug{^^Jmainbox: \log at box@info{#1}}%
     \setbox\flushend@@varbox at a\vbox{%
         \unvbox#1%
-        \global\flushend@@lastskip at a\lastskip 
+        \global\flushend@@lastskip at a\lastskip
         \unskip
         \global\flushend@@lastkern at a\lastkern
         \unkern
-        \global\flushend@@penalty at a\lastpenalty 
+        \global\flushend@@penalty at a\lastpenalty
         \unpenalty
         \global\setbox\flushend@@tempbox at a\lastbox
         }%
@@ -437,8 +449,8 @@
     \advance\flushend@@lastskip at b -\ht\flushend@@tempbox at a
     \wlog at balance@debug{.-box: \log at box@info{\flushend@@varbox at a}%
                  ^^J.-lastbox: \log at box@info{\flushend@@tempbox at a}%
-                ^^J.-lastskip: \the\flushend@@lastskip at a; 
-                     lastkern: \the\flushend@@lastkern at a; 
+                ^^J.-lastskip: \the\flushend@@lastskip at a;
+                     lastkern: \the\flushend@@lastkern at a;
                   lastpenalty: \the\flushend@@penalty at a
                     ^^J.-diff: \the\flushend@@lastskip at b
         }%
@@ -486,6 +498,16 @@
                 \wlog at balance@debug{lastbox: \log at box@info{\flushend@@varbox at a}}%
             \fi
         \fi
+        \ifdim\var@@temp at loop=\ht\flushend@@varbox at a\relax
+           \global\advance\var@@loop at iter\@ne
+        \fi
+        \var@@temp at loop=\ht\flushend@@varbox at a\relax
+        \ifnum\var@@loop at iter<3\relax
+            \wlog at balance@debug{analyze left col: iteration \number\var@@loop at iter; ht \the\var@@temp at loop}%
+        \else
+            \wlog at balance@debug{analyze left col loop limit!}%
+            \ht\flushend@@varbox at a\z@
+        \fi
         \ifdim\ht\flushend@@varbox at a>\topskip
             \expandafter\analyze at leftcolumn@box\expandafter\flushend@@varbox at a
         \fi
@@ -497,7 +519,7 @@
 % \begin{macro}{\get@@footnoterule@@box}
 %
 % Gets dimensions of the box made by |footnoterule| and writes to:
-% |\footnoterule@@box@@ht|, |\footnoterule@@box@@dp|, |\footnoterule@@box@@wd|. 
+% |\footnoterule@@box@@ht|, |\footnoterule@@box@@dp|, |\footnoterule@@box@@wd|.
 %
 %    \begin{macrocode}
 \def\get@@footnoterule@@box{%
@@ -522,8 +544,8 @@
 %
 % Checks if \marg{box1} dimensions equals to |footnoterule| box dimensions.
 % If so and if \marg{skip} is not |\topskip| we guess it is footnote.
-% In that case we define |leftcolumn| height without |footnote| as  
-% \marg{box2} height and save it as |\main at box@height|. Skip from text to 
+% In that case we define |leftcolumn| height without |footnote| as 
+% \marg{box2} height and save it as |\main at box@height|. Skip from text to
 % footnote define as |\main at box@skip|.
 %
 %    \begin{macrocode}
@@ -536,8 +558,8 @@
                 \else
                     \xdef\main at box@height{\the\ht#3}%
                     \xdef\main at box@skip{\the#2}%
-                    \wlog at balance@debug{^^J:footnoterule found: 
-                                        main at box <ht=\main at box@height, 
+                    \wlog at balance@debug{^^J:footnoterule found:
+                                        main at box <ht=\main at box@height,
                                         skip=\main at box@skip>
                                        }%
                     \global\let\check@@footnoterule@@box\@gobblethree
@@ -569,8 +591,8 @@
 \let\initial at check@@baselineskip@@skip\check@@baselineskip@@skip
 %    \end{macrocode}
 %
-% In the case we found footnote it is necessary to look for the last skip 
-% between text lines again. For that we use 
+% In the case we found footnote it is necessary to look for the last skip
+% between text lines again. For that we use
 % |\reset at check@@baselineskip@@skip|. It activates |\check@@baselineskip@@skip|.
 %
 %    \begin{macrocode}
@@ -693,7 +715,17 @@
                     \ifdim\flushend@@lastskip at b>\topskip
                         \xdef\top@@section at skip{\the\flushend@@lastskip at b}%
                     \fi
-                \ifdim\ht\flushend@@varbox at a>2\topskip 
+                    \ifdim\var@@temp at loop=\ht\flushend@@varbox at a\relax
+                        \advance\var@@loop at iter\@ne
+                    \fi
+                    \var@@temp at loop=\ht\flushend@@varbox at a\relax
+                    \ifnum\var@@loop at iter<3\relax
+                        \wlog at balance@debug{analyze right col: iteration \number\var@@loop at iter; ht \the\var@@temp at loop}%
+                    \else
+                        \wlog at balance@debug{analyze right col loop limit!}%
+                        \ht\flushend@@varbox at a=\z@
+                    \fi
+                \ifdim\ht\flushend@@varbox at a>2\topskip
                     \setbox\flushend@@tempbox at c\vbox{\unvbox\flushend@@varbox at a}%
                 \repeat
             \fi
@@ -705,7 +737,7 @@
 %
 % \begin{macro}{\combine at columns@for at balance}
 %
-% Collects both columns to one box removing left column footnotes 
+% Collects both columns to one box removing left column footnotes
 % and right column top float and adding right skip in between them.
 %
 %    \begin{macrocode}
@@ -725,9 +757,11 @@
         \setbox\@tempboxa\vbox{%
             \unvbox\flushend@@varbox at a
             \unskip\unkern\unpenalty
+            \hrule\@height\flushend@@page at rule width\columnwidth
+            \vskip-\flushend@@page at rule
+            \hrule\@height\z@ width\columnwidth
             \vskip\flushend@@lastskip at c
             \the\atColsBreak
-            \hrule\@height\flushend@@page at rule width\columnwidth
             \ifdim\top@@section at skip>\top@@skip@@limit
                 \vskip\top@@section at skip
             \fi
@@ -741,11 +775,12 @@
     \else
         %% Ignore baselineskip value on column break
         \setbox\@tempboxa\vbox{%
-            \unvbox\@leftcolumn
-            \setbox\z@\lastbox
+            \unvbox\flushend@@varbox at a
             \unskip\unkern\unpenalty
+            \hrule\@height\flushend@@page at rule width\columnwidth
+            \vskip-\flushend@@page at rule
+            \hrule\@height\z@ width\columnwidth
             \the\atColsBreak
-            \hrule\@height\flushend@@page at rule width\columnwidth
             \unvbox\@outputbox
             \remove at lastbox@at at balancing
             \the\atColsEnd
@@ -758,11 +793,11 @@
 % \begin{macro}{\set at outputbox@with at footnote}
 %
 % Calculates break position and formats balanced columns in the |\@outputbox|
-% with footnotes.  
+% with footnotes. 
 %
 %    \begin{macrocode}
 \def\set at outputbox@with at footnote{%
-    %% footnote in left column 
+    %% footnote in left column
     \@tempdimb\ht\@tempboxa
     \ifdim\top@@floatbox at skip>\z@
         \advance\@tempdimb \top@@floatbox at skip
@@ -819,6 +854,8 @@
             \vss
             }%
         \hrule\@height\flushend@@page at rule width\textwidth
+        \vskip-\flushend@@page at rule
+        \hrule\@height\z@ width\columnwidth
         \vss
         }%
     \global\ht\@leftcolumn=\the\@tempdima
@@ -868,11 +905,11 @@
 % \begin{macro}{\set at outputbox@without at footnote}
 %
 % Calculates break position and formats balanced columns in the |\@outputbox|
-% without footnotes.  
+% without footnotes. 
 %
 %    \begin{macrocode}
 \def\set at outputbox@without at footnote{%
-    %% no footnote in left column 
+    %% no footnote in left column
     \@tempdimb \ht\@tempboxa
     \ifdim\top@@floatbox at skip>\z@
         \advance\@tempdimb \top@@floatbox at skip
@@ -919,6 +956,8 @@
     \setbox\@leftcolumn\vbox to\@tempdima{%
         \vbox to\@tempdimb{\unvbox\flushend@@varbox at c\vss}%
         \hrule\@height\flushend@@page at rule width\textwidth
+        \vskip-\flushend@@page at rule
+        \hrule\@height\z@ width\textwidth
         \vss
         }%
     \global\ht\@leftcolumn=\the\@tempdima
@@ -963,39 +1002,58 @@
 % Columns balancing of the twocolumn mode page (modern algorithm).
 % It is maybe not so safe for text moving or missing at all
 % as it uses some heuristic technique to find footnotes, last skip between lines
-% at left column and floats or section like heads at right column top 
-% for replacing them (except heads of course) to other places in text. 
-% 
+% at left column and floats or section like heads at right column top
+% for replacing them (except heads of course) to other places in text.
+%
 %    \begin{macrocode}
 \def\last at outputdblcol@modern{%
     \if at firstcolumn
         \global \@firstcolumnfalse
-        \global \setbox\@leftcolumn \box\@outputbox
+        \global\setbox\@leftcolumn\copy\@outputbox
+        \splitmaxdepth\maxdimen
+        \vbadness\maxdimen
+        \setbox\@outputbox\vbox{\unvbox\@outputbox\unskip}%
+        \setbox\@outputbox\vsplit\@outputbox to\maxdimen
+        \toks@\expandafter{\topmark}%
+        \xdef\@firstcoltopmark{\the\toks@}%
+        \toks@\expandafter{\splitfirstmark}%
+        \xdef\@firstcolfirstmark{\the\toks@}%
+        \ifx\@firstcolfirstmark\@empty
+            \global\let\@setmarks\relax
+        \else
+            \gdef\@setmarks{%
+                \let\firstmark\@firstcolfirstmark
+                \let\topmark\@firstcoltopmark
+                }%
+        \fi
     \else
         \global \@firstcolumntrue
         \@tempdima\ht\@leftcolumn
+        \advance\@tempdima by\dp\@leftcolumn
         \set at split@topskip at to\topskip
         \var@@temp at spread=\wd\@outputbox
         \get@@footnoterule@@box
         \xdef\main at box@height{\the\ht\@leftcolumn}%
         \xdef\main at box@skip{\z@}%
-        \global\flushend@@lastskip at c\z@
-        \setbox\flushend@@varbox at a\vbox{\unvcopy\@leftcolumn}%    
+        \reset at check@@baselineskip@@skip\relax\relax\flushend@@lastskip at c
+        \setbox\flushend@@varbox at a\vbox{\unvcopy\@leftcolumn}%
+        \var@@loop at iter\z@ \var@@temp at loop\z@
         \analyze at leftcolumn@box\flushend@@varbox at a
-        \setbox\flushend@@varbox at a\vbox{\unvcopy\@outputbox}%    
+        \setbox\flushend@@varbox at a\vbox{\unvcopy\@outputbox}%
+        \var@@loop at iter\z@ \var@@temp at loop\z@
         \analyze at rightcolumn@box\flushend@@varbox at a
-        \ifdim\main at box@skip>\z@ 
-            %% footnote in left column  
+        \ifdim\main at box@skip>\z@
+            %% footnote in left column
             \set at split@topskip at to\z@
             \setbox\flushend@@varbox at a\vsplit\@leftcolumn to\main at box@height
-        \else 
-            %% no footnote in left column  
+        \else
+            %% no footnote in left column
             \setbox\flushend@@varbox at a\box\@leftcolumn
         \fi
-        \ifdim\var@@temp at spread>\z@ 
+        \ifdim\var@@temp at spread>\z@
             %% rightcolumn non empty
             \combine at columns@for at balance
-  	    \else                       
+       \else
             %% rightcolumn empty
             \setbox\@tempboxa\vbox{%
                 \unvbox\flushend@@varbox at a
@@ -1002,12 +1060,12 @@
                 \remove at lastbox@at at balancing
                 \the\atColsEnd
                 }%
-  	    \fi
+       \fi
         \ifdim\main at box@skip>\z@
-            %% footnote in left column 
+            %% footnote in left column
             \set at outputbox@with at footnote
         \else
-            %% no footnote in left column 
+            %% no footnote in left column
   	        \set at outputbox@without at footnote
         \fi
         \setbox\@outputbox \vbox {%
@@ -1028,6 +1086,7 @@
             \setbox\@outputbox\vbox{\box\hold at viper\box\@outputbox}%
         \fi
         \@combinedblfloats
+        \csname @setmarks\endcsname
         \@outputpage
         \begingroup
             \@dblfloatplacement
@@ -1050,9 +1109,9 @@
 % \begin{macro}{\last at outputdblcol@old}
 %
 % Columns balancing of the twocolumn mode page (ancient algorithm).
-% It is maybe not so good in some cases but maybe more safe for text 
+% It is maybe not so good in some cases but maybe more safe for text
 % moving or missing at all.
-% 
+%
 %    \begin{macrocode}
 \def\last at outputdblcol@ancient{%
     \if at firstcolumn
@@ -1096,6 +1155,8 @@
                 \unskip\unpenalty
                 \vskip\flushend@@lastskip at c
                 \hrule\@height\flushend@@page at rule width\columnwidth
+                \vskip-\flushend@@page at rule
+                \hrule\@height\z@ width\textwidth
                 \the\atColsBreak
                 \unvbox\@outputbox
                 \remove at lastbox@at at balancing
@@ -1107,6 +1168,8 @@
                 \setbox\z@\lastbox
                 \unskip
                 \hrule\@height\flushend@@page at rule width\columnwidth
+                \vskip-\flushend@@page at rule
+                \hrule\@height\z@ width\textwidth
                 \the\atColsBreak
                 \unvbox\@outputbox
                 \remove at lastbox@at at balancing
@@ -1132,8 +1195,8 @@
                 \vsplit\flushend@@tempbox at a to\@tempdimb
                 \vss
                 }%
-            \wlog{(2)Left:\the\ht\flushend@@tempbox at c\space 
-                    Right:\the\ht\flushend@@tempbox at a\space 
+            \wlog{(2)Left:\the\ht\flushend@@tempbox at c\space
+                    Right:\the\ht\flushend@@tempbox at a\space
                    Output:\the\@tempdimb
                  }%
         \ifdim\ht\flushend@@tempbox at c<\ht\flushend@@tempbox at a
@@ -1156,6 +1219,8 @@
                     }%
                 }%
             \hrule\@height\flushend@@page at rule
+            \vskip-\flushend@@page at rule
+            \hrule\@height\z@ width\textwidth
             \vss
             }%
         \setbox\@outputbox\vbox to\@tempdima{%
@@ -1166,6 +1231,8 @@
                     }%
                 }%
             \hrule\@height\flushend@@page at rule
+            \vskip-\flushend@@page at rule
+            \hrule\@height\z@ width\textwidth
             \vss
             }%
         \setbox\@outputbox\vbox{%
@@ -1235,7 +1302,7 @@
 \def\raggedcolsend{\global\let\@outputdblcol\saved at orig@@outputdblcol}
 %    \end{macrocode}
 %
-% \cs{flushend} is used to switch on column balancing on the last page. 
+% \cs{flushend} is used to switch on column balancing on the last page.
 % It is used by default.
 %
 %    \begin{macrocode}

Modified: trunk/Master/texmf-dist/tex/latex/sttools/flushend.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/sttools/flushend.sty	2020-10-26 20:59:05 UTC (rev 56773)
+++ trunk/Master/texmf-dist/tex/latex/sttools/flushend.sty	2020-10-26 20:59:29 UTC (rev 56774)
@@ -6,9 +6,8 @@
 %%
 %% flushend.dtx  (with options: `package')
 %% 
-%% Copyright (C) 1997-2017 by Sigitas Tolu\v{s}is <sigitas at vtex.lt>
+%% Copyright (C) 1997-2020 by Sigitas Tolu\v{s}is <sigitas at vtex.lt>
 %% VTeX Ltd., Mokslinink\k{u} 2a, Vilnius, Lithuania
-%% http://www.vtex.lt/tex/download/macros/
 %% --------------------------------------------------------------------------
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3
@@ -22,7 +21,7 @@
 %%
 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
 \ProvidesPackage{flushend}
-    [2017/03/27 v3.3 Balancing columns in twocolumn mode]
+    [2020/10/16 v3.5 Balancing columns in twocolumn mode]
 \newif\if at auto@baselineskip \@auto at baselineskiptrue
 \newif\if at ancient@balance at version \@ancient at balance@versionfalse
 \newif\if at right@column at spread \@right at column@spreadtrue
@@ -63,9 +62,11 @@
 \newskip\flushend@@lastskip at b
 \newskip\flushend@@lastskip at c
 \newcount\flushend@@penalty at a
+\newcount\var@@loop at iter
 \newdimen\flushend@@lastkern at a
 \newdimen\var@@temp at spread
 \newdimen\var@@temp at a
+\newdimen\var@@temp at loop
 \def\top@@skip@@limit{.7\topskip}
 \newdimen\flushend@@page at rule \flushend@@page at rule\z@
 \def\showcolsendrule{\global\flushend@@page at rule=.4\p@}
@@ -211,6 +212,16 @@
                 \wlog at balance@debug{lastbox: \log at box@info{\flushend@@varbox at a}}%
             \fi
         \fi
+        \ifdim\var@@temp at loop=\ht\flushend@@varbox at a\relax
+           \global\advance\var@@loop at iter\@ne
+        \fi
+        \var@@temp at loop=\ht\flushend@@varbox at a\relax
+        \ifnum\var@@loop at iter<3\relax
+            \wlog at balance@debug{analyze left col: iteration \number\var@@loop at iter; ht \the\var@@temp at loop}%
+        \else
+            \wlog at balance@debug{analyze left col loop limit!}%
+            \ht\flushend@@varbox at a\z@
+        \fi
         \ifdim\ht\flushend@@varbox at a>\topskip
             \expandafter\analyze at leftcolumn@box\expandafter\flushend@@varbox at a
         \fi
@@ -366,6 +377,16 @@
                     \ifdim\flushend@@lastskip at b>\topskip
                         \xdef\top@@section at skip{\the\flushend@@lastskip at b}%
                     \fi
+                    \ifdim\var@@temp at loop=\ht\flushend@@varbox at a\relax
+                        \advance\var@@loop at iter\@ne
+                    \fi
+                    \var@@temp at loop=\ht\flushend@@varbox at a\relax
+                    \ifnum\var@@loop at iter<3\relax
+                        \wlog at balance@debug{analyze right col: iteration \number\var@@loop at iter; ht \the\var@@temp at loop}%
+                    \else
+                        \wlog at balance@debug{analyze right col loop limit!}%
+                        \ht\flushend@@varbox at a=\z@
+                    \fi
                 \ifdim\ht\flushend@@varbox at a>2\topskip
                     \setbox\flushend@@tempbox at c\vbox{\unvbox\flushend@@varbox at a}%
                 \repeat
@@ -389,9 +410,11 @@
         \setbox\@tempboxa\vbox{%
             \unvbox\flushend@@varbox at a
             \unskip\unkern\unpenalty
+            \hrule\@height\flushend@@page at rule width\columnwidth
+            \vskip-\flushend@@page at rule
+            \hrule\@height\z@ width\columnwidth
             \vskip\flushend@@lastskip at c
             \the\atColsBreak
-            \hrule\@height\flushend@@page at rule width\columnwidth
             \ifdim\top@@section at skip>\top@@skip@@limit
                 \vskip\top@@section at skip
             \fi
@@ -405,11 +428,12 @@
     \else
         %% Ignore baselineskip value on column break
         \setbox\@tempboxa\vbox{%
-            \unvbox\@leftcolumn
-            \setbox\z@\lastbox
+            \unvbox\flushend@@varbox at a
             \unskip\unkern\unpenalty
+            \hrule\@height\flushend@@page at rule width\columnwidth
+            \vskip-\flushend@@page at rule
+            \hrule\@height\z@ width\columnwidth
             \the\atColsBreak
-            \hrule\@height\flushend@@page at rule width\columnwidth
             \unvbox\@outputbox
             \remove at lastbox@at at balancing
             \the\atColsEnd
@@ -474,6 +498,8 @@
             \vss
             }%
         \hrule\@height\flushend@@page at rule width\textwidth
+        \vskip-\flushend@@page at rule
+        \hrule\@height\z@ width\columnwidth
         \vss
         }%
     \global\ht\@leftcolumn=\the\@tempdima
@@ -565,6 +591,8 @@
     \setbox\@leftcolumn\vbox to\@tempdima{%
         \vbox to\@tempdimb{\unvbox\flushend@@varbox at c\vss}%
         \hrule\@height\flushend@@page at rule width\textwidth
+        \vskip-\flushend@@page at rule
+        \hrule\@height\z@ width\textwidth
         \vss
         }%
     \global\ht\@leftcolumn=\the\@tempdima
@@ -605,19 +633,38 @@
 \def\last at outputdblcol@modern{%
     \if at firstcolumn
         \global \@firstcolumnfalse
-        \global \setbox\@leftcolumn \box\@outputbox
+        \global\setbox\@leftcolumn\copy\@outputbox
+        \splitmaxdepth\maxdimen
+        \vbadness\maxdimen
+        \setbox\@outputbox\vbox{\unvbox\@outputbox\unskip}%
+        \setbox\@outputbox\vsplit\@outputbox to\maxdimen
+        \toks@\expandafter{\topmark}%
+        \xdef\@firstcoltopmark{\the\toks@}%
+        \toks@\expandafter{\splitfirstmark}%
+        \xdef\@firstcolfirstmark{\the\toks@}%
+        \ifx\@firstcolfirstmark\@empty
+            \global\let\@setmarks\relax
+        \else
+            \gdef\@setmarks{%
+                \let\firstmark\@firstcolfirstmark
+                \let\topmark\@firstcoltopmark
+                }%
+        \fi
     \else
         \global \@firstcolumntrue
         \@tempdima\ht\@leftcolumn
+        \advance\@tempdima by\dp\@leftcolumn
         \set at split@topskip at to\topskip
         \var@@temp at spread=\wd\@outputbox
         \get@@footnoterule@@box
         \xdef\main at box@height{\the\ht\@leftcolumn}%
         \xdef\main at box@skip{\z@}%
-        \global\flushend@@lastskip at c\z@
+        \reset at check@@baselineskip@@skip\relax\relax\flushend@@lastskip at c
         \setbox\flushend@@varbox at a\vbox{\unvcopy\@leftcolumn}%
+        \var@@loop at iter\z@ \var@@temp at loop\z@
         \analyze at leftcolumn@box\flushend@@varbox at a
         \setbox\flushend@@varbox at a\vbox{\unvcopy\@outputbox}%
+        \var@@loop at iter\z@ \var@@temp at loop\z@
         \analyze at rightcolumn@box\flushend@@varbox at a
         \ifdim\main at box@skip>\z@
             %% footnote in left column
@@ -663,6 +710,7 @@
             \setbox\@outputbox\vbox{\box\hold at viper\box\@outputbox}%
         \fi
         \@combinedblfloats
+        \csname @setmarks\endcsname
         \@outputpage
         \begingroup
             \@dblfloatplacement
@@ -722,6 +770,8 @@
                 \unskip\unpenalty
                 \vskip\flushend@@lastskip at c
                 \hrule\@height\flushend@@page at rule width\columnwidth
+                \vskip-\flushend@@page at rule
+                \hrule\@height\z@ width\textwidth
                 \the\atColsBreak
                 \unvbox\@outputbox
                 \remove at lastbox@at at balancing
@@ -733,6 +783,8 @@
                 \setbox\z@\lastbox
                 \unskip
                 \hrule\@height\flushend@@page at rule width\columnwidth
+                \vskip-\flushend@@page at rule
+                \hrule\@height\z@ width\textwidth
                 \the\atColsBreak
                 \unvbox\@outputbox
                 \remove at lastbox@at at balancing
@@ -782,6 +834,8 @@
                     }%
                 }%
             \hrule\@height\flushend@@page at rule
+            \vskip-\flushend@@page at rule
+            \hrule\@height\z@ width\textwidth
             \vss
             }%
         \setbox\@outputbox\vbox to\@tempdima{%
@@ -792,6 +846,8 @@
                     }%
                 }%
             \hrule\@height\flushend@@page at rule
+            \vskip-\flushend@@page at rule
+            \hrule\@height\z@ width\textwidth
             \vss
             }%
         \setbox\@outputbox\vbox{%



More information about the tex-live-commits mailing list.