diff options
author | Karl Berry <karl@freefriends.org> | 2011-10-28 23:39:47 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-10-28 23:39:47 +0000 |
commit | 08521dabedd78b6b28f56c0fc227f17acfbd5daa (patch) | |
tree | 2298f971bc0a87a331961cc1ab33bf82891f2142 /Master/texmf-dist/tex/latex/paracol | |
parent | 8c4c55e62396b8d36fdbae726ebb52e47a8e449d (diff) |
paracol (28oct11)
git-svn-id: svn://tug.org/texlive/trunk@24426 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/paracol')
-rw-r--r-- | Master/texmf-dist/tex/latex/paracol/paracol.sty | 782 |
1 files changed, 515 insertions, 267 deletions
diff --git a/Master/texmf-dist/tex/latex/paracol/paracol.sty b/Master/texmf-dist/tex/latex/paracol/paracol.sty index 3239839b8ba..76970d3e738 100644 --- a/Master/texmf-dist/tex/latex/paracol/paracol.sty +++ b/Master/texmf-dist/tex/latex/paracol/paracol.sty @@ -1,34 +1,45 @@ -% Style file `paracol -% Copyright (C) 2005-2011 -% Hiroshi Nakashima <h.nakashima@DOMAIN; DOMAIN=media.kyoto-u.ac.jp> -% (Kyoto University) -% This program can be 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 any later version. +%% Style file `paracol'. +%% Copyright (C) 2005-2011 +%% Hiroshi Nakashima <h.nakashima@DOMAIN; DOMAIN=media.kyoto-u.ac.jp> +%% (Kyoto University) +%% This program can be 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 any later version. \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{paracol}[2011/09/16 v0.91 ] +\ProvidesPackage{paracol} +[2011/10/10 v1.0 ] + +%% Register Declaration \newcount\pcol@currcol \newcount\pcol@nextcol \newcount\pcol@ncol \newcount\pcol@page -\newcount\pcol@maxpage \newcount\pcol@basepage -\newif\ifpcol@textonly -\newif\ifpcol@sync -\newif\ifpcol@clear -\newif\ifpcol@stopoutput +\newcount\pcol@toppage +\newif\ifpcol@nospan +\newif\ifpcol@sync \pcol@syncfalse +\newif\ifpcol@mctext \pcol@mctextfalse +\newif\ifpcol@clear \pcol@clearfalse +\newif\ifpcol@outputflt +\newif\ifpcol@lastpage \newdimen\pcol@prevdepth \newdimen\pcol@colht +\newdimen\pcol@textfloatsep \newskip\pcol@topskip +%% \output Routine + +\def\pcol@ovf{% + \PackageError{paracol}{Too many unprocessed columns/floats}\@ehb} + \def\pcol@output{\let\par\@@par \ifnum\outputpenalty<-\@M \pcol@specialoutput \else - \@makecol + \pcol@makecol \pcol@opcol \pcol@startcolumn \@whilesw\if@fcolmade\fi{\pcol@opcol \pcol@startcolumn}% @@ -49,10 +60,41 @@ \global\vsize\maxdimen \fi} - +%% Completing Column-Page + +\def\pcol@makecol{\let\pcol@textbottom\@textbottom + \ifdim\pcol@textfloatsep=\maxdimen\else \ifpcol@lastpage\else + \def\@textbottom{\vskip\z@\@plus.0001fil\@minus.0001fil}\fi\fi + \@makecol \let\@textbottom\pcol@textbottom} +\def\pcol@combinefloats{% + \ifx\@toplist\@empty\else + \ifdim\pcol@textfloatsep=\maxdimen \@cflt \else \pcol@cflt \fi + \fi + \ifx\@botlist\@empty\else \@cflb + \ifpcol@lastpage + \setbox\@outputbox\vbox{\unvbox\@outputbox \vskip\textfloatsep + \@tempdima\textfloatsep \vskip\z@\@minus\@tempdima}% + \fi + \fi} +\def\pcol@cflt{% + \let\@elt\@comflelt + \setbox\@tempboxa\vbox{}% + \@toplist + \setbox\@outputbox\vbox{ + \boxmaxdepth\maxdepth + \box\@tempboxa + \vskip-\floatsep + \ifdim\pcol@textfloatsep>5000\p@ + \advance\pcol@textfloatsep-\@M\p@ + \else + \topfigrule + \fi + \vskip\pcol@textfloatsep + \unvbox\@outputbox}% + \let\@elt\relax + \xdef\@freelist{\@freelist\@toplist}% + \global\let\@toplist\@empty} -\def\pcol@ovf{% - \PackageError{paracol}{Too many unprocessed columns/floats}\@ehb} \def\pcol@opcol{% \@next\@currbox\@freelist{\global\setbox\@currbox\box\@outputbox}\pcol@ovf \expandafter\@cons\csname pcol@shipped\number\pcol@currcol\endcsname\@currbox @@ -60,22 +102,11 @@ \pcol@nextpage \pcol@checkshipped \if@tempswa \pcol@outputpage\z@ \fi - \global\@colht\textheight - \ifnum\pcol@page>\pcol@maxpage \pcol@startpage + \ifnum\pcol@page>\pcol@toppage \pcol@startpage \else \pcol@getcurrpage \fi \pcol@floatplacement} -\def\pcol@checkshipped{\@tempswatrue - \@tempcnta\z@ \@whilenum\@tempcnta<\pcol@ncol\do{% - \expandafter\ifx\csname pcol@shipped\number\@tempcnta\endcsname\@empty - \@tempswafalse \fi - \advance\@tempcnta\@ne}} - -\def\pcol@getcurrpinfo#1{% - \edef#1{\expandafter\@cdr\pcol@currpage\@nil}% - \pcol@getpinfo#1} - \def\pcol@setpageno{\begingroup \@tempcnta\pcol@page \advance\@tempcnta-\pcol@basepage \edef\reserved@a{\pcol@pages\pcol@currpage}% @@ -84,18 +115,24 @@ \endgroup} \def\pcol@setpnoelt#1{% {\let\@elt\relax \xdef\pcol@pages{\pcol@pages\pcol@currpage}}% - \pcol@textonlytrue + \pcol@nospantrue \ifnum#1<\z@ \gdef\pcol@currpage{\@elt{#1}}% \else\ifnum#1>\@cclv \gdef\pcol@currpage{\@elt{#1}}% - \else \gdef\pcol@currpage{\@elt#1}\pcol@textonlyfalse + \else \gdef\pcol@currpage{\@elt#1}\pcol@nospanfalse \fi\fi \ifnum\@tempcnta>\z@\else - \ifpcol@textonly \pcol@settextpage - \else \global\count#1\c@page + \ifpcol@nospan \pcol@setordpage + \else \global\count#1\c@page \fi \advance\c@page\@ne \fi \advance\@tempcnta\m@ne} +\def\pcol@setordpage{\begingroup + \@tempcnta\c@page + \ifnum\@tempcnta<\z@\else \advance\@tempcnta\@cclvi \fi + \let\@elt\relax \xdef\pcol@currpage{\@elt{\number\@tempcnta}} + \endgroup} + \def\pcol@nextpage{\begingroup \@tempcnta\pcol@page \advance\@tempcnta-\pcol@basepage \@tempswatrue @@ -112,6 +149,13 @@ \fi\fi\fi \fi \advance\@tempcnta\m@ne} + +\def\pcol@checkshipped{\@tempswatrue + \@tempcnta\z@ \@whilenum\@tempcnta<\pcol@ncol\do{% + \expandafter\ifx\csname pcol@shipped\number\@tempcnta\endcsname\@empty + \@tempswafalse \fi + \advance\@tempcnta\@ne}} + \def\pcol@getcurrpage{\begingroup \@tempcnta\pcol@page \advance\@tempcnta-\pcol@basepage \let\@elt\pcol@getpelt \pcol@pages\pcol@currpage @@ -120,29 +164,29 @@ \ifnum\@tempcnta=\z@ \pcol@getpinfo{#1}{\global\c@page}{\global\@colht}{\global\topskip}\fi \advance\@tempcnta\m@ne} - -\def\pcol@getpinfo#1#2#3#4{\count@#1\relax \pcol@textonlytrue +\def\pcol@getpinfo#1#2#3#4{\count@#1\relax \pcol@nospantrue \ifnum\count@>\@cclv \advance\count@-\@cclvi #2\count@ #3\textheight #4\pcol@topskip \else\ifnum\count@<\z@ #2\count@ #3\textheight #4\pcol@topskip - \else #2\count\count@ #3\dimen\count@ #4\skip\count@ \pcol@textonlyfalse + \else #2\count\count@ #3\dimen\count@ #4\skip\count@ \pcol@nospanfalse \fi\fi} -\def\pcol@settextpage{\begingroup - \@tempcnta\c@page - \ifnum\@tempcnta<\z@\else \advance\@tempcnta\@cclvi \fi - \let\@elt\relax \xdef\pcol@currpage{\@elt{\number\@tempcnta}} - \endgroup} +\def\pcol@getcurrpinfo#1{% + \edef#1{\expandafter\@cdr\pcol@currpage\@nil}% + \pcol@getpinfo#1} + +%% Starting New Page \def\pcol@startpage{% - \global\pcol@maxpage\pcol@page + \global\let\pcol@firstprevdepth\relax + \global\pcol@toppage\pcol@page \ifx\pcol@currpage\@empty\else \pcol@getcurrpinfo\@currbox{\global\c@page}\@tempdima\@tempskipa \stepcounter{page}% + \xdef\pcol@pages{\pcol@pages\pcol@currpage}% \fi \global\@colht\textheight \global\topskip\pcol@topskip - \xdef\pcol@pages{\pcol@pages\pcol@currpage}% \@dblfloatplacement \@tryfcolumn\@dbldeferlist \@whilesw\if@fcolmade\fi{% @@ -153,7 +197,7 @@ \global\skip\@currbox\pcol@topskip \@cons\pcol@pages\@currbox \stepcounter{page}% - \global\advance\pcol@page\@ne \global\pcol@maxpage\pcol@page + \global\advance\pcol@page\@ne \global\pcol@toppage\pcol@page \@tryfcolumn\@dbldeferlist}% \begingroup \let\reserved@b\@dbldeferlist @@ -162,7 +206,7 @@ \reserved@b \endgroup \ifx\@dbltoplist\@empty - \pcol@settextpage + \pcol@setordpage \else \setbox\@tempboxa\vbox{}% \begingroup @@ -184,9 +228,10 @@ \fi } +%% Shipping Page Out \def\pcol@outputpage#1{\begingroup - \def\@elt{\pcol@outputelt#1}\@tempswatrue \pcol@stopoutputfalse + \def\@elt{\pcol@outputelt#1}\@tempswatrue \pcol@outputflttrue \let\reserved@b\pcol@pages \gdef\pcol@pages{}% \reserved@b \endgroup} @@ -195,16 +240,16 @@ \def\@currbox{#2}% \pcol@getpinfo\@currbox\c@page\@tempdima\@tempskipa \ifdim\@tempdima<\z@ - \ifpcol@stopoutput - \@cons\pcol@pages\@currbox - \else + \ifpcol@outputflt \setbox\@outputbox\box\@currbox \@cons\@freelist\@currbox + \else + \@cons\pcol@pages\@currbox \fi \else\if@tempswa \ifnum#1=\z@ \@tempswafalse \fi \setbox\@outputbox\vbox to\textheight{% - \ifpcol@textonly\else + \ifpcol@nospan\else \@cons\@freelist\@currbox \unvbox\@currbox \fi @@ -219,8 +264,8 @@ \let\pcol@hfil\hfil \advance\@tempcnta\@ne}}}% \else - \pcol@stopoutputtrue - \ifpcol@textonly + \pcol@outputfltfalse + \ifpcol@nospan \@cons\pcol@pages{{\@currbox}} \else \@cons\pcol@pages\@currbox @@ -230,11 +275,12 @@ \@outputpage \global\advance\pcol@basepage\@ne \fi} +%% Starting New Column Page + \def\pcol@startcolumn{% \global\@colroom\@colht \@tryfcolumn\@deferlist - \if@fcolmade\else \pcol@trynextcolumn \fi -} + \if@fcolmade\else \pcol@trynextcolumn \fi} \def\pcol@trynextcolumn{\begingroup \let\reserved@b\@deferlist \global\let\@deferlist\@empty @@ -242,9 +288,8 @@ \reserved@b \endgroup} - +%% Special Output Routines: Dispatcher -\let\pcol@latex@specialoutput\@specialoutput \def\pcol@op@start{-10010} \def\pcol@op@switch{-10011} \def\pcol@op@flush{-10012} @@ -261,43 +306,49 @@ \let\reserved@a\pcol@output@clear \else\ifnum\outputpenalty=\pcol@op@end\relax \let\reserved@a\pcol@output@end - \else \let\reserved@a\pcol@latex@specialoutput + \else \let\reserved@a\@specialoutput \fi\fi\fi\fi\fi - \ifx\reserved@a\pcol@latex@specialoutput\else + \ifx\reserved@a\@specialoutput\else \global\setbox\@holdpg\vbox{\unvbox\@holdpg \unvbox\@cclv \setbox\@tempboxa\lastbox \unskip}% \outputpenalty-\@M \fi \reserved@a} +%% Special Output Routines: Building First Page + \def\pcol@output@start{% \pcol@makenormalcol \global\advance\@colht-\ht\@outputbox \global\advance\@colht-\dp\@outputbox + \global\pcol@page\z@ \global\pcol@toppage\z@ \global\pcol@basepage\z@ + \global\let\pcol@pages\@empty + \global\let\@dbldeferlist\@deferlist \global\let\@deferlist\@empty + \ifdim\@colht<1.5\baselineskip + \@outputpage + \global\let\pcol@currpage\@empty \pcol@startpage + \global\topskip\pcol@topskip + \else + \@next\@currbox\@freelist{\global\setbox\@currbox\box\@outputbox}\pcol@ovf + \global\count\@currbox\c@page \global\dimen\@currbox\@colht + \@tempskipa\z@ + \ifdim\ht\@currbox=\z@ \ifdim\dp\@currbox=\z@ + \@tempskipa\topskip + \fi\fi + \global\skip\@currbox\@tempskipa \global\topskip\@tempskipa + \xdef\pcol@currpage{\@elt\@currbox}% + \fi \global\@colroom\@colht - \@next\@currbox\@freelist{\global\setbox\@currbox\box\@outputbox}\pcol@ovf - \global\count\@currbox\c@page \global\dimen\@currbox\@colht - \@tempdima\dp\@currbox \@tempskipa\z@ - \ifdim\ht\@currbox=\z@ \ifdim\dp\@currbox=\z@ - \@tempskipa\topskip - \fi\fi - \global\skip\@currbox\@tempskipa \global\topskip\@tempskipa - \xdef\pcol@currpage{\@elt\@currbox}\global\let\pcol@pages\@empty - \global\pcol@page\z@ \global\pcol@maxpage\z@ \global\pcol@basepage\z@ - \global\let\@dbldeferlist\@deferlist - \global\let\@deferlist\@empty \pcol@floatplacement -% may fix begin \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% \@next\@currbox\@freelist{\global\setbox\@currbox\vbox{% \ifdim\topskip=\z@ \hrule\@height\z@\@width\z@ -% \kern-\@tempdima \fi}} -% may fix end \pcol@ovf \pcol@setcurrcolnf \global\count\@currbox\z@ \global\dimen\@currbox\@colroom + \expandafter\gdef\csname pcol@shipped\number\pcol@currcol\endcsname{}% \advance\pcol@currcol\@ne}% \global\pcol@currcol\z@ \pcol@getcurrcol @@ -324,9 +375,10 @@ \def\pcol@floatplacement{% \global\@mparbottom\z@ \global\@textfloatsheight\z@ + \global\pcol@textfloatsep\maxdimen \@floatplacement} - +%% Special Output Routines: Column-Switching \def\pcol@output@switch{% \@next\@currbox\@freelist{\global\setbox\@currbox\box\@holdpg}\pcol@ovf @@ -345,15 +397,18 @@ \global\dimen\@currbox\@colroom \@tempswafalse \ifpcol@sync - \@tempswatrue - \if@nobreak + \ifpcol@mctext + \if@nobreak \@tempswatrue \fi \@temptokena\everypar \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% - \pcol@getcurrcol \@nobreaktrue - \everypar\@temptokena - \pcol@setcurrcol + \pcol@getcurrcol \if@tempswa \@nobreaktrue \fi + \everypar\@temptokena + \pcol@setcurrcol \advance\pcol@currcol\@ne}% - \fi\fi + \fi + \@tempswatrue + \global\pcol@mctextfalse + \fi \ifpcol@clear \@tempswatrue \fi \if@tempswa \pcol@sync \fi \ifpcol@clear\else \pcol@restartcolumn \fi} @@ -365,19 +420,19 @@ \global\@colroom\dimen\@currbox \@cons\@freelist\@currbox \pcol@getcurrpage - \ifvoid\pcol@currfoot\else - \insert\footins{\unvbox\pcol@currfoot}\@cons\@freelist\pcol@currfoot - \fi + \ifvoid\pcol@currfoot\else \@cons\@freelist\pcol@currfoot \fi + \pcol@getcurrfoot + \ifvoid\footins\else \insert\footins{\unvbox\footins}\fi \unvbox\@currbox \if@nobreak \nobreak \else \addpenalty\interlinepenalty \fi} \def\pcol@getcurrcol{% \expandafter\expandafter\expandafter\pcol@igetcurrcol \csname pcol@col\number\pcol@currcol\endcsname} -\def\pcol@igetcurrcol#1#2#3#4#5#6#7#8{% +\def\pcol@igetcurrcol#1#2#3#4#5#6#7#8#9{% \def\@currbox{#1}\def\pcol@currfoot{#2}\global\pcol@prevdepth#3sp\relax \gdef\@toplist{#4}\gdef\@midlist{#5}\gdef\@botlist{#6}\gdef\@deferlist{#7}% - \pcol@iigetcurrcol#8} + \global\pcol@textfloatsep#8sp\pcol@iigetcurrcol#9} \def\pcol@iigetcurrcol#1#2#3#4#5#6#7#8#9{% \global\@textfloatsheight#1sp\relax \global\@mparbottom#2sp\relax \global\@topnum#3\relax \global\@toproom#4sp\relax @@ -390,15 +445,6 @@ \relax \fi \global\everypar{#9}} -\def\pcol@setcurrcol{{\let\@elt\relax - \@tempcnta\if@nobreak\if@afterindent\@ne\else\tw@\fi\else\z@\fi - \expandafter\xdef\csname pcol@col\number\pcol@currcol\endcsname{% - {\@currbox}{\pcol@currfoot}{\number\pcol@prevdepth}% - {\@toplist}{\@midlist}{\@botlist}{\@deferlist}% - {{\number\@textfloatsheight}{\number\@mparbottom}% - {\number\@topnum}{\number\@toproom}{\number\@botnum}{\number\@botroom}% - {\number\@colnum}{\number\@tempcnta}{\the\everypar}}}}} -\def\pcol@setcurrcolnf{\def\pcol@currfoot{\voidb@x}\pcol@setcurrcol} \def\pcol@getcurrfoot{% \ifvoid\pcol@currfoot \global\setbox\footins\box\voidb@x \else @@ -407,14 +453,24 @@ \global\dimen\footins\dimen\pcol@currfoot \global\skip\footins\skip\pcol@currfoot \fi} +\def\pcol@setcurrcol{{\let\@elt\relax + \@tempcnta\if@nobreak\if@afterindent\@ne\else\tw@\fi\else\z@\fi + \expandafter\xdef\csname pcol@col\number\pcol@currcol\endcsname{% + {\@currbox}{\pcol@currfoot}{\number\pcol@prevdepth}% + {\@toplist}{\@midlist}{\@botlist}{\@deferlist}{\number\pcol@textfloatsep}% + {{\number\@textfloatsheight}{\number\@mparbottom}% + {\number\@topnum}{\number\@toproom}{\number\@botnum}{\number\@botroom}% + {\number\@colnum}{\number\@tempcnta}{\the\everypar}}}}} +\def\pcol@setcurrcolnf{\def\pcol@currfoot{\voidb@x}\pcol@setcurrcol} - +%% Special Output Routines: Synchronization \def\pcol@sync{% \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do\pcol@flushcolumn \pcol@outputpage\@ne \pcol@getcurrpinfo\@currbox{\global\c@page}{\global\@colht}{\global\topskip}% \@tempdima-\maxdimen \@tempdimb-\maxdimen \pcol@colht-\maxdimen + \@tempdimc\maxdimen \@pagedp\maxdimen \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do\pcol@measurecolumn \ifdim\@tempdima<\z@\else \advance\@tempdimb\@tempdima @@ -428,11 +484,11 @@ \def\pcol@flushcolumn{% \pcol@getcurrcol - \ifnum\count\@currbox<\pcol@maxpage + \ifnum\count\@currbox<\pcol@toppage \pcol@page\count\@currbox - \setbox\@cclv\box\@currbox - \pcol@getcurrfoot + \setbox\@cclv\vbox{\unvbox\@currbox \vfil}% \ifvoid\pcol@currfoot\else \@cons\@freelist\pcol@currfoot \fi + \pcol@getcurrfoot \pcol@getcurrpage \@makecol \global\setbox\@currbox\box\@outputbox @@ -440,7 +496,7 @@ \@currbox \advance\pcol@page\@ne \ifx\@deferlist\@empty\else - \@whilenum\pcol@page<\pcol@maxpage\do{% + \@whilenum\pcol@page<\pcol@toppage\do{% \pcol@getcurrpage \@makefcolumn\@deferlist \if@fcolmade @@ -452,156 +508,197 @@ \advance\pcol@page\@ne}% \fi \@next\@currbox\@freelist{\global\setbox\@currbox\vbox{}}\pcol@ovf - \pcol@floatplacement \global\@colroom\@colht + \pcol@getcurrpinfo\reserved@a\@tempcnta{\global\@colht}\@tempskipa + \global\@colroom\@colht \pcol@floatplacement \ifx\@deferlist\@empty\else - \pcol@getcurrpage \global\@colroom\@colht - \pcol@trynextcolumn - \fi + \ifpcol@clear + \pcol@makefcolumn \global\@colroom\@colht + \else + \pcol@trynextcolumn + \fi\fi \pcol@setcurrcolnf \global\count\@currbox\pcol@page \global\dimen\@currbox\@colroom - \fi %\ifnum\count\@currbox<\pcol@maxpage + \fi %\ifnum\count\@currbox<\pcol@toppage \advance\pcol@currcol\@ne} +\def\pcol@makefcolumn{% + \ifpcol@lastpage \@tempdimc\floatsep \else \@tempdimc\@fpsep \fi + \@tempdima\@colht \advance\@tempdima\@tempdimc \global\@colroom-\@tempdimc + \begingroup + \let\@elt\pcol@makefcolelt + \let\reserved@b\@deferlist + \global\let\@deferlist\@empty + \reserved@b + \endgroup + \ifx\@toplist\@empty\else + \@tempswatrue + \ifpcol@lastpage \ifx\@deferlist\@empty \ifdim\@colroom<\@fpmin + \@tempswafalse \global\@toproom\maxdimen + \fi\fi\fi + \if@tempswa + \setbox\@currbox\vbox to\@colht{\vskip\@fptop \vskip-\@fpsep + \def\@elt##1{\vskip\@fpsep\box##1}\@toplist \vskip\@fpbot \vfilneg}% + \xdef\@freelist{\@freelist\@toplist}% + \global\let\@toplist\@empty + \fi + \fi} +\def\pcol@makefcolelt#1{% + \@tempdimb\ht#1{}\advance\@tempdimb\dp#1{}\advance\@tempdimb\@tempdimc + \ifdim\@tempdimb>\@tempdima \@cons\@deferlist#1\relax + \@tempdima-\maxdimen + \else \@cons\@toplist#1\relax + \advance\@tempdima-\@tempdimb \global\advance\@colroom\@tempdimb + \fi} + \def\pcol@magicpenalty{12345} \def\pcol@measurecolumn{% \pcol@getcurrcol - \@tempswatrue + \@tempswafalse + \dimen@\z@ \pcol@addflhd\@toplist\pcol@textfloatsep + \global\skip\@currbox\dimen@ + \advance\dimen@\ht\@currbox \advance\dimen@\dp\@currbox \dimen@ii\dimen@ \setbox\@tempboxa\vbox{\penalty\pcol@magicpenalty \unvcopy\@currbox \xdef\@gtempa{\number\lastpenalty}}% - \ifnum\@gtempa=\pcol@magicpenalty\relax \ifvoid\pcol@currfoot - \ifx\@toplist\@empty \ifx\@botlist\@empty - \@tempswafalse \skip\@currbox\z@ \pcol@prevdepth\z@ \pcol@setcurrcol - \fi\fi\fi\fi - \if@tempswa - \dimen@ii\ht\@currbox \advance\dimen@ii\dp\@currbox -% must fix begin - \ifnum\@gtempa=\pcol@magicpenalty\relax - \global\setbox\@currbox\vbox{\hrule\@height\z@ \kern-\topskip} - \pcol@prevdepth\z@ \pcol@setcurrcol - \fi -% must fix end - \dimen@\z@ \pcol@addflhd\@toplist\topfigrule - \skip\@currbox\dimen@ \advance\dimen@ii\dimen@ - \ifdim\dimen@ii>\@tempdima - \@tempdima\dimen@ii \@tempdimc\pcol@prevdepth \fi - \ifvoid\pcol@currfoot \dimen@\z@ + \ifnum\@gtempa=\pcol@magicpenalty\relax \global\pcol@prevdepth\maxdimen + \pcol@setcurrcol + \else \@tempswatrue + \fi + \pcol@measureupdate\@tempdima\dimen@ii\@tempdimc\pcol@prevdepth + \ifvoid\pcol@currfoot \dimen@\z@ + \else + \dimen@\ht\pcol@currfoot \advance\dimen@\dp\pcol@currfoot + \advance\dimen@\skip\pcol@currfoot + \@tempswatrue + \fi + \pcol@addflhd\@botlist\maxdimen + \ifdim\dimen@>\@tempdimb \@tempdimb\dimen@ \fi + \advance\dimen@\dimen@ii + \dimen@ii\pcol@prevdepth + \ifvoid\pcol@currfoot\else \dimen@ii\dp\pcol@currfoot \fi + \ifx\@botlist\@empty\else \dimen@ii\z@ \advance\dimen@\textfloatsep \fi + \ifx\@deferlist\@empty\else \dimen@\@colht \dimen@ii\z@ \fi + \pcol@measureupdate\pcol@colht\dimen@\@pagedp\dimen@ii + \advance\pcol@currcol\@ne} +\def\pcol@addflhd#1#2{% + \ifx#1\@empty\else + \@tempswatrue + \let\@elt\pcol@hdflelt + #1\advance\dimen@-\floatsep + \ifdim#2=\maxdimen \advance\dimen@\textfloatsep \else - \dimen@\ht\pcol@currfoot \advance\dimen@\dp\pcol@currfoot - \advance\dimen@\skip\pcol@currfoot - \fi - \pcol@addflhd\@botlist\botfigrule - \ifdim\dimen@>\@tempdimb \@tempdimb\dimen@ \fi - \advance\dimen@\dimen@ii - \ifdim\dimen@>\pcol@colht - \pcol@colht\dimen@ - \@pagedp\pcol@prevdepth - \ifvoid\pcol@currfoot\else \@pagedp\dp\pcol@currfoot \fi - \ifx\@botlist\@empty\else \@pagedp\z@ \fi + \advance\dimen@\pcol@textfloatsep + \ifdim\pcol@textfloatsep>5000\p@ \advance\dimen@-\@M\p@ \fi \fi - \fi %\if@tempswa - \advance\pcol@currcol\@ne} -\def\pcol@addflhd#1#2{\ifx#1\@empty\else - \let\@elt\pcol@hdflelt - #1\advance\dimen@-\floatsep \advance\dimen@\textfloatsep - \setbox\@tempboxa\vbox{#2}\advance\dimen@\ht\@tempboxa - \let\@elt\relax + \let\@elt\relax \fi} \def\pcol@hdflelt#1{\advance\dimen@\ht#1\advance\dimen@\dp#1% \advance\dimen@\floatsep} +\def\pcol@measureupdate#1#2#3#4{\if@tempswa + \ifdim#1<#2\relax#1#2\relax#3#4\relax + \else\ifdim#1=#2\ifdim#3>#4\relax#3#4\fi\fi\fi\fi} \def\pcol@synccolumn{% \pcol@getcurrcol \if@tempswa - \@tempdimb\@tempdima \advance\@tempdimb-\@tempdimc - \advance\@tempdimb\pcol@prevdepth \advance\@tempdimb-\skip\@currbox - \global\setbox\@currbox\vbox{\vbox to\@tempdimb{\unvbox\@currbox \vfil}}% + \@tempdimb\@tempdima + \advance\@tempdimb-\skip\@currbox + \ifdim\@tempdimc=\maxdimen + \ifdim\pcol@textfloatsep=\maxdimen \begingroup + \ifx\@toplist\@empty + \textfloatsep\z@ \floatsep\z@ \let\topfigrule\relax + \fi + \@next\pcol@float\@freelist{\global\setbox\pcol@float\vbox to\z@{ + \vskip-\floatsep \topfigrule \vskip\textfloatsep + \unvbox\@currbox \vss}}\pcol@ovf + \@cons\@toplist\pcol@float + \advance\@tempdimb\textfloatsep \advance\@tempdimb-\floatsep + \advance\@tempdimb\@M\p@ + \global\pcol@prevdepth\@m\p@ + \global\pcol@textfloatsep\@tempdimb + \endgroup \fi + \else + \global\pcol@prevdepth\@tempdimc + \ifdim\pcol@textfloatsep=\maxdimen + \global\pcol@textfloatsep\textfloatsep \fi + \global\setbox\@currbox\vbox{ + \ifdim\@tempdimb<\topskip + \vbox to\topskip{\unvbox\@currbox \vskip\z@\@plus.0001fil} + \vskip-\topskip \vskip\@tempdimb + \else + \vbox to\@tempdimb{\unvbox\@currbox \vskip\z@\@plus.0001fil} + \fi}% + \fi \else - \global\setbox\@currbox\vbox{\unvbox\@currbox \vfill \penalty-\@M}% + \global\pcol@prevdepth\@m\p@ + \global\setbox\@currbox\vbox{\unvbox\@currbox \vfil \penalty-\@M}% \fi \global\@topnum\z@ \pcol@setcurrcol \advance\pcol@currcol\@ne} - - -\def\pcol@output@end{% - \pcol@makelastpage\pcol@colht - \@tempswafalse - \if@fcolmade - \setbox\@outputbox\vbox to\textheight{\unvbox\@outputbox \vfil}% - \@outputpage %\c@page=OK - \pcol@flushfloats - \global\pcol@prevdepth\z@ - \@tempswatrue - \else\ifdim\pcol@colht<\z@ - \unvbox\@outputbox - \global\pcol@prevdepth\z@ - \else - \topskip\z@ \box\@outputbox - \global\pcol@prevdepth\@pagedp %\c@page=OK - \fi\fi - \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% - \pcol@getcurrcol \@cons\@freelist\@currbox - \advance\pcol@currcol\@ne}% - \global\@colht\textheight - \global\@colroom\textheight - \global\let\@deferlist\@dbldeferlist \gdef\@dbldeferlist{}% - \pcol@floatplacement - \if@tempswa \@startcolumn \fi} +%% Special Output Routines: Page Flushing \def\pcol@output@flush{% - \pcol@makelastpage\@colht + \pcol@makeflushedpage\@colht \setbox\@outputbox\vbox to\textheight{\unvbox\@outputbox}% - \@outputpage %\c@page=OK - \global\@colht\textheight + \@outputpage \pcol@freshpage} \def\pcol@output@clear{% - \pcol@makelastpage\@colht + \pcol@makeflushedpage\@colht \setbox\@outputbox\vbox to\textheight{\unvbox\@outputbox}% - \@outputpage %\c@page=OK - \global\advance\pcol@page\@ne - \pcol@flushfloats %\c@page=OK - \global\@colht\textheight + \@outputpage + \pcol@flushfloats \begingroup \@dblfloatplacement \@makefcolumn\@dbldeferlist \@whilesw\if@fcolmade\fi{\@outputpage \@makefcolumn\@dbldeferlist}% - \endgroup %\c@page=OK + \endgroup \pcol@freshpage} -\def\pcol@makelastpage#1{% +\def\pcol@makeflushedpage#1{% \pcol@cleartrue \pcol@output@switch \pcol@clearfalse \pcol@getcurrpinfo\@currbox{\global\c@page}{\global\@colht}\@tempskipa \global\@fcolmadefalse \setbox\@outputbox\vbox{% - \ifpcol@textonly\else - \@cons\@freelist\@currbox + \ifpcol@nospan\else \unvbox\@currbox + \@cons\@freelist\@currbox \fi - \ifdim#1<\z@ + \ifdim#1=-\maxdimen \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% - \pcol@getcurrcol + \pcol@getcurrcol \ifx\@deferlist\@empty\else \global\@fcolmadetrue \fi \advance\pcol@currcol\@ne}% \else \hb@xt@\textwidth{% - \let\pcol@hfil\relax \@colht#1\relax + \let\pcol@hfil\relax \@pageht\@colht \ifdim#1<\@colht \@colht#1\fi \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% \pcol@getcurrcol \ifx\@deferlist\@empty\else \global\@fcolmadetrue \fi - \ifvoid\pcol@currfoot\else \@cons\@freelist\pcol@currfoot \fi \setbox\@cclv\box\@currbox + \ifvoid\pcol@currfoot\else \@cons\@freelist\pcol@currfoot \fi \pcol@getcurrfoot - \@makecol + \@tempswafalse + \ifdim\@toproom=\maxdimen + \global\@toproom\topfraction\@pageht \let\topfigrule\relax + \ifdim\@colht=\@pageht \@tempswatrue \fi + \fi + \if@tempswa + \setbox\@outputbox\vbox to\@colht{\vskip\@fptop \vskip-\@fpsep + \def\@elt##1{\vskip\@fpsep\box##1}\@toplist \vskip\@fpbot}% + \xdef\@freelist{\@freelist\@toplist}\global\@toplist\@empty + \else \@makecol + \fi \pcol@hfil \hb@xt@\columnwidth{\box\@outputbox\hss}% \let\pcol@hfil\hfil \pcol@setcurrcolnf - \advance\pcol@currcol\@ne}} + \advance\pcol@currcol\@ne}}% \fi}} \def\pcol@flushfloats{% + \global\@colht\textheight \@whilesw\if@fcolmade\fi{% \setbox\@outputbox\vbox{\hb@xt@\textwidth{% \let\pcol@hfil\relax @@ -619,54 +716,123 @@ \@outputpage}} \def\pcol@freshpage{% - \global\pcol@page\z@ \global\pcol@maxpage\z@ \global\pcol@basepage\z@ - \gdef\pcol@pages{}\gdef\pcol@currpage{}% + \global\pcol@page\z@ \global\pcol@toppage\z@ \global\pcol@basepage\z@ + \global\let\pcol@pages\@empty \global\let\pcol@currpage\@empty \pcol@startpage \pcol@colht\@colht \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% \pcol@getcurrcol \pcol@page\z@ \@colroom\pcol@colht + \let\pcol@currboxsave\@currbox \pcol@getcurrpage \pcol@floatplacement \pcol@startcolumn \@whilesw\if@fcolmade\fi{\pcol@opcol \pcol@startcolumn}% + \let\@currbox\pcol@currboxsave \global\setbox\@currbox\vbox{}% \global\count\@currbox\pcol@page \global\dimen\@currbox\@colroom \pcol@setcurrcolnf \advance\pcol@currcol\@ne}% - \global\pcol@currcol\pcol@nextcol \pcol@restartcolumn} - +%% Special Output Routines: Last Page + +\def\pcol@output@end{% + \pcol@lastpagetrue \pcol@makeflushedpage\pcol@colht + \@tempswafalse + \if@fcolmade + \ifdim\pcol@colht>-\maxdimen \@tempswatrue \fi + \ifpcol@nospan\else \@tempswatrue \fi + \if@tempswa + \setbox\@outputbox\vbox to\textheight{\unvbox\@outputbox \vfil}% + \@outputpage + \fi + \pcol@flushfloats + \@tempswatrue \@pagedp\@m\p@ + \else\ifdim\pcol@colht=-\maxdimen + \ifx\pcol@firstprevdepth\relax + \@tempswatrue \@pagedp\@m\p@ + \ifpcol@nospan\else + \@next\@currbox\@freelist{\global\setbox\@currbox\vbox{ + \unvbox\@outputbox \unskip}}\pcol@ovf + \count\@currbox10\relax + {\let\@elt\relax \xdef\@dbldeferlist{\@elt\@currbox\@dbldeferlist}}% + \fi + \else \unvbox\@outputbox \@pagedp\pcol@firstprevdepth sp\relax + \fi + \else + \topskip\z@ \box\@outputbox + \fi\fi + \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% + \pcol@getcurrcol \@cons\@freelist\@currbox + \advance\pcol@currcol\@ne}% + \global\pcol@prevdepth\@pagedp + \global\@colht\textheight + \global\@colroom\textheight + \global\let\@deferlist\@dbldeferlist \gdef\@dbldeferlist{}% + \pcol@floatplacement + \if@tempswa + \pcol@lastpagefalse + \@startcolumn \@whilesw\if@fcolmade\fi{\@opcol\@startcolumn}% + \fi} + +%% Starting Environment \def\pcol@invokeoutput#1{% - \penalty-\@Miv \@tempdima\prevdepth \vbox{}% - \global\pcol@prevdepth\@tempdima \penalty#1\relax - \prevdepth\pcol@prevdepth} + \penalty-\@Miv \global\pcol@prevdepth\prevdepth \vbox{}% + \penalty#1\relax \prevdepth\pcol@prevdepth} \def\paracol#1{\par \global\pcol@ncol#1\relax + \global\let\pcol@counters\cl@@ckpt + \let\@elt\pcol@remctrelt \pcol@gcounters + \let\@elt\pcol@thectrelt \pcol@counters + \begingroup + \let\@elt\pcol@loadctrelt \csname pcol@counters0\endcsname + \let\@elt\pcol@cmpctrelt \global\let\@gtempa\@empty \pcol@counters + \pcol@synccounter\@gtempa + \endgroup \global\columnwidth\textwidth \@tempdima\columnsep \multiply\@tempdima\pcol@ncol \advance\@tempdima-\columnsep \global\advance\columnwidth-\@tempdima \global\divide\columnwidth\pcol@ncol \global\hsize\columnwidth \global\linewidth\columnwidth - \global\@twocolumntrue \global\@firstcolumntrue \col@number\pcol@ncol - \global\let\pcol@counters\cl@@ckpt - \let\@elt\pcol@remctrelt \pcol@gcounters - \let\@elt\pcol@thectrelt \pcol@counters - \let\@elt\relax - \let\clearpage\pcol@clearpage \pcol@topskip\topskip - \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% - \expandafter\gdef\csname pcol@shipped\number\pcol@currcol\endcsname{}% - \pcol@savecounters \advance\pcol@currcol\@ne}% + \global\@twocolumntrue \global\@firstcolumntrue \col@number\@ne + \global\pcol@topskip\topskip + \global\pcol@textfloatsep\maxdimen + \pcol@lastpagefalse \xdef\pcol@firstprevdepth{\number\prevdepth}% + \let\@combinefloats\pcol@combinefloats + \let\@elt\pcol@defcomelt \pcol@localcommands + \def\column{\pcol@com@column}% + \@namedef{column*}{\@nameuse{pcol@com@column*}}% + \global\let\pcol@com@column\pcol@defcolumn + \global\@namedef{pcol@com@column*}{\pcol@defcolumn + \@ifnextchar[%] + \pcol@mctext\relax}% + \def\paracol##1{\PackageError{paracol}{% + Environment paracol cannot be nested.}\@eha}% \output{\pcol@output}% + \let\@elt\relax \pcol@invokeoutput\pcol@op@start \pcol@nextcol\z@ - \def\column{\pcol@defcolumn\nthcolumn{0}} - \@namedef{column*}{\pcol@defcolumn\@nameuse{nthcolumn*}{0}} \@ifnextchar[%] \pcol@mctext\relax} -\def\pcol@gcounters{\@elt{page}} +\def\pcol@localcommands{% + \@elt{switchcolumn}% + \@elt{endcolumn}\@elt{endcolumn*}% + \@elt{nthcolumn}\@elt{endnthcolumn}\@elt{nthcolumn*}\@elt{endnthcolumn*}% + \@elt{leftcolumn}\@elt{endleftcolumn}\@elt{leftcolumn*}\@elt{endleftcolumn*}% + \@elt{rightcolumn}\@elt{endrightcolumn}% + \@elt{rightcolumn*}\@elt{endrightcolumn*}% + \@elt{flushpage}\@elt{clearpage}% + \@elt{synccounter}\@elt{syncallcounters}} +\def\pcol@defcomelt#1{% + \expandafter\let\expandafter\reserved@a\csname pcol@com@#1\endcsname + \expandafter\let\csname #1\endcsname\reserved@a} + +%% Counter Opearations + +\def\globalcounter#1{\@cons\pcol@gcounters{{#1}}} +\gdef\pcol@gcounters{\@elt{page}} \def\pcol@remctrelt#1{% \expandafter\let\expandafter\reserved@a\csname cl@#1\endcsname \expandafter\let\csname pcol@cl@#1\endcsname\reserved@a @@ -679,6 +845,8 @@ \def\pcol@iremctrelt#1{% \def\reserved@b{#1}% \ifx\reserved@a\reserved@b\else \@cons\pcol@counters{{#1}}\fi} + +\def\definethecounter#1#2#3{\@namedef{pcol@thectr@#1#2}{#3}} \def\pcol@thectrelt#1{% \expandafter\let\expandafter\reserved@a\csname the#1\endcsname \expandafter\let\csname pcol@thectr@#1\endcsname\reserved@a @@ -687,37 +855,42 @@ \expandafter\let\csname the#1\endcsname\reserved@a \fi} -\def\pcol@mctext[#1]{% - \@tempcnta\pcol@nextcol\relax - \global\pcol@synctrue \pcol@nextcol\z@ - \pcol@switchcol - \begingroup - \hsize\textwidth \col@number\@ne #1\par - \expandafter\global\expandafter\everypar\expandafter{\the\everypar}% - \endgroup - \pcol@nextcol\@tempcnta \global\pcol@synctrue \pcol@switchcol} - -\def\pcol@switchcol{% - \pcol@savecounters - \pcol@invokeoutput\pcol@op@switch - \ifnum\pcol@currcol=\z@ \global\@firstcolumntrue - \else \global\@firstcolumnfalse - \fi - \let\@elt\pcol@setctrelt - \csname pcol@counters\number\pcol@currcol\endcsname - \let\@elt\relax} - -\def\pcol@savecounters{\begingroup +\def\pcol@loadctrelt#1#2{\@namedef{pcol@ctr@#1}{#2}} +\def\pcol@storecounters{\pcol@sscounters\pcol@storectrelt} +\def\pcol@storectrelt#1{\@cons\@gtempa{{#1}{\@nameuse{pcol@ctr@#1}}}} +\def\pcol@savecounters{\pcol@sscounters\pcol@savectrelt} +\def\pcol@savectrelt#1{\@cons\@gtempa{{#1}{\number\csname c@#1\endcsname}}} +\def\pcol@sscounters#1{\begingroup \global\let\@gtempa\@empty - \let\@elt\pcol@savectrelt \pcol@counters + \let\@elt#1\relax \pcol@counters \let\@elt\relax \expandafter\xdef\csname pcol@counters\number\pcol@currcol\endcsname{% \@gtempa}% \endgroup} -\def\pcol@savectrelt#1{\@cons\@gtempa{{#1}{\number\csname c@#1\endcsname}}} + +\def\pcol@cmpctrelt#1{\@tempswafalse \@tempcnta\@nameuse{c@#1}% + \expandafter\ifx\csname pcol@ctr@#1\endcsname\relax \@tempswatrue + \else\ifnum\@nameuse{pcol@ctr@#1}=\@tempcnta\else \@tempswatrue + \fi\fi + \if@tempswa \@cons\@gtempa{{#1}}\fi} + +\def\pcol@com@synccounter#1{\pcol@synccounter{\@elt{#1}}} +\def\pcol@synccounter#1{{% + \let\@elt\relax \edef\reserved@a{#1}% + \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% + \let\@elt\pcol@loadctrelt \@nameuse{pcol@counters\number\pcol@currcol}% + \let\@elt\pcol@syncctrelt\reserved@a + \pcol@storecounters + \advance\pcol@currcol\@ne}}} +\def\pcol@syncctrelt#1{% + \expandafter\edef\csname pcol@ctr@#1\endcsname{\number\@nameuse{c@#1}}} + +\def\pcol@com@syncallcounters{{% + \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% + \pcol@savecounters \advance\pcol@currcol\@ne}}} \def\pcol@setctrelt#1#2{% - \setcounter{#1}{#2}% + \global\csname c@#1\endcsname#2\relax \expandafter\ifx\csname pcol@thectr@#1\number\pcol@currcol\endcsname\relax \expandafter\let\expandafter\reserved@a\csname pcol@thectr@#1\endcsname \else @@ -727,36 +900,32 @@ \expandafter\let\csname the#1\endcsname\reserved@a} \def\pcol@stepcounter#1{\begingroup - \let\@elt\@stpelt \csname pcol@cl@#1\endcsname \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{% - \let\@elt\pcol@stpldelt \csname pcol@counters\number\pcol@currcol\endcsname - \let\@elt\pcol@stpclelt \csname pcol@cl@#1\endcsname + \let\@elt\pcol@stpldelt \@nameuse{pcol@counters\number\pcol@currcol}% + \let\@elt\pcol@stpclelt \@nameuse{pcol@cl@#1}% \pcol@savecounters \advance\pcol@currcol\@ne}% - \endgroup} + \endgroup + \let\@elt\@stpelt \@nameuse{pcol@cl@#1}} \def\pcol@stpldelt#1#2{\csname c@#1\endcsname#2\relax} \def\pcol@stpclelt#1{\csname c@#1\endcsname\z@} -\def\definethecounter#1#2#3{\@namedef{pcol@thectr@#1#2}{#3}} -\def\globalcounter#1{\@cons\pcol@gcounters{{#1}}} +%% Column-Switching Commands and Environments -\def\endparacol{\par - \pcol@nextcol\z@ \pcol@switchcol - \pcol@invokeoutput\pcol@op@end - \global\columnwidth\textwidth - \global\hsize\columnwidth - \global\linewidth\columnwidth - \global\@twocolumnfalse - \global\topskip\pcol@topskip} +\def\pcol@par{\ifvmode\else \par \fi} -\def\switchcolumn{\par +\def\pcol@com@switchcolumn{\pcol@par + \pcol@defcolumn \@tempcnta\pcol@currcol \advance\@tempcnta\@ne \ifnum\@tempcnta<\pcol@ncol\else \@tempcnta\z@ \fi \@ifnextchar[%] \pcol@switchcolumn{\pcol@switchcolumn[\@tempcnta]}} \def\pcol@switchcolumn[#1]{% \pcol@nextcol#1\relax - \ifnum#1<\pcol@ncol\else + \@tempswafalse + \ifnum#1<\z@ \@tempswatrue \fi + \ifnum#1<\pcol@ncol\else \@tempswatrue \fi + \if@tempswa \PackageError{paracol}{% Column number \number#1 must be less than\number\pcol@ncol}\@eha \pcol@nextcol\z@ @@ -767,29 +936,108 @@ \@ifnextchar[%] \pcol@mctext\pcol@switchcol} +\long\def\pcol@mctext[#1]{% + \@tempcnta\pcol@nextcol + \global\pcol@synctrue \pcol@nextcol\z@ + \pcol@switchcol + \begingroup + \hsize\textwidth \col@number\@ne #1\pcol@par + \global\pcol@mctexttrue + \expandafter\global\expandafter\everypar\expandafter{\the\everypar}% + \endgroup + \pcol@nextcol\@tempcnta \global\pcol@synctrue \pcol@switchcol} + +\def\pcol@switchcol{% + \pcol@savecounters + \pcol@invokeoutput\pcol@op@switch + \ifnum\pcol@currcol=\z@ \global\@firstcolumntrue + \else \global\@firstcolumnfalse + \fi + \let\@elt\pcol@setctrelt + \csname pcol@counters\number\pcol@currcol\endcsname + \let\@elt\pcol@aconlyelt \pcol@aconly + \let\@elt\relax} + \def\pcol@defcolumn{% - \gdef\column{\switchcolumn\relax}% - \global\@namedef{column*}{\switchcolumn*}} -\def\nthcolumn#1{\switchcolumn[#1]\relax} -\@namedef{nthcolumn*}#1{\switchcolumn[#1]*} -\def\leftcolumn{\switchcolumn[0]\relax} -\@namedef{leftcolumn*}{\switchcolumn[0]*} -\def\rightcolumn{\switchcolumn[1]\relax} -\@namedef{rightcolumn*}{\switchcolumn[1]*} - -\let\endcolumn\par -\expandafter\let\csname endcolumn*\endcsname\par -\let\endnthcolumn\par -\expandafter\let\csname endnthcolumn*\endcsname\par -\let\endleftcolumn\par -\expandafter\let\csname endleftcolumn*\endcsname\par -\let\endrightcolumn\par -\expandafter\let\csname endrightcolumn*\endcsname\par - -\def\flushpage{\par + \gdef\pcol@com@column{\pcol@switchenv{column}\relax}% + \global\@namedef{pcol@com@column*}{\pcol@switchenv{column*}*}} + +\def\pcol@com@nthcolumn#1{\pcol@switchenv{nthcolumn}[#1]\relax} +\@namedef{pcol@com@nthcolumn*}#1{\pcol@switchenv{nthcolumn*}[#1]*} +\def\pcol@com@leftcolumn{\pcol@switchenv{leftcolumn}[0]\relax} +\@namedef{pcol@com@leftcolumn*}{\pcol@switchenv{leftcolumn*}[0]*} +\def\pcol@com@rightcolumn{\pcol@switchenv{rightcolumn}[1]\relax} +\@namedef{pcol@com@rightcolumn*}{\pcol@switchenv{rightcolumn*}[1]*} + +\def\pcol@switchenv#1{\let\reserved@a\switchcolumn + \def\switchcolumn{\PackageError{paracol}{% + Column swicthing commands and environments cannot be used in #1}\@eha} + \reserved@a} + +\def\pcol@com@endcolumn{\pcol@par + \expandafter\global\expandafter\everypar\expandafter{\the\everypar}} +\expandafter\let\csname pcol@com@endcolumn*\endcsname\pcol@com@endcolumn +\let\pcol@com@endnthcolumn\pcol@com@endcolumn +\expandafter\let\csname pcol@com@endnthcolumn*\endcsname\pcol@com@endcolumn +\let\pcol@com@endleftcolumn\pcol@com@endcolumn +\expandafter\let\csname pcol@com@endleftcolumn*\endcsname\pcol@com@endcolumn +\let\pcol@com@endrightcolumn\pcol@com@endcolumn +\expandafter\let\csname pcol@com@endrightcolumn*\endcsname\pcol@com@endcolumn + +%% Disabling \addcontentsline + +\def\addcontentsonly#1#2{% + \@ifundefined{pcol@ac@def@#1} + {\PackageError{paracol}{Unknown contents type #1}\@eha}\relax + \@cons\pcol@aconly{{#1}{#2}}} +\gdef\pcol@aconly{} + +\def\pcol@aconlyelt#1#2{% + \ifnum#2=\pcol@currcol \@nameuse{pcol@ac@def@#1}{enable}% + \else \@nameuse{pcol@ac@def@#1}{disable}% + \fi} +\def\pcol@gobblethree#1#2#3{} +\let\pcol@addcontentsline\addcontentsline + +\def\pcol@ac@def@toc#1{% + \expandafter\let\expandafter\@sect\csname pcol@ac@#1@toc\endcsname} +\let\pcol@ac@enable@toc\@sect +\def\pcol@ac@disable@toc#1#2#3#4#5#6[#7]#8{% + \let\addcontentsline\pcol@gobblethree + \pcol@ac@enable@toc{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]{#8}% + \let\addcontentsline\pcol@addcontentsline} + +\def\pcol@ac@def@lof#1{\@nameuse{pcol@ac@caption@#1}{lof}} +\def\pcol@ac@def@lot#1{\@nameuse{pcol@ac@caption@#1}{lot}} +\def\pcol@ac@caption@enable{\pcol@ac@caption@def\@tempswatrue} +\def\pcol@ac@caption@disable{\pcol@ac@caption@def\@tempswafalse} +\def\pcol@ac@caption@def#1#2{\let\@caption\pcol@ac@caption + \expandafter\let\csname pcol@ac@caption@if@#2\endcsname#1} +\let\pcol@ac@caption@if@lof\@tempswatrue +\let\pcol@ac@caption@if@lot\@tempswatrue +\long\def\pcol@ac@caption#1[#2]#3{% + \@nameuse{pcol@ac@caption@if@\@nameuse{ext@#1}}% + \if@tempswa\else \let\addcontentsline\pcol@gobblethree \fi + \pcol@ac@caption@latex{#1}[{#2}]{#3}% + \let\addcontentsline\pcol@addcontentsline} +\let\pcol@ac@caption@latex\@caption + +%% Page Flushing Commands + +\def\pcol@com@flushpage{\pcol@par \pcol@nextcol\pcol@currcol \pcol@invokeoutput\pcol@op@flush} -\def\pcol@clearpage{\par +\def\pcol@com@clearpage{\pcol@par \pcol@nextcol\pcol@currcol \pcol@invokeoutput\pcol@op@clear} +%% Closing Environment + +\def\endparacol{\pcol@par + \pcol@nextcol\z@ \pcol@switchcol + \pcol@invokeoutput\pcol@op@end + \global\columnwidth\textwidth + \global\hsize\columnwidth + \global\linewidth\columnwidth + \global\@twocolumnfalse + \global\topskip\pcol@topskip} |