[BACK]Return to flushend.sty CVS log [TXT][DIR] Up to [local] / OpenXM / doc / calc2000

Annotation of OpenXM/doc/calc2000/flushend.sty, Revision 1.1.1.1

1.1       noro        1: %$OpenXM: OpenXM/doc/issac2000/flushend.sty,v 1.1 1999/12/26 06:33:05 takayama Exp $
                      2:
                      3: %% flushend.sty
                      4: %% Copyright 1997 Sigitas Tolu\v sis
                      5: %% VTeX Ltd., Akademijos 4, Vilnius, Lithuania
                      6: %% e-mail sigitas@vtex.lt
                      7: %% http://www.vtex.lt/tex/download/macros/
                      8: %%
                      9: %% This program can redistributed and/or modified under the terms
                     10: %% of the LaTeX Project Public License Distributed from CTAN
                     11: %% archives in directory macros/latex/base/lppl.txt; either
                     12: %% version 1 of the License, or (at your option) any later version.
                     13: %%
                     14: %% PURPOSE:   Balanced columns on last page in twocolumn mode.
                     15: %%
                     16: %% SHORT DESCRIPTION:
                     17: %%
                     18: %% \flushend (loaded by default)
                     19: %% ---------
                     20: %%   Switches on column balancing at last page
                     21: %%
                     22: %% \raggedend
                     23: %% ----------
                     24: %%   Switches off column balancing at last page
                     25: %%
                     26: %% \atColsBreak={#1}
                     27: %% ------------------
                     28: %%   Adds #1 in place of original column break (without balancing)
                     29: %%   Example: \atColsBreak{\vskip-2pt}
                     30: %%
                     31: %% \showcolsendrule
                     32: %% ----------------
                     33: %%   Adds rule to the bottom of columns (just for debugging)
                     34: %%
                     35: %% P.S. To stretch right column by #1 add command \vskip-#1 just before
                     36: %%      command \end{document}.
                     37: %%      TO shrink right column by #1 add command \vskip#1 just before
                     38: %%      command \end{document}.
                     39: %%      Example: \vskip-10pt
                     40: %%               \end{document}
                     41: %%
                     42: %% \changes{1997/05/16}{first version}
                     43: %% \changes{1997/09/09}{support for compatibility with cuted.sty}
                     44: %% \changes{1997/10/01}{\vipersep changed to \stripsep for
                     45: %%                      compatibility with cuted.sty}
                     46: %%
                     47: \NeedsTeXFormat{LaTeX2e}
                     48: \ProvidesPackage{flushend}[1997/10/01]
                     49: \newbox\@aaa
                     50: \newbox\@ccc
                     51: \@ifundefined{@viper}{\newbox\@viper}{}
                     52: \@ifundefined{hold@viper}{\newbox\hold@viper}{}
                     53: \newtoks\atColsBreak \atColsBreak={}
                     54: \newdimen\@extra@skip \@extra@skip\z@
                     55: \newdimen\@nd@page@rule \@nd@page@rule\z@
                     56: \def\last@outputdblcol{%
                     57:   \if@firstcolumn
                     58:     \global \@firstcolumnfalse
                     59:     \global \setbox\@leftcolumn \box\@outputbox
                     60:   \else
                     61:     \global \@firstcolumntrue
                     62:     \if@lastpage
                     63:       \@tempdima\ht\@leftcolumn
                     64:       \splittopskip\topskip\splitmaxdepth\maxdepth
                     65:       \setbox\@tempboxa\vbox{%
                     66:                 \unvbox\@leftcolumn\setbox0\lastbox\unskip%
                     67:                 \the\atColsBreak%
                     68:                 \unvbox\@outputbox\setbox0\lastbox\unskip}%
                     69:       \@tempdimb .5\ht\@tempboxa%
                     70:      \loop
                     71:      \setbox\@aaa\copy\@tempboxa%
                     72:      \setbox\@ccc\vbox to\@tempdimb{%
                     73:                 \vsplit\@aaa to\@tempdimb\vss%
                     74:                 \vsplit\@aaa to\@tempdimb}%
                     75:      \wlog{Extra height:\the\ht\@aaa\space when \the\@tempdimb}%
                     76:      \ifvoid\@aaa \else \advance\@tempdimb 1pt \repeat%
                     77:      \loop
                     78:      \setbox\@aaa\copy\@tempboxa%
                     79:      \setbox\@ccc\vbox to\@tempdimb{%
                     80:                 \vsplit\@aaa to\@tempdimb\vss}%
                     81:      \wlog{(2)Left:\the\ht\@ccc\space
                     82:               Right:\the\ht\@aaa\space Output:\the\@tempdimb}%
                     83:      \ifdim \ht\@ccc<\ht\@aaa \@tempdimb \the\ht\@aaa \repeat%
                     84:      \wlog{- LAST -^^J
                     85:            Extra skip:\the\@extra@skip^^J
                     86:            Left:\the\ht\@ccc^^JRight:\the\ht\@aaa^^J
                     87:            Output:\the\@tempdimb}%
                     88:     \setbox\@ccc\vbox to\@tempdimb{%
                     89:                 \vsplit\@tempboxa to\@tempdimb\vss}%
                     90:     \setbox\@leftcolumn\vbox to\@tempdima{%
                     91:                 \vbox to\@tempdimb{\unvbox\@ccc}%
                     92:                 \hrule\@height\@nd@page@rule%
                     93:                 \vss}%
                     94:     \setbox\@outputbox\vbox to\@tempdima{%
                     95:                 \vbox to\@tempdimb{\unvbox\@tempboxa\vfilneg%
                     96:                                    \vskip\@extra@skip}%
                     97:                 \hrule\@height\@nd@page@rule%
                     98:                 \vss}%
                     99:     \setbox\@outputbox \vbox {%
                    100:                          \hb@xt@\textwidth {%
                    101:                            \hb@xt@\columnwidth {%
                    102:                              \box\@leftcolumn \hss}%
                    103:                            \hfil
                    104:                            \vrule \@width\columnseprule
                    105:                            \hfil
                    106:                            \hb@xt@\columnwidth {%
                    107:                              \box\@outputbox \hss}%
                    108:                                              }%
                    109:                               }%
                    110:     \else
                    111:     \setbox\@outputbox \vbox {%
                    112:                          \hb@xt@\textwidth {%
                    113:                            \hb@xt@\columnwidth {%
                    114:                              \box\@leftcolumn \hss}%
                    115:                            \hfil
                    116:                            \vrule \@width\columnseprule
                    117:                            \hfil
                    118:                            \hb@xt@\columnwidth {%
                    119:                              \box\@outputbox \hss}%
                    120:                                              }%
                    121:                               }%
                    122:     \fi
                    123:     \ifvoid\hold@viper
                    124:     \else
                    125:       \setbox\@outputbox \vbox{\box\hold@viper\box\@outputbox}%
                    126:     \fi
                    127:     \@combinedblfloats
                    128:     \@outputpage
                    129:     \begingroup
                    130:       \@dblfloatplacement
                    131:       \@startdblcolumn
                    132:       \@whilesw\if@fcolmade \fi
                    133:         {\@outputpage
                    134:          \@startdblcolumn}%
                    135:       \ifvoid\@viper
                    136:       \else
                    137:         \global\setbox\@viper\vbox{%
                    138:                 \vskip-\stripsep\unvbox\@viper}\@viperoutput
                    139:       \fi
                    140:     \endgroup
                    141:   \fi
                    142: }
                    143: \let\prev@enddocument\enddocument
                    144: \newif\if@lastpage \@lastpagefalse
                    145: \def\enddocument{%
                    146:   \global\@lastpagetrue%
                    147:   \let\@outputdblcol\last@outputdblcol%
                    148:   \prev@enddocument%
                    149: }
                    150: \def\raggedend{%
                    151:   \global\let\enddocument\prev@enddocument%
                    152: }
                    153: \def\flushend{%
                    154:   \gdef\enddocument{%
                    155:     \global\@lastpagetrue%
                    156:     \let\@outputdblcol\last@outputdblcol%
                    157:     \prev@enddocument%
                    158:     }
                    159:   }
                    160: \def\showcolsendrule{\global\@nd@page@rule=.4pt}
                    161: \endinput
                    162: %%
                    163: %% End of file `flushend.sty'.

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>