From f2c2457997e4318b60a659d59a9814ed967aa0be Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 9 Apr 2015 22:39:38 +0000 Subject: sttools (9apr15) git-svn-id: svn://tug.org/texlive/trunk@36753 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/sttools/flushend.dtx | 292 ++++++++++++++++++--- Master/texmf-dist/source/latex/sttools/sttools.dtx | 34 ++- 2 files changed, 280 insertions(+), 46 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/latex/sttools/flushend.dtx b/Master/texmf-dist/source/latex/sttools/flushend.dtx index 21aacf2b6a4..8bcf181d193 100644 --- a/Master/texmf-dist/source/latex/sttools/flushend.dtx +++ b/Master/texmf-dist/source/latex/sttools/flushend.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2014 by Sigitas Tolu\v{s}is +% Copyright (C) 2015 by Sigitas Tolu\v{s}is % --------------------------------------------------------------------------- % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -24,8 +24,8 @@ \ProvidesFile{flushend.dtx} % %<*package> -%% Copyright (C) 1997-2014 by Sigitas Tolu\v{s}is -%% VTeX Ltd., Akademijos 4, Vilnius, Lithuania +%% Copyright (C) 1997-2015 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 @@ -42,12 +42,12 @@ %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{flushend} %<*package> - [2014/04/24 v2.2 Balancing columns in twocolumn mode] + [2015/04/08 v3.0 Balancing columns in twocolumn mode] % % %<*driver> \documentclass{ltxdoc} -\usepackage{flushend}[2014/03/18] +\usepackage{flushend}[2015/04/08] \EnableCrossrefs \CodelineIndex %%\RecordChanges @@ -59,7 +59,7 @@ % % \fi % -% \CheckSum{1312} +% \CheckSum{1739} % % \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 @@ -85,6 +85,10 @@ % \changes{v2.0}{2014/03/03}{rewritten with new balance algorithm} % \changes{v2.1}{2014/03/18}{Switched debug option off} % \changes{v2.2}{2014/04/24}{bugfix version: removing empty box at the right column end} +% \changes{v3.0}{2015/04/08}{bugfix version and extra options: +% ancient/modern, +% spread/nospread, +% removelastbox/keeplastbox} % % \DoNotIndex{\newcommand,\newenvironment} % @@ -146,7 +150,7 @@ % Adds \meta{tokens} at the end of right column. % % \medskip -% \textit{Example}: |\atColsEnd{\vfil}| +% \textit{Example}: |\atColsEnd{\vfil}|. % % \medskip % \DescribeMacro{\showcolsendrule} @@ -156,18 +160,47 @@ % \subsection{Package options} % % \medskip +% \DescribeMacro{ancient} +% It is used to switch on old version of balancing algorithm. +% +% \medskip +% \DescribeMacro{modern} +% It is used to switch on new version of balancing algorithm. +% +% \medskip % \DescribeMacro{autobase} -% It is used to guess |\baselineskip| value on original columns break. +% It is used to guess |\baselineskip| value on original columns +% break. On failure just use |\atColsBreak{...}|. % % \medskip -% \DescribeMacro{noauto} +% \DescribeMacro{noautobase} % It is used to switch off the previous option behaviour. % % \medskip +% \DescribeMacro{spread} +% It adds extra glue to the rightcolumn trying to balance. +% +% \medskip +% \DescribeMacro{nospread} +% It skips adding extra glue to the last column. +% +% \medskip +% \DescribeMacro{removelastbox} +% 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. +% +% \medskip % \DescribeMacro{debug} % Adds rules to the bottom of columns (just for debugging) and leftcolumn break place. % Adds some additional log info. % +% \medskip +% \DescribeMacro{nodebug} +% Skips putting debuging lines. +% % \StopEventually{} % % \section{Implementation} @@ -179,9 +212,18 @@ % % \begin{macrocode} \newif\if@auto@baselineskip \@auto@baselineskiptrue -\newif\if@balance@debug \@balance@debugfalse +\newif\if@ancient@balance@version \@ancient@balance@versionfalse +\newif\if@right@column@spread \@right@column@spreadtrue +\newif\if@remove@lastbox@at@balancing \@remove@lastbox@at@balancingtrue +\newif\if@balance@debug \@balance@debugtrue \DeclareOption{autobase}{\global\@auto@baselineskiptrue} -\DeclareOption{noauto}{\global\@auto@baselineskipfalse} +\DeclareOption{noautobase}{\global\@auto@baselineskipfalse} +\DeclareOption{ancient}{\global\@ancient@balance@versiontrue} +\DeclareOption{modern}{\global\@ancient@balance@versionfalse} +\DeclareOption{spread}{\global\@right@column@spreadtrue} +\DeclareOption{nospread}{\global\@right@column@spreadfalse} +\DeclareOption{removelastbox}{\global\@remove@lastbox@at@balancingtrue} +\DeclareOption{keeplastbox}{\global\@remove@lastbox@at@balancingfalse} \DeclareOption{debug}{\global\@balance@debugtrue} \DeclareOption{nodebug}{\global\@balance@debugfalse} \ProcessOptions @@ -196,6 +238,7 @@ \newdimen\flushend@@lastkern@a \newdimen\var@@temp@spread \newdimen\var@@temp@a +\def\top@@skip@@limit{.7\topskip} \newdimen\flushend@@page@rule \flushend@@page@rule\z@ \def\showcolsendrule{\global\flushend@@page@rule=.4pt} % \end{macrocode} @@ -246,6 +289,12 @@ \fi \egroup } +\AtBeginDocument{% + \if@remove@lastbox@at@balancing + \else + \let\remove@lastbox@at@balancing\relax + \fi + } % \end{macrocode} % \end{macro} % @@ -434,8 +483,10 @@ \splittopskip\z@ \setbox\flushend@@tempbox@c\vsplit\flushend@@varbox@a to\ht\strutbox \flushend@@lastskip@a\ht\flushend@@varbox@a + \advance\flushend@@lastskip@a\dp\flushend@@varbox@a \loop \flushend@@lastskip@b\ht\flushend@@varbox@a + \advance\flushend@@lastskip@b\dp\flushend@@varbox@a \setbox\flushend@@tempbox@c\vsplit\flushend@@varbox@a to\var@@temp@a \ifvoid\flushend@@tempbox@c \advance \var@@temp@a 3\p@ @@ -446,7 +497,9 @@ \setbox\flushend@@tempbox@c\vbox{\unvbox\flushend@@tempbox@c}% \ifdim\ht\flushend@@tempbox@c>\top@@floatbox@min \advance\flushend@@lastskip@b -\ht\flushend@@tempbox@c + \advance\flushend@@lastskip@b -\dp\flushend@@tempbox@c \advance\flushend@@lastskip@b -\ht\flushend@@varbox@a + \advance\flushend@@lastskip@b -\dp\flushend@@varbox@a \xdef\top@@floatbox@skip{\the\flushend@@lastskip@b}% \flushend@@lastskip@b\flushend@@lastskip@a \advance\flushend@@lastskip@b -\ht\flushend@@varbox@a @@ -455,7 +508,9 @@ \var@@temp@a=3\p@ \else \advance\flushend@@lastskip@b -\ht\flushend@@tempbox@c + \advance\flushend@@lastskip@b -\dp\flushend@@tempbox@c \advance\flushend@@lastskip@b -\ht\flushend@@varbox@a + \advance\flushend@@lastskip@b -\dp\flushend@@varbox@a \ifdim\ht\flushend@@tempbox@c>\topskip \else \xdef\top@@section@skip{\the\flushend@@lastskip@b}% @@ -519,10 +574,10 @@ % % \begin{macro}{\last@outputdblcol} % -% Columns balancing of the twocolumn mode page. +% Columns balancing of the twocolumn mode page (modern variant). % % \begin{macrocode} -\def\last@outputdblcol{% +\def\last@outputdblcol@modern{% \if@firstcolumn \global \@firstcolumnfalse \global \setbox\@leftcolumn \box\@outputbox @@ -531,16 +586,16 @@ \@tempdima\ht\@leftcolumn \splittopskip\topskip \splitmaxdepth\maxdepth \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@ + \setbox\flushend@@varbox@a\vbox{\unvcopy\@leftcolumn}% + \analyze@leftcolumn@box\flushend@@varbox@a + \setbox\flushend@@varbox@a\vbox{\unvcopy\@outputbox}% + \analyze@rightcolumn@box\flushend@@varbox@a \if@auto@baselineskip %% Trying guess baselineskip value on column break - \get@@footnoterule@@box - \xdef\main@box@height{\the\ht\@leftcolumn}% - \xdef\main@box@skip{\z@}% - \global\flushend@@lastskip@c\z@ - \setbox\flushend@@varbox@a\vbox{\unvcopy\@leftcolumn}% - \analyze@leftcolumn@box\flushend@@varbox@a - \setbox\flushend@@varbox@a\vbox{\unvcopy\@outputbox}% - \analyze@rightcolumn@box\flushend@@varbox@a \ifdim\main@box@skip>\z@ \splittopskip\z@ \setbox\flushend@@varbox@a\vsplit\@leftcolumn to\main@box@height @@ -564,8 +619,8 @@ \vskip\flushend@@lastskip@c \the\atColsBreak \hrule\@height\flushend@@page@rule width\columnwidth - \ifdim\top@@section@skip>\topskip - \vskip\top@@section@skip + \ifdim\top@@section@skip>\top@@skip@@limit + \vskip\top@@section@skip \fi \unvbox\@outputbox \remove@lastbox@at@balancing @@ -657,7 +712,9 @@ ^^JOutput:\the\@tempdimb }% \setbox\@outputbox\vbox to\@tempdima{% - \vbox spread\var@@temp@spread{\unvbox\@tempboxa}% + \vbox spread\var@@temp@spread{% + \unvbox\@tempboxa + }% \vss }% \else @@ -682,7 +739,9 @@ \setbox\flushend@@varbox@c\vbox{\unvbox\flushend@@varbox@a}% \fi \var@@temp@spread=\ht\flushend@@tempbox@c + \advance\var@@temp@spread by\dp\flushend@@tempbox@c \advance\var@@temp@spread by-\ht\flushend@@varbox@c + \advance\var@@temp@spread by-\dp\flushend@@varbox@c \wlog@balance@debug{Left x: \the\ht\flushend@@tempbox@a +\the\dp\flushend@@tempbox@a=\the\ht\flushend@@varbox@a +\the\dp\flushend@@varbox@a::\the\@tempdimb @@ -694,7 +753,8 @@ ^^JExtra height:\the\var@@temp@spread\space when \the\@tempdimb }% \ifdim\var@@temp@spread<\z@ \advance\@tempdimb 1\p@ \repeat - \@tempdimb\ht\flushend@@tempbox@c + %\@tempdimb\ht\flushend@@tempbox@c + %\advance\@tempdimb by\dp\flushend@@tempbox@c \wlog{- LAST -% ^^JExtra skip:\the\var@@temp@spread ^^JLeft:\the\ht\flushend@@tempbox@c/\the\dp\flushend@@tempbox@c @@ -702,7 +762,7 @@ ^^JOutput:\the\@tempdimb }% \setbox\flushend@@tempbox@c\vsplit\@tempboxa to\@tempdimb - \setbox\flushend@@varbox@c\vbox{\unvbox\flushend@@tempbox@a}% + \setbox\flushend@@varbox@c\vbox{\unvbox\flushend@@tempbox@c}% \setbox\@leftcolumn\vbox to\@tempdima{% \vbox to\@tempdimb{\unvbox\flushend@@varbox@c\vss}% \hrule\@height\flushend@@page@rule width\textwidth @@ -711,16 +771,34 @@ \global\ht\@leftcolumn=\the\@tempdima \ifdim\top@@floatbox@skip>\z@ \setbox\@outputbox\vbox to\@tempdima{% - \vbox spread\var@@temp@spread{% - \unvbox\@outputbox - \vskip\top@@floatbox@skip - \unvbox\@tempboxa - }% + \if@right@column@spread + \vbox spread\var@@temp@spread{% + \unvbox\@outputbox + \vskip\top@@floatbox@skip + \unvbox\@tempboxa + }% + \else + \vbox spread\var@@temp@spread{% + \unvbox\@outputbox + \vskip\top@@floatbox@skip + \unvbox\@tempboxa + \vss + }% + \fi \vss }% \else \setbox\@outputbox\vbox to\@tempdima{% - \vbox spread\var@@temp@spread{\unvbox\@tempboxa}% + \if@right@column@spread + \vbox spread\var@@temp@spread{% + \unvbox\@tempboxa + }% + \else + \vbox spread\var@@temp@spread{% + \unvbox\@tempboxa + \vss + }% + \fi \vss }% \fi @@ -762,6 +840,151 @@ } % \end{macrocode} % \end{macro} +% \begin{macro}{\last@outputdblcol@old} +% +% Columns balancing of the twocolumn mode page (ancient algorithm). +% +% \begin{macrocode} +\def\last@outputdblcol@ancient{% + \if@firstcolumn + \global\@firstcolumnfalse + \global\setbox\@leftcolumn\box\@outputbox + \else + \global\@firstcolumntrue + \@tempdima\ht\@leftcolumn + \splittopskip\topskip\splitmaxdepth\maxdepth + \if@auto@baselineskip + \setbox\@tempboxa\vbox{% + \unvcopy\@leftcolumn + \global\flushend@@lastskip@c\lastskip + \global\flushend@@lastskip@b\lastskip + \loop + \global\flushend@@lastskip@a\flushend@@lastskip@b + \unskip\unpenalty + \global\flushend@@lastskip@b\lastskip + \global\advance\flushend@@lastskip@c by\lastskip + \ifdim\flushend@@lastskip@b=-\flushend@@lastskip@a + \global\advance\flushend@@lastskip@c by-\lastskip + \else + \repeat + \ifdim\flushend@@lastskip@b=-\flushend@@lastskip@a + \ifdim\flushend@@lastskip@b=\z@ + \setbox\flushend@@varbox@a\lastbox + \global\advance\flushend@@lastskip@c by\ht\flushend@@varbox@a + \global\advance\flushend@@lastskip@c by\lastskip + \unskip\unpenalty + \setbox\flushend@@varbox@a\lastbox + \global\advance\flushend@@lastskip@c by\dp\flushend@@varbox@a + \else + \global\flushend@@lastskip@c\lastskip + \global\advance\flushend@@lastskip@c by\topskip + \fi + \fi + \global\advance\flushend@@lastskip@c by-\topskip + }% + \setbox\@tempboxa\vbox{% + \unvbox\@leftcolumn + \unskip\unpenalty + \vskip\flushend@@lastskip@c + \hrule\@height\flushend@@page@rule width\columnwidth + \the\atColsBreak + \unvbox\@outputbox + \remove@lastbox@at@balancing + %%\unskip + \the\atColsEnd + }% + \else + \setbox\@tempboxa\vbox{% + \unvbox\@leftcolumn + \setbox\z@\lastbox + \unskip + \hrule\@height\flushend@@page@rule width\columnwidth + \the\atColsBreak + \unvbox\@outputbox + \remove@lastbox@at@balancing + %%\setbox\z@\lastbox + %%\unskip + \the\atColsEnd + }% + \fi + \@tempdimb .5\ht\@tempboxa + \loop + \setbox\flushend@@tempbox@a\copy\@tempboxa + \setbox\flushend@@tempbox@c\vbox to\@tempdimb{% + \vsplit\flushend@@tempbox@a to\@tempdimb + \vss + \vsplit\flushend@@tempbox@a to\@tempdimb + }% + \wlog{Extra height:\the\ht\flushend@@tempbox@a\space when \the\@tempdimb}% + \ifvoid\flushend@@tempbox@a \else \advance\@tempdimb 1\p@ \repeat + \loop + \setbox\flushend@@tempbox@a\copy\@tempboxa + \setbox\flushend@@tempbox@c\vbox to\@tempdimb{\vsplit\flushend@@tempbox@a to\@tempdimb\vss}% + \wlog{(2)Left:\the\ht\flushend@@tempbox@c\space + Right:\the\ht\flushend@@tempbox@a\space + Output:\the\@tempdimb + }% + \ifdim\ht\flushend@@tempbox@c<\ht\flushend@@tempbox@a \@tempdimb=\the\ht\flushend@@tempbox@a \repeat + \wlog{- LAST -^^JExtra skip: \the\z@ + ^^JLeft:\the\ht\flushend@@tempbox@c + ^^JRight:\the\ht\flushend@@tempbox@a + ^^JOutput:\the\@tempdimb + }% + \setbox\flushend@@tempbox@c\vbox to\@tempdimb{% + \vsplit\@tempboxa to\@tempdimb + \vss + }% + \setbox\@leftcolumn\vbox to\@tempdima{% + \fmt@vbox@adds[\columnwidth]{\vbox to\@tempdimb{\unvbox\flushend@@tempbox@c}}% + \hrule\@height\flushend@@page@rule + \vss + }% + \setbox\@outputbox\vbox to\@tempdima{% + \fmt@vbox@adds[\columnwidth]{% + \vbox to\@tempdimb{% + \unvbox\@tempboxa + %\vfilneg + \vskip\z@ + }% + }% + \hrule\@height\flushend@@page@rule + \vss + }% + \setbox\@outputbox\vbox{% + \hb@xt@\textwidth{% + \hb@xt@\columnwidth{\box\@leftcolumn\hss}% + \hfil + \vrule \@width\columnseprule + \hfil + \hb@xt@\columnwidth{\box\@outputbox\hss}% + }% + }% + \global\let\@outputdblcol\saved@orig@@outputdblcol + \global\atColsEnd{}% + \ifvoid\hold@viper + \else + \setbox\@outputbox\vbox{\box\hold@viper\box\@outputbox}% + \fi + \@combinedblfloats + \@outputpage + \begingroup + \@dblfloatplacement + \@startdblcolumn + \@whilesw\if@fcolmade\fi + {\@outputpage\@startdblcolumn}% + \ifvoid\@viper + \else + \global\setbox\@viper\vbox{% + \vskip-\stripsep + \unvbox\@viper + }% + \csname @viperoutput\endcsname + \fi + \endgroup + \fi + } +% \end{macrocode} +% \end{macro} % % Adds default balancing of the last page at the end of document. % @@ -769,6 +992,11 @@ \usepackage{etoolbox} \AtBeginDocument{% \global\let\saved@orig@@outputdblcol\@outputdblcol + \if@ancient@balance@version + \global\let\last@outputdblcol\last@outputdblcol@ancient + \else + \global\let\last@outputdblcol\last@outputdblcol@modern + \fi \global\let\balanced@@outputdblcol\last@outputdblcol \preto\enddocument{\let\@outputdblcol\balanced@@outputdblcol}% \appto\footnoterule{\vskip\z@}% diff --git a/Master/texmf-dist/source/latex/sttools/sttools.dtx b/Master/texmf-dist/source/latex/sttools/sttools.dtx index c035680a0d1..6527d3750f5 100644 --- a/Master/texmf-dist/source/latex/sttools/sttools.dtx +++ b/Master/texmf-dist/source/latex/sttools/sttools.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2014 by Sigitas Tolu\v{s}is +% Copyright (C) 2015 by Sigitas Tolu\v{s}is % --------------------------------------------------------------------------- % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -62,7 +62,7 @@ % \GetFileInfo{sttools.dtx} % \title{The \textsf{sttools} collection} % \author{Sigitas Tolu\v{s}is \\ \url{sigitas@vtex.lt}} -% \date{2014.03.03} +% \date{2015.04.08} % % \maketitle % @@ -74,21 +74,27 @@ % \section{Usage} % % \begin{itemize} -% \item \textbf{cuted.sty} -- place some material page width wide at any +% \item \textbf{cuted.sty, v1.5 2012/10/04} -- place some material +% page width wide at any % place on twocolumn page with existing text reformatted under inserted % material; \\\texttt{TODO: add optional rules to separate from text}; -% \item \textbf{floatpag.sty} -- set pagestyle for floats page; -% \item \textbf{flushend.sty, v2.0} -- balance page in twocolumn mode; -% \\\texttt{NEW: totally rewritten with new algorithm to support footnotes, -% top floats and column break before one line section title}. -% \item \textbf{marginal.sty} -- use enlarged room for marginal inserts; -% \item \textbf{midfloat.sty} -- insert onecolumn stuff in twocolumn +% \item \textbf{floatpag.sty, v1.1 2012/05/29} -- set pagestyle for floats page; +% \item \textbf{flushend.sty, v3.0 2015/04/08} -- balance page in twocolumn mode; +% \\\texttt{(2014/03/03): totally rewritten with new algorithm to support footnotes, +% top floats and column break before one line section title. +% \\(2014/04/24): bugfix version; +% \\(2015/03/27): bugfix version with improved funcionality: +% \\ - spreaded or fixed right column height; +% \\ - optional old algorithm for backward compatability;} +% \item \textbf{marginal.sty, v1.1 2012/05/29} -- use enlarged room for marginal inserts; +% \item \textbf{midfloat.sty, v1.1 2012/05/29} -- insert onecolumn stuff in twocolumn % page; \\\texttt{TODO: extend to work on both columns}; -% \item \textbf{stabular.sty} -- use modified tabular environment; -% \\\texttt{TODO: remove extra stuff and leave only possibility to break -% on page boundary}; -% \item \textbf{stfloats.sty} -- enable enriched floats output mechanism; -% \item \textbf{texsort.sty} -- sort numerical values; \\\texttt{TODO: +% \item \textbf{stabular.sty, v2.0 2014/03/20} -- use modified tabular environment; +% \\\texttt{(2014/03/20): removed extra stuff and left only possibility to break +% on page boundary; +% \\added tabular variant from array package}; +% \item \textbf{stfloats.sty, v1.1 2012/05/29} -- enable enriched floats output mechanism; +% \item \textbf{texsort.sty, v1.1 2012/05/29} -- sort numerical values; \\\texttt{TODO: % extend (rewrite) to support alphnanumerical values for sorting}. % \end{itemize} % -- cgit v1.2.3