From 3b6712112858f1def3b95f5d4ce48503cc6a84b3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 26 Oct 2020 20:59:29 +0000 Subject: latex (26oct20) git-svn-id: svn://tug.org/texlive/trunk@56774 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/sttools/flushend.sty | 74 +++++++++++++++++++++--- 1 file changed, 65 insertions(+), 9 deletions(-) (limited to 'Master/texmf-dist/tex/latex/sttools') diff --git a/Master/texmf-dist/tex/latex/sttools/flushend.sty b/Master/texmf-dist/tex/latex/sttools/flushend.sty index 56cea6e0f17..1dcff1fc01b 100644 --- a/Master/texmf-dist/tex/latex/sttools/flushend.sty +++ b/Master/texmf-dist/tex/latex/sttools/flushend.sty @@ -6,9 +6,8 @@ %% %% flushend.dtx (with options: `package') %% -%% Copyright (C) 1997-2017 by Sigitas Tolu\v{s}is +%% Copyright (C) 1997-2020 by Sigitas Tolu\v{s}is %% 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@auto@baselineskip \@auto@baselineskiptrue \newif\if@ancient@balance@version \@ancient@balance@versionfalse \newif\if@right@column@spread \@right@column@spreadtrue @@ -63,9 +62,11 @@ \newskip\flushend@@lastskip@b \newskip\flushend@@lastskip@c \newcount\flushend@@penalty@a +\newcount\var@@loop@iter \newdimen\flushend@@lastkern@a \newdimen\var@@temp@spread \newdimen\var@@temp@a +\newdimen\var@@temp@loop \def\top@@skip@@limit{.7\topskip} \newdimen\flushend@@page@rule \flushend@@page@rule\z@ \def\showcolsendrule{\global\flushend@@page@rule=.4\p@} @@ -211,6 +212,16 @@ \wlog@balance@debug{lastbox: \log@box@info{\flushend@@varbox@a}}% \fi \fi + \ifdim\var@@temp@loop=\ht\flushend@@varbox@a\relax + \global\advance\var@@loop@iter\@ne + \fi + \var@@temp@loop=\ht\flushend@@varbox@a\relax + \ifnum\var@@loop@iter<3\relax + \wlog@balance@debug{analyze left col: iteration \number\var@@loop@iter; ht \the\var@@temp@loop}% + \else + \wlog@balance@debug{analyze left col loop limit!}% + \ht\flushend@@varbox@a\z@ + \fi \ifdim\ht\flushend@@varbox@a>\topskip \expandafter\analyze@leftcolumn@box\expandafter\flushend@@varbox@a \fi @@ -366,6 +377,16 @@ \ifdim\flushend@@lastskip@b>\topskip \xdef\top@@section@skip{\the\flushend@@lastskip@b}% \fi + \ifdim\var@@temp@loop=\ht\flushend@@varbox@a\relax + \advance\var@@loop@iter\@ne + \fi + \var@@temp@loop=\ht\flushend@@varbox@a\relax + \ifnum\var@@loop@iter<3\relax + \wlog@balance@debug{analyze right col: iteration \number\var@@loop@iter; ht \the\var@@temp@loop}% + \else + \wlog@balance@debug{analyze right col loop limit!}% + \ht\flushend@@varbox@a=\z@ + \fi \ifdim\ht\flushend@@varbox@a>2\topskip \setbox\flushend@@tempbox@c\vbox{\unvbox\flushend@@varbox@a}% \repeat @@ -389,9 +410,11 @@ \setbox\@tempboxa\vbox{% \unvbox\flushend@@varbox@a \unskip\unkern\unpenalty + \hrule\@height\flushend@@page@rule width\columnwidth + \vskip-\flushend@@page@rule + \hrule\@height\z@ width\columnwidth \vskip\flushend@@lastskip@c \the\atColsBreak - \hrule\@height\flushend@@page@rule width\columnwidth \ifdim\top@@section@skip>\top@@skip@@limit \vskip\top@@section@skip \fi @@ -405,11 +428,12 @@ \else %% Ignore baselineskip value on column break \setbox\@tempboxa\vbox{% - \unvbox\@leftcolumn - \setbox\z@\lastbox + \unvbox\flushend@@varbox@a \unskip\unkern\unpenalty - \the\atColsBreak \hrule\@height\flushend@@page@rule width\columnwidth + \vskip-\flushend@@page@rule + \hrule\@height\z@ width\columnwidth + \the\atColsBreak \unvbox\@outputbox \remove@lastbox@at@balancing \the\atColsEnd @@ -474,6 +498,8 @@ \vss }% \hrule\@height\flushend@@page@rule width\textwidth + \vskip-\flushend@@page@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@c\vss}% \hrule\@height\flushend@@page@rule width\textwidth + \vskip-\flushend@@page@rule + \hrule\@height\z@ width\textwidth \vss }% \global\ht\@leftcolumn=\the\@tempdima @@ -605,19 +633,38 @@ \def\last@outputdblcol@modern{% \if@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@split@topskip@to\topskip \var@@temp@spread=\wd\@outputbox \get@@footnoterule@@box \xdef\main@box@height{\the\ht\@leftcolumn}% \xdef\main@box@skip{\z@}% - \global\flushend@@lastskip@c\z@ + \reset@check@@baselineskip@@skip\relax\relax\flushend@@lastskip@c \setbox\flushend@@varbox@a\vbox{\unvcopy\@leftcolumn}% + \var@@loop@iter\z@ \var@@temp@loop\z@ \analyze@leftcolumn@box\flushend@@varbox@a \setbox\flushend@@varbox@a\vbox{\unvcopy\@outputbox}% + \var@@loop@iter\z@ \var@@temp@loop\z@ \analyze@rightcolumn@box\flushend@@varbox@a \ifdim\main@box@skip>\z@ %% footnote in left column @@ -663,6 +710,7 @@ \setbox\@outputbox\vbox{\box\hold@viper\box\@outputbox}% \fi \@combinedblfloats + \csname @setmarks\endcsname \@outputpage \begingroup \@dblfloatplacement @@ -722,6 +770,8 @@ \unskip\unpenalty \vskip\flushend@@lastskip@c \hrule\@height\flushend@@page@rule width\columnwidth + \vskip-\flushend@@page@rule + \hrule\@height\z@ width\textwidth \the\atColsBreak \unvbox\@outputbox \remove@lastbox@at@balancing @@ -733,6 +783,8 @@ \setbox\z@\lastbox \unskip \hrule\@height\flushend@@page@rule width\columnwidth + \vskip-\flushend@@page@rule + \hrule\@height\z@ width\textwidth \the\atColsBreak \unvbox\@outputbox \remove@lastbox@at@balancing @@ -782,6 +834,8 @@ }% }% \hrule\@height\flushend@@page@rule + \vskip-\flushend@@page@rule + \hrule\@height\z@ width\textwidth \vss }% \setbox\@outputbox\vbox to\@tempdima{% @@ -792,6 +846,8 @@ }% }% \hrule\@height\flushend@@page@rule + \vskip-\flushend@@page@rule + \hrule\@height\z@ width\textwidth \vss }% \setbox\@outputbox\vbox{% -- cgit v1.2.3