summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-13 00:07:56 +0000
committerKarl Berry <karl@freefriends.org>2006-01-13 00:07:56 +0000
commit90905949da34ee02fd885fc494a50360f00e296d (patch)
tree9c0b80cfc6dd9a35a268dfe3557341e496f97611 /Master
parent6ecc8cbfd257eb7f97e87528164659d6c031ba07 (diff)
sttools
git-svn-id: svn://tug.org/texlive/trunk@1351 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/tex/latex/sttools/boundbox.sty85
-rw-r--r--Master/texmf-dist/tex/latex/sttools/cuted.sty474
-rw-r--r--Master/texmf-dist/tex/latex/sttools/floatpag.sty175
-rw-r--r--Master/texmf-dist/tex/latex/sttools/flushend.sty141
-rw-r--r--Master/texmf-dist/tex/latex/sttools/marginal.sty171
-rw-r--r--Master/texmf-dist/tex/latex/sttools/midfloat.sty226
-rw-r--r--Master/texmf-dist/tex/latex/sttools/stabular.sty116
-rw-r--r--Master/texmf-dist/tex/latex/sttools/stfloats.sty326
-rw-r--r--Master/texmf-dist/tex/latex/sttools/texsort.sty289
9 files changed, 2003 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/sttools/boundbox.sty b/Master/texmf-dist/tex/latex/sttools/boundbox.sty
new file mode 100644
index 00000000000..a08ac801f9e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/sttools/boundbox.sty
@@ -0,0 +1,85 @@
+%% boundbox.sty
+%% Copyright 1997 Sigitas Tolu\v sis
+%% VTeX Ltd., Akademijos 4, Vilnius, Lithuania
+%% e-mail sigitas@vtex.lt
+%% http://www.vtex.lt/tex/download/macros/
+%%
+% This program can redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or (at your option) any later version.
+%
+% PURPOSE: Calculate TeX Bounding Box in points (LaTeX2e)
+%
+% SHORT DESCRIPTION:
+%
+% \@calculate
+% -----------
+% Internal macro \@calculate writes TeX box dimensions
+% to the token list \bound in such format:
+%
+% \bound{left=x1 top=y1 right=x2 bottom=y2}
+%
+% x1 - distance in points from the left side of paper
+% to the left side of TeX box
+% y1 - distance in points from the top of paper
+% to the top of TeX box (including head)
+% x2 - distance in points from the left side of paper
+% to the right side of TeX box
+% y2 - distance in points from the top of paper
+% to the bottom of TeX box
+% (including foot; with option "nofoot" without foot)
+%
+% \topoint#1#2
+% ------------
+% Dimension #1 in any unit of measure converts to value in points
+% and defines it to macro #2
+%
+% This package writes such special to DVI:
+% \special{mt:TeXBBox left=x1 top=y1 right=x2 bottom=y2}
+%
+%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{boundbox}[1998/02/24]
+%
+\newif\if@withfoot \@withfoottrue
+\DeclareOption{nofoot}{\global\@withfootfalse}
+\ProcessOptions
+%
+\newtoks\bound \bound={}%
+\def\@@to#1#2{\begingroup
+ \xdef\a@act{\global\noexpand#1{\the#1#2}}\a@act
+\endgroup}
+%
+\def\topoint#1#2{%
+\@tempdimb=#1
+\@tempcnta=\@tempdimb
+\multiply\@tempcnta by10
+\divide\@tempcnta by18647 \advance\@tempcnta by1
+\multiply\@tempcnta by72 \divide\@tempcnta by2540
+\expandafter\def\expandafter#2\expandafter{\the\@tempcnta}}
+%
+\def\@calculate{%
+\@tempdima=1in
+\advance\@tempdima by\hoffset
+\advance\@tempdima by\oddsidemargin
+\topoint{\@tempdima}{\@a}%
+\advance\@tempdima\textwidth
+\topoint{\@tempdima}{\@c}%
+\@tempdima=1in
+\advance\@tempdima by\voffset
+\advance\@tempdima by\topmargin
+\topoint{\@tempdima}{\@b}%
+\advance\@tempdima by\headheight
+\advance\@tempdima by\headsep
+\advance\@tempdima\textheight
+\if@withfoot
+ \advance\@tempdima\footskip
+\fi
+\topoint{\@tempdima}{\@d}%
+\@tempcnta=\@d
+\expandafter\def\expandafter\@d\expandafter{\the\@tempcnta}%
+\@@to\bound{left=\@a\space top=\@b\space right=\@c\space bottom=\@d}%
+}
+\AtBeginDocument{\@calculate\special{mt:TeXBBox \the\bound}}
+\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/sttools/cuted.sty b/Master/texmf-dist/tex/latex/sttools/cuted.sty
new file mode 100644
index 00000000000..3b60c518455
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/sttools/cuted.sty
@@ -0,0 +1,474 @@
+%% cuted.sty
+%% Copyright 1997 Sigitas Tolu\v sis
+%% VTeX Ltd., Akademijos 4, Vilnius, Lithuania
+%% e-mail sigitas@vtex.lt
+%% http://www.vtex.lt/tex/download/macros/
+%%
+% This program can redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or (at your option) any later version.
+%
+% PURPOSE: Insert some onecolumn material in full-width on double-column page.
+%
+% SHORT DESCRIPTION:
+%
+% It is denoted to place some material in full-width at any place
+% on double-column page (\twocolumn mode). The part of material
+% can be placed on the next page. Existing text is placed
+% under inserted material in two columns (it is reformatted).
+%
+% Provides new environment:
+%
+% \begin{strip} ... \end{strip}
+% -----------------------------
+%
+% Puts \vbox{...} in full-width on double-column page.
+% Adds \stripsep glue before and after
+% (By default \stripsep=15pt plus2pt minus 2pt).
+% It can be problems with floats and footnotes. In the case of
+% problems with footnotes it is possible to correct the situation
+% using commands \footnotemark and \footnotetext.
+%
+% Provides new command:
+% \oldcolsbreak{#1}
+%
+% Adds #1 in place of original column break if strip is placed
+% on the right column.
+%
+% \changes{1997/09/02}{improved column balancing}
+% \changes{1997/09/03}{float control for \@colroom setting}
+% \changes{1997/09/04}{improved \@colroom setting}
+% \changes{1997/09/05}{checking for \@viper and \hold@viper}
+% \changes{1997/09/09}{compatibility with flushend.sty}
+% \changes{1997/09/22}{improved \output ir \@specialoutput}
+% \changes{1997/10/01}{improved \output ir \@addviper}
+%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{cuted}[1997/10/01]
+%
+\newtoks\At@ViperColsBreak \At@ViperColsBreak{}
+\def\oldcolsbreak#1{\global\At@ViperColsBreak{#1}}
+\newbox\v@aaa
+\newbox\v@ccc
+\@ifundefined{stripsep}{\newskip\stripsep\stripsep 15pt plus 2pt minus 2pt}{}
+%
+\@ifundefined{@viper}{\newbox\@viper}{}
+\newif\if@lastviper \@lastviperfalse
+\def\@outputdblcol{%
+ \if@firstcolumn
+ \global \@firstcolumnfalse
+ \global \setbox\@leftcolumn \box\@outputbox
+ \else
+ \global \@firstcolumntrue
+ \setbox\@outputbox \vbox {%
+ \hb@xt@\textwidth {%
+ \hb@xt@\columnwidth {%
+ \box\@leftcolumn \hss}%
+ \hfil
+ \vrule \@width\columnseprule
+ \hfil
+ \hb@xt@\columnwidth {%
+ \box\@outputbox \hss}%
+ }%
+ }%
+ \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}\@viperoutput
+ \fi
+ \endgroup
+ \fi
+}
+\mathchardef\@Mv=10005
+\newcount\viper@penalty
+\def\strip{%
+ \ifinner
+ \@parmoderr\viper@penalty\z@
+ \else
+ \viper@penalty=-\@Mv\relax
+ \fi
+ \global \setbox\@viper\vbox\bgroup%
+ \hsize\textwidth
+ \@parboxrestore
+ \col@number \@ne
+ \vrule height\topskip width0pt depth0pt
+}
+\def\endstrip{%
+ \egroup
+ \ifnum\viper@penalty <-\@Mii
+ \penalty -\@Miv
+ \@tempdima\prevdepth %% saving and restoring \prevdepth added
+ \vbox{}% %% 26 May 87 to prevent extra vertical
+ \prevdepth \@tempdima %% space when used in vertical mode
+ \penalty-\@Mv\relax
+ \fi
+}
+\gdef\@viperoutput{%
+ \global \setbox\@holdpg \vbox{%
+ \unvbox\@holdpg
+ \unvbox\@cclv
+ \setbox\@tempboxa \lastbox
+ \unskip
+ }%
+ \@pagedp \dp\@holdpg
+ \@pageht \ht\@holdpg
+ \ifvoid\@viper\else
+ \advance \@pageht \@pagedp
+ \ifvoid\footins \else
+ \advance \@pageht \ht\footins
+ \advance \@pageht \skip\footins
+ \advance \@pageht \dp\footins
+ \fi
+ \ifvbox \@kludgeins
+ \ifdim \wd\@kludgeins=\z@
+ \advance \@pageht \ht\@kludgeins
+ \fi
+ \fi
+ \@reinserts
+ \@addviper
+ \fi
+}
+\gdef\@specialoutput{%
+ \ifnum \outputpenalty>-\@Mii
+ \@doclearpage
+ \else
+ \ifnum \outputpenalty<-\@Miii
+ \ifnum \outputpenalty<-\@MM \deadcycles \z@ \fi
+ \ifnum \outputpenalty=-10005
+ \@viperoutput
+ \ifnum \outputpenalty<\z@
+ \if@nobreak
+ \else
+ \addpenalty \interlinepenalty
+ \fi
+ \fi
+ \else
+ \global \setbox\@holdpg \vbox {\unvbox\@cclv}%
+ \fi
+ \else
+ \global \setbox\@holdpg \vbox{%
+ \unvbox\@holdpg
+ \unvbox\@cclv
+ \setbox\@tempboxa \lastbox
+ \unskip
+ }%
+ \@pagedp \dp\@holdpg
+ \@pageht \ht\@holdpg
+ \unvbox \@holdpg
+ \@next\@currbox\@currlist{%
+ \ifnum \count\@currbox>\z@
+ \advance \@pageht \@pagedp
+ \ifvoid\footins \else
+ \advance \@pageht \ht\footins
+ \advance \@pageht \skip\footins
+ \advance \@pageht \dp\footins
+ \fi
+ \ifvbox \@kludgeins
+ \ifdim \wd\@kludgeins=\z@
+ \advance \@pageht \ht\@kludgeins
+ \fi
+ \fi
+ \@reinserts
+ \@addtocurcol
+ \else
+ \@reinserts
+ \@addmarginpar
+ \fi
+ }\@latexbug
+ \ifnum \outputpenalty<\z@
+ \if@nobreak
+ \else
+ \addpenalty \interlinepenalty
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\@ifundefined{hold@viper}{\newbox\hold@viper}{}
+\newdimen\ht@viper
+\def \@addviper {%
+ \if@firstcolumn
+ \@insertfalse
+ \@reqcolroom .5\@pageht
+ \ht@viper\@reqcolroom
+ \advance \@reqcolroom \ht\@viper
+ \advance \@reqcolroom \stripsep
+ \ifvoid\hold@viper\@tempdima=\z@\else\@tempdima\ht\hold@viper\fi
+%
+ \@tempdimb \ht@viper
+ \loop
+ \setbox\v@aaa\copy\@holdpg
+ \setbox\v@ccc\vbox to\@tempdimb{%
+ \vsplit\v@aaa to\@tempdimb\vss\vsplit\v@aaa to\@tempdimb}%
+ \wlog{Extra height:\the\ht\v@aaa\space when \the\@tempdimb}%
+ \ifvoid\v@aaa \else \advance\@tempdimb 1pt \repeat%
+ \loop
+ \setbox\v@aaa\copy\@holdpg
+ \setbox\v@ccc\vbox to\@tempdimb{%
+ \vsplit\v@aaa to\@tempdimb\vss}%
+ \wlog{(2)Left:\the\ht\v@ccc\space Right:\the\ht\v@aaa\space Output:\the\@tempdimb}%
+ \ifdim \ht\v@ccc<\ht\v@aaa \@tempdimb \the\ht\v@aaa \repeat%
+ \wlog{- LAST -^^JLeft:\the\ht\v@ccc^^JRight:\the\ht\v@aaa^^JOutput:\the\@tempdimb}%
+ \setbox\v@ccc\vbox to\@tempdimb{%
+ \vsplit\@holdpg to\@tempdimb\vss}%
+%
+ \setbox\@tempboxa \vbox {%
+ \hb@xt@\textwidth {%
+ \hb@xt@\columnwidth {%
+% \vbox to\ht@viper{\vsplit\@holdpg to\ht@viper\vss} \hss}%
+ \vbox to\ht@viper{\box\v@ccc\vss} \hss}%
+ \hfil
+ \vrule \@width\columnseprule
+ \hfil
+ \hb@xt@\columnwidth {%
+ \vbox to\ht@viper{\box\@holdpg\vss} \hss}%
+ }%
+ }%
+ \ifvoid\hold@viper
+ \global\setbox\hold@viper \vbox {%
+ \unvbox\@tempboxa
+ \penalty\interlinepenalty
+ \vskip\stripsep
+ \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
+ \outputpenalty \z@
+ }%
+ \else
+ \global\setbox\hold@viper \vbox {%
+ \unvbox\hold@viper
+ \unvbox\@tempboxa
+ \penalty\interlinepenalty
+ \vskip\stripsep
+ \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
+ \outputpenalty \z@
+ }%
+ \fi
+ \ifdim \@colroom>\@reqcolroom
+ \global\setbox\hold@viper \vbox {%
+ \unvbox\hold@viper
+ \box\@viper
+ \penalty\interlinepenalty
+ \vskip\stripsep
+ \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
+ \outputpenalty \z@
+ }%
+ \@inserttrue
+ \advance\@tempdima by-\ht\hold@viper
+ \global \advance \@colht \@tempdima
+ \ifdim \@colht<2.5\baselineskip
+ \@latex@warning@no@line {Optional argument of \noexpand\twocolumn
+ too tall on page \thepage (1 stulpelis)}%
+ \@emptycol
+ \if@firstcolumn
+ \else
+ \@emptycol
+ \fi
+ \global\@lastvipertrue
+ \else
+ \global \vsize \@colht
+ \global \@colroom \@colht
+ \check@floats
+ \ifdim\@tempdima>\z@
+ \global\advance\@colroom by-\@tempdima
+ \fi
+ \ifdim\@colroom<\z@
+ \global\@colroom 1pt
+ \ifdim\@tempdima>\@colht
+ \@latex@warning@no@line {TOP ir/ar BOT FLOAT's
+ netelpa lape \thepage (1 stulpelis)}%
+ \fi
+ \@emptycol
+ \if@firstcolumn
+ \else
+ \@emptycol
+ \fi
+ \global\@lastvipertrue
+ \fi
+ \fi
+ \fi
+ \else
+ \@insertfalse
+ \@reqcolroom\@colht
+ \advance\@reqcolroom \@pageht
+ \ht@viper.5\@reqcolroom
+ \@reqcolroom\ht@viper
+ \advance \@reqcolroom \ht\@viper
+ \advance \@reqcolroom \stripsep
+ \global\setbox\@holdpg\vbox{\unvbox\@leftcolumn
+ \setbox\@tempboxa\lastbox\unskip\the\At@ViperColsBreak\unvbox\@holdpg}%
+ \global\At@ViperColsBreak{}%
+ \ht@viper .5\ht\@holdpg
+ \ifvoid\hold@viper\@tempdima=\z@\else\@tempdima\ht\hold@viper\fi
+%
+ \@tempdimb \ht@viper
+ \loop
+ \setbox\v@aaa\copy\@holdpg
+ \setbox\v@ccc\vbox to\@tempdimb{%
+ \vsplit\v@aaa to\@tempdimb\vss\vsplit\v@aaa to\@tempdimb}%
+ \wlog{Extra height:\the\ht\v@aaa\space when \the\@tempdimb}%
+ \ifvoid\v@aaa \else \advance\@tempdimb 1pt \repeat%
+ \loop
+ \setbox\v@aaa\copy\@holdpg
+ \setbox\v@ccc\vbox to\@tempdimb{%
+ \vsplit\v@aaa to\@tempdimb\vss}%
+ \wlog{(2)Left:\the\ht\v@ccc\space Right:\the\ht\v@aaa\space Output:\the\@tempdimb}%
+ \ifdim \ht\v@ccc<\ht\v@aaa \@tempdimb \the\ht\v@aaa \repeat%
+ \wlog{- LAST -^^JLeft:\the\ht\v@ccc^^JRight:\the\ht\v@aaa^^JOutput:\the\@tempdimb}%
+ \setbox\v@ccc\vbox to\@tempdimb{%
+ \vsplit\@holdpg to\@tempdimb\vss}%
+%
+ \setbox\@tempboxa\vbox{%
+ \hb@xt@\textwidth {%
+ \hb@xt@\columnwidth {%
+% \vbox to\ht@viper{\vsplit\@holdpg to \ht@viper\vss} \hss}%
+ \vbox to\ht@viper{\box\v@ccc\vss} \hss}%
+ \hfil
+ \vrule \@width\columnseprule
+ \hfil
+ \hb@xt@\columnwidth {%
+ \vbox to\ht@viper{\box\@holdpg\vss} \hss}%
+ }%
+ }%
+ \ifvoid\hold@viper
+ \global\setbox\hold@viper \vbox {%
+ \unvbox\@tempboxa
+ \penalty\interlinepenalty
+ \vskip\stripsep
+ \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
+ \outputpenalty \z@
+ }%
+ \else
+ \global\setbox\hold@viper \vbox {%
+ \unvbox\hold@viper
+ \unvbox\@tempboxa
+ \penalty\interlinepenalty
+ \vskip\stripsep
+ \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
+ \outputpenalty \z@
+ }%
+ \fi
+ \ifdim \@colht>\@reqcolroom
+ \global\setbox\hold@viper \vbox {%
+ \unvbox\hold@viper
+ \box\@viper
+ \penalty\interlinepenalty
+ \vskip\stripsep
+ \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
+ \outputpenalty \z@
+ }%
+ \@inserttrue
+ \global\@firstcolumntrue
+ \advance\@tempdima by-\ht\hold@viper
+ \global \advance \@colht \@tempdima
+ \ifdim \@colht<2.5\baselineskip
+ \@latex@warning@no@line {Optional argument of \noexpand\twocolumn
+ too tall on page \thepage (2 stulpelis)}%
+ \@emptycol
+ \if@firstcolumn
+ \else
+ \@emptycol
+ \fi
+ \global\@lastvipertrue
+ \else
+ \global \vsize \@colht
+ \global \@colroom \@colht
+ \check@floats
+ \ifdim\@tempdima>\z@
+ \global\advance\@colroom by-\@tempdima
+ \fi
+ \ifdim\@colroom<\z@
+ \global\@colroom 1pt
+ \ifdim\@tempdima>\@colht
+ \@latex@warning@no@line {TOP ir/ar BOT FLOAT's
+ netelpa lape \thepage (2 stulpelis)}%
+ \fi
+ \@emptycol
+ \if@firstcolumn
+ \else
+ \@emptycol
+ \fi
+ \global\@lastvipertrue
+ \fi
+ \fi
+ \fi
+ \fi
+ \if@insert
+ \else
+ \advance\@tempdima by-\ht\hold@viper
+ \global \advance \@colht \@tempdima
+ \global\setbox\hold@viper \vbox {%
+ \unvbox\hold@viper
+ \vsplit\@viper to \@colht
+ \vss
+ }%
+ \vbox{}%
+ \global\@firstcolumnfalse
+ \newpage
+ \fi
+}
+
+\def \check@floats {%
+ \global\@tempdima\z@
+ \let \@elt \ht@comflelt
+ \ifx \@toplist\@empty \else\@toplist \fi
+ \ifx \@botlist\@empty \else\@botlist \fi
+}
+\def\ht@comflelt#1{\setbox\@tempboxa\vbox{\copy #1\vskip\floatsep}%
+\global\advance\@tempdima\ht\@tempboxa}
+
+\output {%
+ \let \par \@@par
+ \ifnum \outputpenalty<-\@M
+ \@specialoutput
+ \else
+ \@makecol
+ \@opcol
+ \@startcolumn
+ \@whilesw \if@fcolmade \fi
+ {%
+ \@opcol\@startcolumn}%
+ \fi
+ \ifnum \outputpenalty>-\@Miv
+ \ifdim \@colroom<1.5\baselineskip
+ \ifdim \@colroom<\textheight
+ \@latex@warning@no@line {Text page \thepage\space
+ contains only floats}%
+ \if@lastviper\else\@emptycol\fi
+ \if@twocolumn
+ \if@firstcolumn
+ \else
+ \@emptycol
+ \fi
+ \fi
+ \global\@lastviperfalse
+ \else
+ \global \vsize \@colroom
+ \fi
+ \else
+ \global \vsize \@colroom
+ \fi
+ \else
+ \ifnum\outputpenalty<-100005
+ \global \vsize \maxdimen
+ \else
+ \global \vsize \@colroom
+ \fi
+ \fi
+}
+\endinput
+
+
+
+
diff --git a/Master/texmf-dist/tex/latex/sttools/floatpag.sty b/Master/texmf-dist/tex/latex/sttools/floatpag.sty
new file mode 100644
index 00000000000..9dbc540c484
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/sttools/floatpag.sty
@@ -0,0 +1,175 @@
+%% floatpag.sty
+%% Copyright 1999 V. Statulevi\v cius
+%% VTeX Ltd., Akademijos 4, Vilnius, Lithuania
+%% e-mail vytas@vtex.lt
+%% http://www.vtex.lt/tex/download/macros/
+%%
+% This program can redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or (at your option) any later version.
+%
+% PURPOSE: provides commands to apply different pagestyles
+% to the full page floats.
+%
+% USAGE:
+% \floatpagestyle{foo} will apply pagestyle 'foo' to all pages
+% occupied by full page floats.
+%
+% \rotfloatpagestyle{foo} will apply pagestyle 'foo' to all pages
+% occupied by sideways figures and tables
+% produced with the help of 'rotating.sty'
+% package (Sebastian Rahtz and Leonor Barroca)
+%
+% \thisfloatpagestyle{foo} will apply pagestyle 'foo' to a page where
+% this command was used inside figure or table
+% environment
+%
+% DEFAULT:
+% \floatpagestyle{headings}
+% \rotfloatpagestyle{plain}
+%
+% The macros, developed by Sigitas Tolusis <sigitas@vtex.lt>,
+% were used in this package.
+%
+% The following commands from the LaTeX2e kernel were redefined:
+% \@xfloat, \@vtryfc
+% The following command from the rotating.sty was redefined:
+% \@xrotfloat
+%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{floatpag}
+ [1999/04/29
+ FLOAT PAGESTYLE]
+\def\floatpagestyle#1{\gdef\at@float@page{\thispagestyle{#1}}}
+\def\rotfloatpagestyle#1{\gdef\@r@f@pagestyle{#1}\gdef\at@rotfloat@page{\thispagestyle{#1}}}
+\floatpagestyle{headings}
+\rotfloatpagestyle{plain}
+%
+\def\thisfloatpagestyle#1{%
+ \expandafter\expandafter\expandafter\gdef\expandafter
+ \csname\number\@currbox @float\endcsname{\thispagestyle{#1}}\relax}
+%
+% Perrabibreziame \x@float - paprasti float'ai
+\def\@xfloat #1[#2]{%
+ \@nodocument
+ \def \@captype {#1}%
+ \def \@fps {#2}%
+ \@onelevel@sanitize \@fps
+ \def \reserved@b {!}%
+ \ifx \reserved@b \@fps
+ \@fpsadddefault
+ \else
+ \ifx \@fps \@empty
+ \@fpsadddefault
+ \fi
+ \fi
+ \ifhmode
+ \@bsphack
+ \@floatpenalty -\@Mii
+ \else
+ \@floatpenalty-\@Miii
+ \fi
+ \ifinner
+ \@parmoderr\@floatpenalty\z@
+ \else
+ \@next\@currbox\@freelist
+ {%
+ \@tempcnta \sixt@@n
+ \expandafter \@tfor \expandafter \reserved@a
+ \expandafter :\expandafter =\@fps
+ \do
+ {%
+ \if \reserved@a h%
+ \ifodd \@tempcnta
+ \else
+ \advance \@tempcnta \@ne
+ \fi
+ \fi
+ \if \reserved@a t%
+ \@setfpsbit \tw@
+ \fi
+ \if \reserved@a b%
+ \@setfpsbit 4%
+ \fi
+ \if \reserved@a p%
+ \@setfpsbit 8%
+ \fi
+ \if \reserved@a !%
+ \ifnum \@tempcnta>15
+ \advance\@tempcnta -\sixt@@n\relax
+ \fi
+ \fi
+ }%
+ \@tempcntb \csname ftype@\@captype \endcsname
+ \multiply \@tempcntb \@xxxii
+ \advance \@tempcnta \@tempcntb
+ \global \count\@currbox \@tempcnta
+ \expandafter\expandafter\expandafter\gdef\expandafter
+ \csname\number\@currbox @float\endcsname{\at@float@page}\relax
+ }%
+ \@fltovf
+ \fi
+ \global \setbox\@currbox
+ \color@vbox
+ \normalcolor
+ \vbox \bgroup
+ \hsize\columnwidth
+ \@parboxrestore
+ \@floatboxreset
+}%
+%
+% 2e rotating.sty v. 2.10:
+\def\e@xrotfloat#1[#2]{%
+ \@float{#1}[#2]%
+ \thisfloatpagestyle{\@r@f@pagestyle}%
+ \begin{lrbox}\rot@float@box
+ \begin{minipage}\textheight
+ }
+
+% 2.09 rotating.sty v. 1.6
+\def\n@xrotfloat#1[#2]{\ifhmode \@bsphack\@floatpenalty -\@Mii\else
+ \@floatpenalty-\@Miii\fi\def\@captype{#1}\ifinner
+ \@parmoderr\@floatpenalty\z@
+ \else\@next\@currbox\@freelist{\@tempcnta\csname ftype@#1\endcsname
+ \multiply\@tempcnta\@xxxii\advance\@tempcnta\sixt@@n
+ \@tfor \@tempa :=#2\do
+ {\if\@tempa h\advance\@tempcnta \@ne\fi
+ \if\@tempa t\advance\@tempcnta \tw@\fi
+ \if\@tempa b\advance\@tempcnta 4\relax\fi
+ \if\@tempa p\advance\@tempcnta 8\relax\fi
+ }\global\count\@currbox\@tempcnta}\@fltovf\fi
+ \expandafter\expandafter\expandafter\gdef\expandafter\csname\number\@currbox
+ @float\endcsname{\at@rotfloat@page}\relax
+ \global\setbox\@currbox\vbox\bgroup
+ \hsize\textheight \@parboxrestore
+}%
+%
+% Tikrinam, kokia rotating versija: 2e ar 209:
+% 1999.02.08 Tikriname dokumento pradzioje, t.y. neaisku
+% kada rotating stilius buvo pakrautas:
+\AtBeginDocument{%
+\@ifpackageloaded{rotating}%
+{\let\@xrotfloat\e@xrotfloat\let\n@xrotfloat\relax}%
+{\let\@xrotfloat\n@xrotfloat\let\e@xrotfloat\relax}}%
+%
+%% "Kablys" output proceduroje ivykdantis komanda
+\def\spec@float #1{\expandafter\csname\number#1@float\endcsname
+ \expandafter\expandafter\expandafter\gdef\expandafter\csname\number#1@float\endcsname{}}
+
+\def\@vtryfc #1{%
+ \global\setbox\@outputbox\vbox{}%
+ \let\@elt\@wtryfc
+ \@flsucceed
+ \let\@elt\spec@float
+ \@flsucceed
+ \global\setbox\@outputbox \vbox to\@colht{%
+ \vskip \@fptop
+ \vskip -\@fpsep
+ \unvbox \@outputbox
+ \vskip \@fpbot}%
+ \let\@elt\relax
+ \xdef #1{\@failedlist\@flfail}%
+ \xdef\@freelist{\@freelist\@flsucceed}}
+
+\endinput
diff --git a/Master/texmf-dist/tex/latex/sttools/flushend.sty b/Master/texmf-dist/tex/latex/sttools/flushend.sty
new file mode 100644
index 00000000000..83e3186a6c6
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/sttools/flushend.sty
@@ -0,0 +1,141 @@
+%% flushend.sty
+%% Copyright 1997 Sigitas Tolu\v sis
+%% VTeX Ltd., Akademijos 4, Vilnius, Lithuania
+%% e-mail sigitas@vtex.lt
+%% http://www.vtex.lt/tex/download/macros/
+%%
+% This program can redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or (at your option) any later version.
+%
+% PURPOSE: Balanced columns on last page in twocolumn mode.
+%
+% SHORT DESCRIPTION:
+%
+% \flushend (loaded by default)
+% ---------
+% Switches on column balancing at last page
+%
+% \raggedend
+% ----------
+% Switches off column balancing at last page
+%
+% \atColsBreak={#1}
+% ------------------
+% Adds #1 in place of original column break (without balancing)
+% Example: \atColsBreak{\vskip-2pt}
+%
+% \showcolsendrule
+% ----------------
+% Adds rule to the bottom of columns (just for debugging)
+%
+% P.S. To stretch right column by #1 add command \vskip-#1 just before
+% command \end{document}.
+% TO shrink right column by #1 add command \vskip#1 just before
+% command \end{document}.
+% Example: \vskip-10pt
+% \end{document}
+%
+% \changes{1997/05/16}{first version}
+% \changes{1997/09/09}{support for compatibility with cuted.sty}
+% \changes{1997/10/01}{\vipersep changed to \stripsep for compatibility with cuted.sty}
+%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{flushend}[1997/10/01]
+%
+\newbox\@aaa
+\newbox\@ccc
+\@ifundefined{@viper}{\newbox\@viper}{}
+\@ifundefined{hold@viper}{\newbox\hold@viper}{}
+\newtoks\atColsBreak \atColsBreak={}
+\newdimen\@extra@skip \@extra@skip\z@
+\newdimen\@nd@page@rule \@nd@page@rule\z@
+\def\last@outputdblcol{%
+ \if@firstcolumn
+ \global \@firstcolumnfalse
+ \global \setbox\@leftcolumn \box\@outputbox
+ \else
+ \global \@firstcolumntrue
+ \if@lastpage
+ \@tempdima\ht\@leftcolumn
+ \splittopskip\topskip\splitmaxdepth\maxdepth
+ \setbox\@tempboxa\vbox{%
+ \unvbox\@leftcolumn\setbox0\lastbox\unskip%
+ \the\atColsBreak%
+ \unvbox\@outputbox\setbox0\lastbox\unskip}%
+ \@tempdimb .5\ht\@tempboxa%
+ \loop
+ \setbox\@aaa\copy\@tempboxa%
+ \setbox\@ccc\vbox to\@tempdimb{%
+ \vsplit\@aaa to\@tempdimb\vss\vsplit\@aaa to\@tempdimb}%
+ \wlog{Extra height:\the\ht\@aaa\space when \the\@tempdimb}%
+ \ifvoid\@aaa \else \advance\@tempdimb 1pt \repeat%
+ \loop
+ \setbox\@aaa\copy\@tempboxa%
+ \setbox\@ccc\vbox to\@tempdimb{%
+ \vsplit\@aaa to\@tempdimb\vss}%
+ \wlog{(2)Left:\the\ht\@ccc\space Right:\the\ht\@aaa\space Output:\the\@tempdimb}%
+ \ifdim \ht\@ccc<\ht\@aaa \@tempdimb \the\ht\@aaa \repeat%
+ \wlog{- LAST -^^JExtra skip:\the\@extra@skip^^JLeft:\the\ht\@ccc^^JRight:\the\ht\@aaa^^JOutput:\the\@tempdimb}%
+ \setbox\@ccc\vbox to\@tempdimb{%
+ \vsplit\@tempboxa to\@tempdimb\vss}%
+ \setbox\@leftcolumn\vbox to\@tempdima{%
+ \vbox to\@tempdimb{\unvbox\@ccc}%
+ \hrule\@height\@nd@page@rule%
+ \vss}%
+ \setbox\@outputbox\vbox to\@tempdima{%
+ \vbox to\@tempdimb{\unvbox\@tempboxa\vfilneg\vskip\@extra@skip}%
+ \hrule\@height\@nd@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}%
+ }%
+ }%
+ \else
+ \setbox\@outputbox \vbox {%
+ \hb@xt@\textwidth {%
+ \hb@xt@\columnwidth {%
+ \box\@leftcolumn \hss}%
+ \hfil
+ \vrule \@width\columnseprule
+ \hfil
+ \hb@xt@\columnwidth {%
+ \box\@outputbox \hss}%
+ }%
+ }%
+ \fi
+ \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}\@viperoutput
+ \fi
+ \endgroup
+ \fi
+}
+\let\prev@enddocument\enddocument
+\newif\if@lastpage \@lastpagefalse
+\def\enddocument{\global\@lastpagetrue\let\@outputdblcol\last@outputdblcol\prev@enddocument}
+\def\raggedend{\global\let\enddocument\prev@enddocument}
+\def\flushend{\gdef\enddocument{\global\@lastpagetrue\let\@outputdblcol\last@outputdblcol\prev@enddocument}}
+\def\showcolsendrule{\global\@nd@page@rule=.4pt}
+\endinput
diff --git a/Master/texmf-dist/tex/latex/sttools/marginal.sty b/Master/texmf-dist/tex/latex/sttools/marginal.sty
new file mode 100644
index 00000000000..58b2fb373ce
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/sttools/marginal.sty
@@ -0,0 +1,171 @@
+%% marginal.sty
+%% Copyright 1997 Sigitas Tolu\v sis
+%% VTeX Ltd., Akademijos 4, Vilnius, Lithuania
+%% e-mail sigitas@vtex.lt
+%% http://www.vtex.lt/tex/download/macros/
+%%
+% This program can redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or (at your option) any later version.
+%
+% PURPOSE: Enlarge free and show lost marginal inserts
+%
+% SHORT DESCRIPTION:
+%
+% \showlostmarginals
+% ------------------
+% Outputs lost marginal notes at the left of page
+%
+% \enlargefreelist
+% ----------------
+% Adds more(34) free inserts to freelist
+%
+% \onesidemarginals
+% -----------------
+% Outputs marginal notes only on one side. It saves one half
+% of the available free inserts.
+%
+\ProvidesPackage{marginal}[1997/04/01]
+%
+\newif\if@mparlost \@mparlostfalse
+%
+\newbox\@mparlostbox
+\setbox\@mparlostbox\vbox{}
+%
+\gdef\@fltovfpar{\global\@mparlosttrue%
+ \@latex@warning{Too many unprocessed (marginal)floats}\relax}
+\gdef\@fltovfmess{%
+ \@latex@error{Too many unprocessed floats}\@ehb}
+%
+\def\marginpar{\ifhmode \@bsphack\@floatpenalty -\@Mii\else
+ \@floatpenalty-\@Miii\fi\ifinner
+ \@parmoderr\@floatpenalty\z@
+ \else\@next\@currbox\@freelist{}{}\@next\@marbox\@freelist{\global
+ \count\@marbox\m@ne}{\@floatpenalty\z@ \@fltovfmess
+ \def\@currbox{\@tempboxa}\def\@marbox{\@tempboxa}}\fi
+ \@ifnextchar [\@xmpar\@ympar}
+%
+\long\def \@savemarbox #1#2{%
+ \global\setbox #1%
+ \color@vbox
+ \vtop{%
+ \hsize\marginparwidth
+ \@parboxrestore
+ \@marginparreset
+ #2%
+ \global\@minipagefalse
+ \outer@nobreak
+ }%
+ \color@endbox%
+ \if@mparlost\global\setbox\@mparlostbox\vbox{\unvbox\@mparlostbox\copy#1}%
+ \global\@mparlostfalse\fi
+}
+%
+% \showlostmarginals - outputs lost marginal notes at the left of the page
+%
+\def\showlostmarginals{%
+ \global\let\old@textbottom\@textbottom
+ \gdef\@textbottom{\vtop to\z@{\hbox to\z@{\kern-\wd\@mparlostbox\vbox
+ to\z@{\kern-\ht\@mparlostbox\box\@mparlostbox\vfill}}}\old@textbottom}%
+ \global\let\@fltovfmess\@fltovfpar}
+%
+% \enlargefreelist - Adds more(34) free inserts to freelist
+%
+\def\enlargefreelist{%
+\newinsert\bx@S
+\newinsert\bx@T
+\newinsert\bx@U
+\newinsert\bx@V
+\newinsert\bx@W
+\newinsert\bx@X
+\newinsert\bx@Y
+\newinsert\bx@Z
+\newinsert\bx@a
+\newinsert\bx@b
+\newinsert\bx@c
+\newinsert\bx@d
+\newinsert\bx@e
+\newinsert\bx@f
+\newinsert\bx@g
+\newinsert\bx@h
+\newinsert\bx@i
+\newinsert\bx@j
+\newinsert\bx@k
+\newinsert\bx@l
+\newinsert\bx@m
+\newinsert\bx@n
+\newinsert\bx@o
+\newinsert\bx@p
+\newinsert\bx@q
+\newinsert\bx@r
+\newinsert\bx@s
+\newinsert\bx@t
+\newinsert\bx@u
+\newinsert\bx@v
+\newinsert\bx@w
+\newinsert\bx@x
+\newinsert\bx@y
+\newinsert\bx@z
+\gdef\@freelist{\@elt\bx@A\@elt\bx@B\@elt\bx@C\@elt\bx@D\@elt\bx@E
+ \@elt\bx@F\@elt\bx@G\@elt\bx@H\@elt\bx@I\@elt\bx@J
+ \@elt\bx@K\@elt\bx@L\@elt\bx@M\@elt\bx@N
+ \@elt\bx@O\@elt\bx@P\@elt\bx@Q\@elt\bx@R
+ \@elt\bx@S\@elt\bx@T\@elt\bx@U\@elt\bx@V
+ \@elt\bx@W\@elt\bx@X\@elt\bx@Y\@elt\bx@Z
+ \@elt\bx@a\@elt\bx@b\@elt\bx@c\@elt\bx@d\@elt\bx@e
+ \@elt\bx@f\@elt\bx@g\@elt\bx@h\@elt\bx@i\@elt\bx@j
+ \@elt\bx@k\@elt\bx@l\@elt\bx@m\@elt\bx@n
+ \@elt\bx@o\@elt\bx@p\@elt\bx@q\@elt\bx@r
+ \@elt\bx@s\@elt\bx@t\@elt\bx@u\@elt\bx@v
+ \@elt\bx@w\@elt\bx@x\@elt\bx@y\@elt\bx@z}%
+}
+%
+% \onesidemarginals - outputs marginals only on one side
+%
+\def\onesidemarginals{%
+\newbox\@marbox
+\gdef\@addmarginpar{\@cons\@freelist\@currbox
+ \@tempdima\@mparbottom
+ \advance\@tempdima -\@pageht
+ \advance\@tempdima\ht\@currbox
+ \ifdim\@tempdima >\z@
+ \@latex@warning@no@line {Marginpar on page \thepage\space moved}%
+ \else
+ \@tempdima\z@
+ \fi
+ \global\@mparbottom\@pageht
+ \global\advance\@mparbottom\@tempdima
+ \global\advance\@mparbottom\dp\@currbox
+ \global\advance\@mparbottom\marginparpush
+ \advance\@tempdima -\ht\@currbox
+ \global\setbox \@currbox
+ \vbox {\vskip \@tempdima
+ \box \@currbox}%
+ \global \ht\@currbox \z@
+ \global \dp\@currbox \z@
+ \kern -\@pagedp
+ \nointerlineskip
+ \hb@xt@\columnwidth
+ {\hskip\columnwidth \hskip\marginparsep \box\@currbox \hss}%
+ \nointerlineskip
+ \hbox{\vrule \@height\z@ \@width\z@ \@depth\@pagedp}}%
+%
+\gdef\marginpar{\ifhmode \@bsphack\@floatpenalty -\@Mii\else
+ \@floatpenalty-\@Miii\fi\ifinner\@parmoderr\@floatpenalty\z@
+ \else\@next\@currbox\@freelist{\global
+ \count\@currbox\m@ne}{\@floatpenalty\z@ \@fltovfmess
+ \def\@currbox{\@tempboxa}}\fi
+ \@ifnextchar [\@xmpar\@ympar}%
+%
+\long\gdef\@xmpar[##1]##2{\@savemarbox\@currbox{##2}\@xympar}%
+\long\gdef\@ympar##1{\@savemarbox\@currbox{##1}\@xympar}%
+\def \@xympar{%
+% \ifnum\@floatpenalty <\z@\@cons\@currlist\@marbox\fi
+ \setbox\@tempboxa
+ \color@vbox
+ \vbox \bgroup
+ \end@float
+ \global \@ignorefalse \@esphack}%
+}
+\endinput
diff --git a/Master/texmf-dist/tex/latex/sttools/midfloat.sty b/Master/texmf-dist/tex/latex/sttools/midfloat.sty
new file mode 100644
index 00000000000..d9d11129ee7
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/sttools/midfloat.sty
@@ -0,0 +1,226 @@
+%% midfloat.sty
+%% Copyright 1997 Sigitas Tolu\v sis
+%% VTeX Ltd., Akademijos 4, Vilnius, Lithuania
+%% e-mail sigitas@vtex.lt
+%% http://www.vtex.lt/tex/download/macros/
+%%
+% This program can redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or (at your option) any later version.
+%
+% PURPOSE: Insert some material in full-width on double-column page.
+%
+% SHORT DESCRIPTION:
+%
+% It is denoted to place some material (from the left column)
+% in full-width at any place (but not at the top) on double-column
+% page (\twocolumn mode). Existing text remains as it was before
+% insert. Placement is restricted to one page. (It is some kind of
+% dbfloat intext).
+%
+% Provides new environment:
+%
+% \begin{strip}[#1/#2] ... \end{strip}
+% -----------------------------
+%
+% Puts \vbox{...} in full-width on double-column page.
+% Parameters #1 and #2 are optional.
+% By default #1=0pt and #2=0pt.
+% The material on the right column under strip is stretched down
+% by #1 and below strip is moved down by #2.
+%
+% It can be problems with floats and footnotes. In the case of
+% problems with footnotes it is possible to correct the situation
+% using commands \footnotemark and \footnotetext.
+%
+% \changes{1997/10/01}{some names}
+%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{midfloat}[1997/10/01]
+%
+\newif\if@vihproof \@vihprooftrue
+\newtoks\juo@sar \juo@sar={}
+\def\@ca#1#2#3#4{}
+\@ifundefined{stripsep}{\newskip\stripsep\stripsep 15pt}{}
+%
+\newskip\m@addvipersep
+\m@addvipersep\z@
+\newskip\c@addvipersep
+\c@addvipersep\z@
+\newdimen\ht@strip
+\newdimen\right@cor
+\newdimen\cor@height \cor@height=0pt
+\newdimen\juo@pr
+\newdimen\juo@ht
+\newbox\@viper
+\newcount\juo@sk
+\newdimen\c@colht
+\newbox\@rightcolumn
+
+\def\add@strip#1#2#3#4{\begingroup%
+ \xdef\ex@{\global\noexpand\juo@sar{\the\juo@sar\noexpand\@ca{#1}{#2}{#3}{#4}}}\ex@%
+\endgroup}
+
+\def\remove@strip#1{\ifx#1\@empty\global\juo@sk=0\else
+ \global\advance\juo@sk by-1\expandafter\next@item\the #1\@@#1\fi}
+\def\next@item \@ca #1#2#3#4#5\@@#6{\global #6={#5}\global\juo@pr=#1\global\juo@ht=#2%
+\global\cor@height=#3\global\m@addvipersep=#4}
+
+\def\strip{\@ifnextsymb[{\@strip}{\@strip[0pt/0pt]}}
+\def\@strip[#1/#2]{\global\@tempdima=#1\global\@tempdimb=#2%
+ \global \setbox\@viper\vbox\bgroup%
+ \hsize\textwidth
+ \@parboxrestore
+ \col@number \@ne
+ \vrule height\topskip width0pt depth0pt
+}
+\def\endstrip{%
+ \egroup
+ \if@firstcolumn
+ \ifdim\pagetotal>\z@
+ \vskip\stripsep
+ \global\ht@strip\pagegoal
+ \global\advance\ht@strip by-\pagetotal
+ \global\advance\ht@strip by-\stripsep
+ \global\advance\ht@strip by-\ht\@viper
+ \global\advance\ht@strip by-\stripsep
+ \global\juo@ht=\ht\@viper
+ \else
+ \global\ht@strip\z@
+ \fi
+ \ifdim\ht@strip>\z@
+ \unvbox\@viper
+ \vskip\stripsep
+ \add@strip{\the\pagetotal}{\the\juo@ht}{\the\@tempdima}{\the\@tempdimb}%
+ \global\advance\juo@sk by1
+ \else
+ \@latex@error{Strip needs more place!}\@ehc
+ \if@vihproof
+ \framebox[\columnwidth]{??? Strip ???}%
+ \fi
+ \fi
+ \else
+ \@latex@error{Strip is used only on left column!}\@ehc
+ \if@vihproof
+ \framebox[\columnwidth]{??? Strip ???}%
+ \fi
+ \fi
+}
+\def\@outputdblcol{%
+ \if@firstcolumn
+ \global \@firstcolumnfalse
+ \global \setbox\@leftcolumn \box\@outputbox
+ \global\c@colht\@colht\global\c@addvipersep\z@
+ \ifnum\juo@sk>0
+ \remove@strip\juo@sar
+ \global\@colht\the\juo@pr
+ \ifdim\right@cor>\z@
+ \global\advance\@colht by\right@cor
+ \fi
+ \global\advance\@colht by\cor@height
+ \global\cor@height=0pt
+ \fi
+ \global \setbox\@rightcolumn \vbox{}%
+ \else
+ \ifdim\c@colht>\@colht
+ \@tempdima\@colht
+ \ifdim\@colht>\z@
+ \global\setbox\@rightcolumn \vbox{%
+ \unvbox\@rightcolumn
+ \vbox to\@tempdima{%
+ \vskip\c@addvipersep\unvbox\@outputbox}%
+ \vskip\stripsep
+ \vrule height\the\juo@ht width 0pt depth 0pt
+ \vskip\stripsep
+ }%
+ \global\c@addvipersep\m@addvipersep
+ \else
+ \global\setbox\@rightcolumn \vbox{%
+ \unvbox\@rightcolumn
+ \vrule height\the\juo@ht width 0pt depth 0pt
+ \vskip\stripsep
+ }%
+ \fi
+ \ifnum\juo@sk>0
+ \remove@strip\juo@sar
+ \global\@colht\the\juo@pr
+ \global\advance\@colht by -\ht\@rightcolumn
+ \global\advance\@colht by\cor@height
+ \global\cor@height=0pt
+ \else
+ \global\advance\c@colht by-\ht\@rightcolumn
+ \global\@colht\c@colht
+ \fi
+ \else
+ \global \@firstcolumntrue
+ \global\setbox\@outputbox\vbox to\ht\@leftcolumn{%
+ \unvbox\@rightcolumn
+ \vskip\c@addvipersep
+ \unvbox\@outputbox
+ }%
+ \setbox\@outputbox \vbox {%
+ \hb@xt@\textwidth {%
+ \hb@xt@\columnwidth {%
+ \box\@leftcolumn \hss}%
+ \hfil
+ \vrule \@width\columnseprule
+ \hfil
+ \hb@xt@\columnwidth {%
+ \box\@outputbox \hss}%
+ }%
+ }%
+ \@combinedblfloats
+ \@outputpage
+ \begingroup
+ \@dblfloatplacement
+ \@startdblcolumn
+ \@whilesw\if@fcolmade \fi
+ {\@outputpage
+ \@startdblcolumn}%
+ \endgroup
+ \global\juo@sk=0\global\juo@sar={}%
+ \global\cor@height\z@\global\c@addvipersep\z@
+ \fi
+ \fi
+}
+
+\def \@cflt{%
+ \let \@elt \@comflelt
+ \setbox\@tempboxa \vbox{}%
+ \@toplist
+ \global\right@cor\ht\@tempboxa
+ \ifdim\right@cor>\z@
+ \global\advance\right@cor by-\floatsep
+ \global\advance\right@cor by\textfloatsep
+ \fi
+ \setbox\@outputbox \vbox{%
+ \boxmaxdepth \maxdepth
+ \unvbox\@tempboxa
+ \vskip -\floatsep
+ \topfigrule
+ \vskip \textfloatsep
+ \unvbox\@outputbox
+ }%
+ \let\@elt\relax
+ \xdef\@freelist{\@freelist\@toplist}%
+ \global\let\@toplist\@empty
+}
+
+\def\@ifnextsymb#1#2#3{%
+ \let\reserved@d=#1%
+ \def\reserved@a{#2}\def\reserved@b{#3}%
+ \futurelet\@let@token\@ifnsymb}
+\def\@ifnsymb{%
+ \ifx\@let@token\@sptoken
+ \let\reserved@c\reserved@b
+ \else
+ \ifx\@let@token\reserved@d
+ \let\reserved@c\reserved@a
+ \else
+ \let\reserved@c\reserved@b
+ \fi
+ \fi
+ \reserved@c}
+
+\endinput
diff --git a/Master/texmf-dist/tex/latex/sttools/stabular.sty b/Master/texmf-dist/tex/latex/sttools/stabular.sty
new file mode 100644
index 00000000000..a408878b419
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/sttools/stabular.sty
@@ -0,0 +1,116 @@
+%% stabular.sty
+%% Copyright 1998 Sigitas Tolu\v sis
+%% VTeX Ltd., Akademijos 4, Vilnius, Lithuania
+%% e-mail sigitas@vtex.lt
+%% http://www.vtex.lt/tex/download/macros/
+%%
+% This program can redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or (at your option) any later version.
+%
+% PURPOSE: Improve tabular environment.
+%
+% SHORT DESCRIPTION:
+%
+% Changed internal commands: \@mkpream, \@addamp, \@xhline
+%
+% Provides new commands in tabular (used after command \\):
+% \emptyrow[#1]
+% -------------
+% Adds empty row, #1 - height of the row
+%
+% \tabrow{#1}[#2]
+% ---------------
+% Adds row of natural height: #1\\[#2]
+%
+% Provides new environments: stabular and stabular*
+% -------- ---------
+% One more multi-page version of tabular
+%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{stabular}[1998/03/19]
+%
+\def\empty@finalstrut#1{%
+ \unskip\ifhmode\nobreak\fi\vrule\@width\z@\@height\z@\@depth\z@}
+\def\no@strut{\global\setbox\@arstrutbox\hbox{%
+ \vrule \@height\z@
+ \@depth\z@
+ \@width\z@}%
+ \gdef\@endpbox{\empty@finalstrut\@arstrutbox\par\egroup\hfil}%
+}%
+\def\yes@strut{\global\setbox\@arstrutbox\hbox{%
+ \vrule \@height\arraystretch \ht\strutbox
+ \@depth\arraystretch \dp\strutbox
+ \@width\z@}%
+ \gdef\@endpbox{\@finalstrut\@arstrutbox\par\egroup\hfil}%
+}%
+\def\@mkpream#1{\@firstamptrue\@lastchclass6
+ \let\@preamble\@empty\def\empty@preamble{\add@ins}%
+ \let\protect\@unexpandable@protect
+ \let\@sharp\relax\let\add@ins\relax
+ \let\@startpbox\relax\let\@endpbox\relax
+ \@expast{#1}%
+ \expandafter\@tfor \expandafter
+ \@nextchar \expandafter:\expandafter=\reserved@a\do
+ {\@testpach\@nextchar
+ \ifcase \@chclass \@classz \or \@classi \or \@classii \or \@classiii
+ \or \@classiv \or\@classv \fi\@lastchclass\@chclass}%
+ \ifcase \@lastchclass \@acol
+ \or \or \@preamerr \@ne\or \@preamerr \tw@\or \or \@acol \fi}
+\def\@addamp{%
+ \if@firstamp
+ \@firstampfalse
+ \edef\empty@preamble{\add@ins}%
+ \else
+ \edef\@preamble{\@preamble &}%
+ \edef\empty@preamble{\expandafter\noexpand\empty@preamble &\add@ins}%
+ \fi}
+\newif\iftw@hlines \tw@hlinesfalse
+\def\@xhline{\ifx\reserved@a\hline
+ \tw@hlinestrue
+ \else\ifx\reserved@a\Hline
+ \tw@hlinestrue
+ \else
+ \tw@hlinesfalse
+ \fi\fi
+ \iftw@hlines
+ \aftergroup\do@after
+ \fi
+ \ifnum0=`{\fi}%
+}
+\def\do@after{\emptyrow[\the\doublerulesep]}
+\def\emptyrow{\noalign\bgroup\@ifnextchar[\@emptyrow{\@emptyrow[\z@]}}
+\def\@emptyrow[#1]{\no@strut\gdef\add@ins{\vrule \@height\z@ \@depth#1 \@width\z@}\egroup%
+\empty@preamble\\
+\noalign{\yes@strut\gdef\add@ins{\vrule \@height\z@ \@depth\z@ \@width\z@}}%
+}
+\def\tabrow#1{\noalign\bgroup\@ifnextchar[{\@tabrow{#1}}{\@tabrow{#1}[]}}
+\def\@tabrow#1[#2]{\no@strut\egroup#1\ifx.#2.\\\else\\[#2]\fi\noalign{\yes@strut}}
+%
+\def\endstabular{\crcr\egroup\egroup \egroup}
+\expandafter \let \csname endstabular*\endcsname = \endstabular
+\def\stabular{\let\@halignto\@empty\@stabular}
+\@namedef{stabular*}#1{\def\@halignto{to#1}\@stabular}
+\def\@stabular{\leavevmode \bgroup \let\@acol\@tabacol
+ \let\@classz\@tabclassz
+ \let\@classiv\@tabclassiv \let\\\@tabularcr\@stabarray}
+\def\@stabarray{\m@th\@ifnextchar[\@sarray{\@sarray[c]}}
+\def\@sarray[#1]#2{%
+ \bgroup
+ \setbox\@arstrutbox\hbox{%
+ \vrule \@height\arraystretch\ht\strutbox
+ \@depth\arraystretch \dp\strutbox
+ \@width\z@}%
+ \@mkpream{#2}%
+ \edef\@preamble{%
+ \ialign \noexpand\@halignto
+ \bgroup \@arstrut \@preamble \tabskip\z@skip \cr}%
+ \let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
+ \let\tabularnewline\\%
+% \let\par\@empty
+ \let\@sharp##%
+ \set@typeset@protect
+ \lineskip\z@skip\baselineskip\z@skip
+ \@preamble}
+\endinput
diff --git a/Master/texmf-dist/tex/latex/sttools/stfloats.sty b/Master/texmf-dist/tex/latex/sttools/stfloats.sty
new file mode 100644
index 00000000000..e13649e473d
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/sttools/stfloats.sty
@@ -0,0 +1,326 @@
+%% stfloats.sty
+%% Copyright 1997, 1999 Sigitas Tolu\v sis
+%% VTeX Ltd., Akademijos 4, Vilnius, Lithuania
+%% e-mail sigitas@vtex.lt
+%% http://www.vtex.lt/tex/download/macros/
+%%
+% This program can redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or (at your option) any later version.
+%
+% PURPOSE: Improve float mechanism and baselineskip settings
+%
+% SHORT DESCRIPTION:
+%
+% (It is rewritten version of stkernel package)
+%
+% Provides new commands:
+%
+% \dblfloatsatbottom, \dblfloatsattop (removed!)
+% -----------------------------------
+% Use instead optional parameters [b] and [t]
+% for dblfloat environments (default = [tbp]).
+%
+% \fnbelowfloat
+% -------------
+% Puts footnotes below the bottom floats
+%
+% \fnunderfloat (default and standard)
+% -------------
+% Puts footnotes under the bottom floats
+%
+% \setbaselinefloat
+% -----------------
+% Allows baselineskip to stretch and shrink if \baselineskip
+% is set with command \@setfontsize.
+% Example: \@setfontsize\normalsize\@xpt{12pt plus .1pt minus .1pt}%
+%
+% \setbaselinefixed (default and standard)
+% Disables baselineskip to stretch and shrink even if \baselineskip
+% is set with command \@setfontsize.
+% Example: \@setfontsize\normalsize\@xpt{12pt plus .1pt minus .1pt}%
+%
+% Allows to use optional parameters [t] or [b] for dblfloats.
+%
+% \changes{1997/08/25}{first version}
+% \changes{1997/09/10}{standard LaTeX2e macros are used for dblfloats at top}
+% \changes{1997/10/01}{new commands: \fnbelowfloat and \fnunderfloat}
+% \changes{1998/09/21}{new commands: \setbaselinefloat and \setbaselinefixed}
+% \changes{1999/10/04}{changed dblfloat's output}
+% \changes{1999/10/22}{changed \output for older LaTeX distributions}
+%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{stfloats}[1999/10/22]
+
+\gdef\@dblbotlist{}
+\newcount\@dblbotnum
+\newcount\c@dblbotnumber
+\setcounter{dblbotnumber}{2}
+\def\@dbflt#1{\@ifnextchar[{\@xdblfloat{#1}}{\@xdblfloat{#1}[tbp]}}
+
+\def \@dblfloatplacement {%
+ \global \@dbltopnum \c@dbltopnumber
+ \global \@dblbotnum \c@dblbotnumber
+ \global \@dbltoproom \dbltopfraction\@colht
+ \@textmin \@colht
+ \advance \@textmin -\@dbltoproom
+ \@fpmin \dblfloatpagefraction\textheight
+ \@fptop \@dblfptop
+ \@fpsep \@dblfpsep
+ \@fpbot \@dblfpbot
+}
+
+
+\def\@addtodblcol{%
+ \begingroup
+ \@insertfalse
+ \@setfloattypecounts
+ \@getfpsbit \tw@
+ \ifodd\@tempcnta
+ \@flsetnum \@dbltopnum
+ \ifnum \@dbltopnum>\z@
+ \@tempswafalse
+ \ifdim \@dbltoproom>\ht\@currbox
+ \@tempswatrue
+ \else
+ \ifnum \@fpstype<\sixt@@n
+ \advance \@dbltoproom \@textmin
+ \ifdim \@dbltoproom>\ht\@currbox
+ \@tempswatrue
+ \fi
+ \advance \@dbltoproom -\@textmin
+ \fi
+ \fi
+ \if@tempswa
+ \@bitor \@currtype \@dbldeferlist
+ \if@test
+ \else
+ \@bitor \@currtype \@dblbotlist
+ \if@test
+ \else
+ \@tempdima -\ht\@currbox
+ \advance\@tempdima
+ -\ifx \@dbltoplist\@empty \dbltextfloatsep \else
+ \dblfloatsep \fi
+ \global \advance \@dbltoproom \@tempdima
+ \global \advance \@colht \@tempdima
+ \global \advance \@dbltopnum \m@ne
+ \@cons \@dbltoplist \@currbox
+ \@inserttrue
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \if@insert
+ \else
+ \@getfpsbit 4\relax
+ \ifodd\@tempcnta
+ \@flsetnum \@dblbotnum
+ \ifnum \@dblbotnum>\z@
+ \@tempswafalse
+ \ifdim \@dbltoproom>\ht\@currbox
+ \@tempswatrue
+ \else
+ \ifnum \@fpstype<\sixt@@n
+ \advance \@dbltoproom \@textmin
+ \ifdim \@dbltoproom>\ht\@currbox
+ \@tempswatrue
+ \fi
+ \advance \@dbltoproom -\@textmin
+ \fi
+ \fi
+ \if@tempswa
+ \@bitor \@currtype \@dbldeferlist
+ \if@test
+ \else
+ \@tempdima -\ht\@currbox
+ \advance\@tempdima
+ -\ifx \@dblbotlist\@empty \dbltextfloatsep \else
+ \dblfloatsep \fi
+ \global \advance \@dbltoproom \@tempdima
+ \global \advance \@colht \@tempdima
+ \global \advance \@dblbotnum \m@ne
+ \@cons \@dblbotlist \@currbox
+ \@inserttrue
+ \fi
+ \fi
+ \fi
+ \fi
+ \if@insert
+ \else
+ \@cons\@dbldeferlist\@currbox
+ \fi
+ \fi
+ \endgroup
+}
+
+\def\@combinedblfloats{%
+ \ifx \@dbltoplist\@empty \else \@cdblflt \fi
+ \ifx \@dblbotlist\@empty \else \@cdblflb \fi
+}
+
+\def\@cdblflt{%
+ \setbox\@tempboxa \vbox{}%
+ \let \@elt \@comdblflelt
+ \@dbltoplist
+ \let \@elt \relax
+ \xdef \@freelist {\@freelist\@dbltoplist}%
+ \global\let \@dbltoplist \@empty
+ \setbox\@outputbox \vbox% to\textheight
+ {%\boxmaxdepth\maxdepth %% probably not needed, CAR
+ \unvbox\@tempboxa\vskip-\dblfloatsep
+ \ifnum \@dbltopnum>\m@ne
+ \dblfigrule
+ \fi
+ \vskip \dbltextfloatsep
+ \unvbox \@outputbox
+ }%
+}
+
+\def\@cdblflb{%
+ \setbox\@tempboxa \vbox{}%
+ \let \@elt \@comdblflelt
+ \@dblbotlist
+ \let \@elt \relax
+ \xdef \@freelist {\@freelist\@dblbotlist}%
+ \global\let \@dblbotlist \@empty
+ \setbox\@outputbox \vbox% to\textheight
+ {%\boxmaxdepth\maxdepth %% probably not needed, CAR
+ \unvbox\@outputbox
+ \vskip \dbltextfloatsep
+ \ifnum \@dblbotnum>\m@ne
+ \dblfigrule
+ \fi
+ \unvbox\@tempboxa
+ \vskip -\dblfloatsep
+ }%
+}
+
+\def \@doclearpage {%
+ \ifvoid\footins
+ \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa
+ \setbox\@tempboxa\box\@cclv
+ \xdef\@deferlist{\@toplist\@botlist\@deferlist}%
+ \global \let \@toplist \@empty
+ \global \let \@botlist \@empty
+ \global \@colroom \@colht
+ \ifx \@currlist\@empty
+ \else
+ \@latexerr{Float(s) lost}\@ehb
+ \global \let \@currlist \@empty
+ \fi
+ \@makefcolumn\@deferlist
+ \@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}%
+ \if@twocolumn
+ \if@firstcolumn
+ \xdef\@dbldeferlist{\@dbltoplist\@dblbotlist\@dbldeferlist}%
+ \global \let \@dbltoplist \@empty
+ \global \let \@dblbotlist \@empty
+ \global \@colht \textheight
+ \begingroup
+ \@dblfloatplacement
+ \@makefcolumn\@dbldeferlist
+ \@whilesw\if@fcolmade \fi{\@outputpage
+ \@makefcolumn\@dbldeferlist}%
+ \endgroup
+ \else
+ \vbox{}\clearpage
+ \fi
+ \fi
+ \else
+ \setbox\@cclv\vbox{\box\@cclv\vfil}%
+ \@makecol\@opcol
+ \clearpage
+ \fi
+}
+\global\let\org@makecol\@makecol
+\gdef \fn@makecol {%
+ \setbox\@outputbox \box\@cclv
+ \xdef\@freelist{\@freelist\@midlist}%
+ \global \let \@midlist \@empty
+ \@combinefloats
+ \ifvoid\footins
+ \else
+ \setbox\@outputbox \vbox {%
+ \boxmaxdepth \@maxdepth
+ \unvbox \@outputbox
+ \vskip \skip\footins
+ \color@begingroup
+ \normalcolor
+ \footnoterule
+ \unvbox \footins
+ \color@endgroup
+ }%
+ \fi
+ \ifvbox\@kludgeins
+ \@makespecialcolbox
+ \else
+ \setbox\@outputbox \vbox to\@colht {%
+ \@texttop
+ \dimen@ \dp\@outputbox
+ \unvbox \@outputbox
+ \vskip -\dimen@
+ \@textbottom
+ }%
+ \fi
+ \global \maxdepth \@maxdepth
+}
+\def\fnbelowfloat{\global\let\@makecol\fn@makecol}
+\def\fnunderfloat{\global\let\@makecol\org@makecol}
+
+\def\set@floatfontsize#1#2#3{%
+ \@defaultunits\@tempdimb#2pt\relax\@nnil
+ \edef\f@size{\strip@pt\@tempdimb}%
+ \@defaultunits\@tempskipa#3pt\relax\@nnil
+ \edef\f@baselineskip{\the\@tempskipa}%
+ \edef\f@linespread{#1}%
+ \let\baselinestretch\f@linespread
+ \def\size@update{%
+ \baselineskip\f@baselineskip
+ \@tempskipa\baselineskip\relax\baselineskip=1\baselineskip
+ \advance\@tempskipa by-\baselineskip\baselineskip\f@baselineskip
+ \baselineskip\f@linespread\baselineskip
+ \advance\@tempskipa by\baselineskip\baselineskip\@tempskipa
+ \normalbaselineskip\baselineskip
+ \setbox\strutbox\hbox{%
+ \vrule\@height.7\baselineskip
+ \@depth.3\baselineskip
+ \@width\z@}%
+ \let\size@update\relax
+ }%
+ }
+\let\set@@@fontsize\set@fontsize
+\def\setbaselinefloat{\let\set@fontsize\set@floatfontsize}
+\def\setbaselinefixed{\@tempdima=\baselinestretch\p@
+ \edef\baselinestretch{\strip@pt\@tempdima}\let\set@fontsize\set@@@fontsize}
+\output {%
+ \let \par \@@par
+ \ifnum \outputpenalty<-\@M
+ \@specialoutput
+ \else
+ \@makecol
+ \@opcol
+ \@startcolumn
+ \@whilesw \if@fcolmade \fi
+ {%
+ \@opcol\@startcolumn}%
+ \fi
+ \ifnum \outputpenalty>-\@Miv
+ \ifdim \@colroom<1.5\baselineskip
+ \ifdim \@colroom<\textheight
+ \@latex@warning@no@line {Text page \thepage\space
+ contains only floats}%
+ \@emptycol
+ \else
+ \global \vsize \@colroom
+ \fi
+ \else
+ \global \vsize \@colroom
+ \fi
+ \else
+ \global \vsize \maxdimen
+ \fi
+}
+\endinput
diff --git a/Master/texmf-dist/tex/latex/sttools/texsort.sty b/Master/texmf-dist/tex/latex/sttools/texsort.sty
new file mode 100644
index 00000000000..ff54e804ffb
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/sttools/texsort.sty
@@ -0,0 +1,289 @@
+%% texsort.sty
+%% Copyright 2000 Sigitas Tolu\v sis
+%% VTeX Ltd., Akademijos 4, Vilnius, Lithuania
+%% e-mail sigitas@vtex.lt
+%% http://www.vtex.lt/tex/download/macros/
+%%
+% This program can redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or (at your option) any later version.
+%
+% PURPOSE: Sort/compress numerical lists
+%
+% SHORT DESCRIPTION:
+%
+% \initarray#1#2
+% --------------
+% Converts list #2 to array #1
+%
+% \outarray#1\sep#2
+% -----------------
+% Outputs array #1 elements separated by #2
+%
+% \getarrayitem#1#2\to#3
+% ----------------------
+% Gets #2'th element from array #1 to \csname#3\endcsname
+%
+% \setarrayitem#1#2#3
+% -------------------
+% Sets #2'th element from array #1 to numeric value #3
+%
+% \getarraylenght#1
+% -----------------
+% Gets array #1 elements count
+%
+% \setarraylenght#1
+% -----------------
+% Sets array #1 elements count to value #2
+%
+% \upheap#1#2; \insertheapelem#1#2; \downheap#1#2; \removetop#1\to#2
+% ------------------------------------------------------------------
+% Internal macros of sort algorithm
+%
+% \g@addto@macrobeg#1#2
+% ---------------------
+% Adds defs #2 to macro #1 begining
+%
+% \add@zero#1
+% -----------
+% Adds 0 before #1
+%
+% \sortlistarray#1\to#2
+% ---------------------
+% Sorts array #1 to array #2
+%
+% \sortlist#1\to#2\sep#3
+% ----------------------
+% Sorts list #1 and puts to macro #2; elements separated by #3
+%
+% \compresslist#1\to#2\sep#3#4
+% ----------------------------
+% Compress list #1 and puts to macro #2;
+% single elements separated by #3, multi by #4
+%
+% Changes:
+% \changes{2000/06/06}{alfa version}
+% \changes{2000/06/08}{added compression}
+%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{texsort}[2000/06/08]
+%
+\newcount\t@mp@r@a
+\newcount\t@mp@r@b
+\newcount\t@mp@r@c
+
+\def\initarray#1#2{%
+ \bgroup
+ \@tempcnta=\z@
+ \@for\@@refb:=#2\do{%
+ \advance\@tempcnta by\@ne
+ \bgroup
+ \setbox0\hbox{\expandafter\global\expandafter\t@mp@r@a\expandafter\add@zero\@@refb\relax}%
+ \ifdim\wd0>\z@\relax\@latex@warning{Negrynas skaicius \@@refb!}\fi
+ \expandafter\edef\csname @a@\endcsname{\expandafter\xdef\expandafter
+ \noexpand\csname#1@\the\@tempcnta\endcsname{\the\t@mp@r@a}}\@a@
+ \egroup
+ }%
+ \expandafter\xdef\csname #1@lenght\endcsname{\the\@tempcnta}%
+ \egroup
+}
+\def\outarray#1\sep#2{%
+ \bgroup
+ \@tempcnta=\z@\relax
+ \@tempcntb=\getarraylenght{#1}%
+ \loop
+ \ifnum\@tempcnta<\@tempcntb
+ \advance\@tempcnta by1\relax
+ \ifnum\@tempcnta>1\relax#2\fi\csname#1@\the\@tempcnta\endcsname
+ \repeat
+ \egroup
+}
+\def\add@zero#1{0#1}
+\def\getarrayitem#1#2\to#3{\expandafter\xdef\csname#3\endcsname{\csname#1@#2\endcsname}}
+\def\setarrayitem#1#2#3{%
+ \bgroup
+ \setbox0\hbox{\expandafter\global\expandafter\t@mp@r@a\expandafter\add@zero#3\relax}%
+ \ifdim\wd0>\z@\relax\@latex@warning{Negrynas skaicius #3!}\fi
+ \expandafter\edef\csname @a@\endcsname{\expandafter\xdef\expandafter
+ \noexpand\csname#1@#2\endcsname{\the\t@mp@r@a}}\@a@
+ \egroup
+}
+\def\getarraylenght#1{\@ifundefined{#1@lenght}{0}{\csname #1@lenght\endcsname}}
+\def\setarraylenght#1#2{\expandafter\xdef\csname #1@lenght\endcsname{#2}}
+
+%#1 - masyvas, #2 - elemento nr.
+\def\upheap#1#2{%
+ \bgroup
+ \getarrayitem{#1}{#2}\to{vara}%
+ \@namedef{#1@0}{\maxdimen}%
+ \@tempcntb=#2\relax
+ \loop
+ \@tempcnta=\@tempcntb
+ \divide\@tempcnta by2\getarrayitem{#1}{\the\@tempcnta}\to{varb}%
+ \ifnum\varb>\vara\relax\else
+ \getarrayitem{#1}{\the\@tempcnta}\to{varb}%
+ \setarrayitem{#1}{\the\@tempcntb}{\varb}%
+ \divide\@tempcntb by2\relax
+ \repeat
+ \setarrayitem{#1}{\the\@tempcntb}{\vara}%
+ \egroup
+}
+
+%#1 - masyvas, #2 - dedama reiksme
+\def\insertheapelem#1#2{%
+ \bgroup
+ \@tempcnta=\getarraylenght{#1}\relax
+ \advance\@tempcnta by1\relax
+ \setarraylenght{#1}{\the\@tempcnta}\relax
+ \setarrayitem{#1}{\the\@tempcnta}{#2}%
+ \upheap{#1}{\the\@tempcnta}%
+ \egroup
+}
+
+%#1 - masyvas, #2 - elemento nr.
+\newcount\@tempcntd
+\def\downheap#1#2{%
+ \bgroup
+ \getarrayitem{#1}{#2}\to{vara}%
+ \@tempcntb=\getarraylenght{#1}%
+ \t@mp@r@c=\@tempcntb\relax
+ \divide\@tempcntb by2\relax
+ \t@mp@r@b=\@tempcntb\relax
+ \@tempcntb=#2\relax
+ \ifnum\@tempcntb>\t@mp@r@b\relax\else
+ \loop
+ \@tempcnta=\@tempcntb\advance\@tempcnta by\@tempcntb\relax
+ \@tempcntd=\@tempcnta \advance\@tempcntd by1\relax
+ \ifnum\@tempcnta<\t@mp@r@c\relax
+ \getarrayitem{#1}{\the\@tempcnta}\to{temp@@a}%
+ \getarrayitem{#1}{\the\@tempcntd}\to{temp@@b}%
+ \ifnum\temp@@a<\temp@@b\relax
+ \@tempcnta=\@tempcntd
+ \fi
+ \fi
+ \getarrayitem{#1}{\the\@tempcnta}\to{temp@@a}%
+ \ifnum\vara>\temp@@a\relax
+ \t@mp@r@b=-1\relax
+ \else
+ \getarrayitem{#1}{\the\@tempcnta}\to{temp@@a}%
+ \setarrayitem{#1}{\the\@tempcntb}{\temp@@a}%
+ \@tempcntb=\@tempcnta
+ \fi
+ \ifnum\@tempcntb>\t@mp@r@b\relax
+ \else
+ \repeat
+ \fi
+ \setarrayitem{#1}{\the\@tempcntb}{\vara}%
+ \egroup
+}
+
+\def\removetop#1\to#2{%
+ \bgroup
+ \getarrayitem{#1}{1}\to{temp@@c}%
+ \expandafter\xdef\csname #2\endcsname{\temp@@c}%
+ \@tempcnta=\getarraylenght{#1}%
+ \getarrayitem{#1}{\the\@tempcnta}\to{temp@@a}%
+ \setarrayitem{#1}{1}{\temp@@a}%
+ \setarrayitem{#1}{\the\@tempcnta}{}%
+ \advance\@tempcnta by-1\relax
+ \setarraylenght{#1}{\the\@tempcnta}%
+ \downheap{#1}{1}%
+ \egroup
+}
+\long\def\g@addto@macrobeg#1#2{%
+ \begingroup
+ \def\@a@{#2}%
+ \toks@\expandafter\expandafter\expandafter{\expandafter\@a@#1}%
+ \xdef#1{\the\toks@}%
+ \endgroup}
+
+\def\sortlistarray#1\to#2{%
+ \bgroup
+ \@for\@@refb:=#1\do{%
+ \insertheapelem{@tempa@}{\@@refb}%
+ }%
+ \@tempcntb=\getarraylenght{@tempa@}%
+ \setarraylenght{#2}{\the\@tempcntb}%
+ \@for\@@refb:=#1\do{%
+ \removetop{@tempa@}\to{aka}%
+ \setarrayitem{#2}{\the\@tempcntb}{\aka}%
+ \advance\@tempcntb by-1\relax
+ }%
+ \egroup
+}
+\def\sortlist#1\to#2\sep#3{%
+ \bgroup
+ \@for\@@refb:=#1\do{%
+ \insertheapelem{@tempa@}{\@@refb}%
+ }%
+ \@tempcntb=\getarraylenght{@tempa@}%
+ \expandafter\def\csname#2\endcsname{}%
+ \expandafter\def\expandafter\@a@\expandafter{\csname#2\endcsname}%
+ \@for\@@refb:=#1\do{%
+ \removetop{@tempa@}\to{aka}%
+ \advance\@tempcntb by-1\relax
+ \expandafter\expandafter\expandafter\g@addto@macrobeg\expandafter\@a@\expandafter{\aka}%
+ \ifnum\@tempcntb>0\relax
+ \expandafter\expandafter\expandafter\g@addto@macrobeg\expandafter\@a@\expandafter{#3}%
+ \fi
+ }%
+ \egroup
+}
+\def\compresslist#1\to#2\sep#3#4{%
+ \bgroup
+ \expandafter\def\csname#2\endcsname{}%
+ \expandafter\def\expandafter\@a@\expandafter{\csname#2\endcsname}%
+ \t@mp@r@a=-1\relax
+ \@tempcnta=-2\relax
+ \expandafter\@for\expandafter\@@refb\expandafter:\expandafter=#1\do{%
+ \ifnum\t@mp@r@a=-1\relax
+ \t@mp@r@a=\@@refb\relax
+ \t@mp@r@b=\@@refb\relax
+ \t@mp@r@c=\@@refb\relax
+ \expandafter\expandafter\expandafter\g@addto@macro\expandafter\@a@\expandafter{\the\t@mp@r@a}%
+ \else
+ \t@mp@r@c=\@@refb\relax
+ \ifnum\t@mp@r@c=\t@mp@r@a\relax
+ \expandafter\expandafter\expandafter\g@addto@macro\expandafter\@a@\expandafter{#3}%
+ \expandafter\expandafter\expandafter\g@addto@macro\expandafter\@a@\expandafter{\the\t@mp@r@c}%
+ \t@mp@r@b=\t@mp@r@c\relax
+ \else
+ \@tempcnta=\t@mp@r@b\relax
+ \advance\@tempcnta by1\relax
+ \ifnum\@tempcnta=\t@mp@r@c\relax
+ \t@mp@r@b=\t@mp@r@c\relax
+ \else
+ \@tempcnta=\t@mp@r@a\relax
+ \advance\@tempcnta by-\t@mp@r@b\relax
+ \ifnum\@tempcnta<-1\relax
+ \expandafter\expandafter\expandafter\g@addto@macro\expandafter\@a@\expandafter{#4}%
+ \expandafter\expandafter\expandafter\g@addto@macro\expandafter\@a@\expandafter{\the\t@mp@r@b}%
+ \expandafter\expandafter\expandafter\g@addto@macro\expandafter\@a@\expandafter{#3}%
+ \expandafter\expandafter\expandafter\g@addto@macro\expandafter\@a@\expandafter{\the\t@mp@r@c}%
+ \else
+ \ifnum\t@mp@r@a<\t@mp@r@b
+ \expandafter\expandafter\expandafter\g@addto@macro\expandafter\@a@\expandafter{#3}%
+ \expandafter\expandafter\expandafter\g@addto@macro\expandafter\@a@\expandafter{\the\t@mp@r@b}%
+ \fi
+ \expandafter\expandafter\expandafter\g@addto@macro\expandafter\@a@\expandafter{#3}%
+ \expandafter\expandafter\expandafter\g@addto@macro\expandafter\@a@\expandafter{\the\t@mp@r@c}%
+ \fi
+ \t@mp@r@a=\t@mp@r@c\relax
+ \t@mp@r@b=\t@mp@r@c\relax
+ \fi
+ \fi
+ \fi
+ }%
+ \ifnum\t@mp@r@a<\t@mp@r@c\relax
+ \advance\t@mp@r@a by-\t@mp@r@c\relax
+ \ifnum\t@mp@r@a<-1\relax
+ \expandafter\expandafter\expandafter\g@addto@macro\expandafter\@a@\expandafter{#4}%
+ \else
+ \expandafter\expandafter\expandafter\g@addto@macro\expandafter\@a@\expandafter{#3}%
+ \fi
+ \expandafter\expandafter\expandafter\g@addto@macro\expandafter\@a@\expandafter{\the\t@mp@r@c}%
+ \fi
+ \egroup
+}
+\endinput