summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/paracol
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-11-08 23:43:59 +0000
committerKarl Berry <karl@freefriends.org>2013-11-08 23:43:59 +0000
commit92f13c38adca9511a17969f8efde0f4d0e6e5f3a (patch)
treeb6a58333142feae9cdcaae185fd2ef7cfb439578 /Master/texmf-dist/tex/latex/paracol
parent77d66d8f7bc360ae2b37c1ea1c2cb53f7a201e57 (diff)
paracol (8nov13)
git-svn-id: svn://tug.org/texlive/trunk@32099 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/paracol')
-rw-r--r--Master/texmf-dist/tex/latex/paracol/paracol.sty1842
1 files changed, 1468 insertions, 374 deletions
diff --git a/Master/texmf-dist/tex/latex/paracol/paracol.sty b/Master/texmf-dist/tex/latex/paracol/paracol.sty
index ebead1e932b..3abdb891ee8 100644
--- a/Master/texmf-dist/tex/latex/paracol/paracol.sty
+++ b/Master/texmf-dist/tex/latex/paracol/paracol.sty
@@ -9,22 +9,25 @@
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{paracol}
-[2013/06/30 v1.22 ]
+[2013/10/10 v1.31 ]
%% Register Declaration
\newcount\pcol@currcol \global\pcol@currcol\z@
\newcount\pcol@nextcol
-\newcount\pcol@ncol
+\newcount\pcol@ncol \global\pcol@ncol\z@
+\newcount\pcol@ncolleft \global\pcol@ncolleft\z@
\newcount\pcol@page
\newcount\pcol@basepage
\newcount\pcol@toppage
\newcount\pcol@footnotebase
\newcount\pcol@nfootnotes
+\newcount\pcol@mcid
\newif\ifpcol@output \global\pcol@outputfalse
\newif\ifpcol@nospan
\newif\ifpcol@sync \pcol@syncfalse
-\newif\ifpcol@mctext \pcol@mctextfalse
+\newif\ifpcol@sptextstart \pcol@sptextstartfalse
+\newif\ifpcol@sptext \pcol@sptextfalse
\newif\ifpcol@clear \pcol@clearfalse
\newif\ifpcol@flush
\newif\ifpcol@outputflt
@@ -33,20 +36,35 @@
\newif\ifpcol@scfnote \pcol@scfnotefalse
\newif\ifpcol@mgfnote \pcol@mgfnotefalse
\newif\ifpcol@fncounteradjustment \pcol@fncounteradjustmentfalse
-\newif\ifpcol@swapcolumn \global\pcol@swapcolumnfalse
\newif\ifpcol@inner
+\newif\ifpcol@firstpage
+\newif\ifpcol@havelastpage \global\pcol@havelastpagefalse
+\newif\ifpcol@paired \global\pcol@pairedtrue
+\newif\ifpcol@swapcolumn \global\pcol@swapcolumnfalse
+\newif\ifpcol@swapmarginpar \global\pcol@swapmarginparfalse
+\newif\ifpcol@bg@swap \global\pcol@bg@swapfalse
+\newif\ifpcol@bg@@swap
+\newif\ifpcol@bg@painted
+\newif\ifpcol@bfbottom
+\def\reserved@a{pLaTeX2e}
+\ifx\reserved@a\pfmtname \pcol@bfbottomfalse \else \pcol@bfbottomtrue \fi
+\newif\ifpcol@dfloats
\newdimen\pcol@prevdepth
\newdimen\pcol@colht
\newdimen\pcol@textfloatsep
\newdimen\pcol@lrmargin
+\newdimen\pagerim \pagerim\z@
\newskip\pcol@topskip
\newbox\pcol@topfnotes
+\newbox\pcol@prespan \setbox\pcol@prespan\box\voidb@x
+\newbox\pcol@rightpage \global\setbox\pcol@rightpage\box\voidb@x
+\newbox\pcol@tempbox
\newtoks\pcol@everyvbox
%% Logging Tools
\def\pcol@ShowBox#1{\message{(\the\ht#1+\the\dp#1)x(\the\wd#1)}%
- {\showboxdepth\@M \showboxbreadth\@M \setbox\z@\vbox to\z@{\unvcopy#1}}}
+ {\showboxdepth\@M \showboxbreadth\@M \setbox\z@\vbox to\z@{\copy#1}}}
\def\pcol@LogLevel#1#2#3{%
\pcol@iLogLevel{#1}{pcol@Log}%
\pcol@iLogLevel{#2}{pcol@Logstart}%
@@ -76,6 +94,7 @@
\PackageError{paracol}{Too many unprocessed columns/floats}\@ehb}
\def\pcol@output{\let\par\@@par \let\set@color\pcol@set@color
+ \global\pcol@mcid\z@
\pcol@Logstart{\pcol@output\number\outputpenalty
(\number\c@page:\number\pcol@currcol)}%
\ifnum\outputpenalty<-\@M
@@ -96,9 +115,13 @@
\ifnum\outputpenalty>-\@Miv
\ifdim\@colroom<1.5\baselineskip
\ifdim\@colroom<\textheight
- \@latex@warning@no@line{Text page \thepage\space
- contains only floats}%
- \@emptycol
+ \ifpcol@sptextstart
+ \global\vsize\@colroom
+ \else
+ \@latex@warning@no@line{Text page \thepage\space
+ contains only floats}%
+ \@emptycol
+ \fi
\else
\global\vsize\@colroom
\fi
@@ -112,14 +135,28 @@
%% Completing Column-Page
-\def\pcol@@makecol{\@makecol
- \setbox\@outputbox\vbox to\@colht{\boxmaxdepth\@maxdepth \unvbox\@outputbox}}
+\def\pcol@@makecol#1{\@makecol
+ \setbox\@outputbox\vbox to\@colht{\boxmaxdepth#1\unvbox\@outputbox}}
\def\pcol@makecol{\let\pcol@textbottom\@textbottom
\ifdim\pcol@textfloatsep=\maxdimen\else
\def\@textbottom{\vskip\z@\@plus.0001fil\@minus.0001fil}\fi
\def\pcol@currfoot{\voidb@x}%
+ \ifpcol@sptext \ifnum\pcol@currcol=\z@
+ \pcol@getcurrpinfo\@tempcnta\@tempdima\@tempskipa
+ \setbox\@tempboxa\vbox{\unvcopy\@cclv}%
+ \@tempdimb\ht\@tempboxa \advance\@tempdimb\dp\@tempboxa
+ \ifdim\@tempdimb>\z@
+ \@tempdimb\ht\@cclv \advance\@tempdimb\dp\@cclv
+ \dimen@\ht\pcol@prespan \pcol@addflhd\@toplist\pcol@textfloatsep
+ \@cons\pcol@sptextlist{{\number\dimen@}{\number\@tempdimb}}%
+ \fi
+ \pcol@defcurrpage{\number\@tempcnta}\pcol@spanning\pcol@footins
+ {\pcol@sptextlist}{\pcol@mparbottom}%
+ \setbox\@cclv\vbox{\unvbox\pcol@prespan \pcol@shiftspanning\@cclv
+ \unvbox\@cclv}%
+ \fi\fi
\ifpcol@scfnote \ifvoid\footins\else
- \pcol@shrinkcolbyfn\footins
+ \pcol@shrinkcolbyfn\@colht\footins\relax
\setbox\@cclv\vbox{\pcol@unvbox@cclv\footins}%
\ifnum\pcol@page=\pcol@toppage
\pcol@Log\pcol@makecol{save}\footins
@@ -139,7 +176,15 @@
\ifx\@toplist\@empty\else
\ifdim\pcol@textfloatsep=\maxdimen \@cflt \else \pcol@cflt \fi
\fi
- \ifx\@botlist\@empty\else \@cflb
+ \ifx\@botlist\@empty\else
+ \ifdim\pcol@textfloatsep=\maxdimen \@cflb
+ \else
+ \setbox\@outputbox\vbox{\unvbox\@outputbox
+ \vskip\z@\@plus.0001fil\@minus.0001fil}%
+ \@cflb
+ \setbox\@outputbox\vbox{\unvbox\@outputbox
+ \vskip\z@\@plus-.0001fil\@minus-.0001fil}%
+ \fi
\ifpcol@lastpage
\setbox\@outputbox\vbox{\box\@outputbox \vskip\textfloatsep}%
\fi
@@ -171,7 +216,7 @@
\ifnum\pcol@currcol=\z@ \pcol@setpageno \fi
\pcol@nextpage
\pcol@checkshipped
- \if@tempswa \pcol@outputpage\z@ \fi
+ \if@tempswa \pcol@outputcolumns\z@ \fi
\ifnum\pcol@page>\pcol@toppage \pcol@startpage
\else \pcol@getcurrpage
\fi
@@ -183,15 +228,16 @@
\global\let\pcol@pages\@empty \global\let\pcol@currpage\@empty
\let\@elt\pcol@setpnoelt \reserved@a
\endgroup}
-\def\pcol@setpnoelt#1#2#3{%
+\def\pcol@setpnoelt#1#2#3#4#5{%
{\let\@elt\relax \xdef\pcol@pages{\pcol@pages\pcol@currpage}}%
- \ifnum\@tempcnta>\z@ \gdef\pcol@currpage{\@elt{#1}#2#3}%
- \else \pcol@defcurrpage{\number\c@page}{#2}{#3}%
+ \ifnum\@tempcnta>\z@ \gdef\pcol@currpage{\@elt{#1}#2#3{#4}{#5}}%
+ \else \pcol@defcurrpage{\number\c@page}{#2}{#3}{#4}{#5}%
\advance\c@page\@ne
+ \ifpcol@paired\else \advance\c@page\@ne \fi
\fi
\advance\@tempcnta\m@ne}
-\def\pcol@defcurrpage#1#2#3{{%
- \let\@elt\relax \xdef\pcol@currpage{\@elt{#1}#2#3}}}
+\def\pcol@defcurrpage#1#2#3#4#5{{%
+ \let\@elt\relax \xdef\pcol@currpage{\@elt{#1}#2#3{#4}{#5}}}}
\def\pcol@nextpage{\begingroup
\@tempcnta\pcol@page \advance\@tempcnta-\pcol@basepage
@@ -199,10 +245,10 @@
\let\@elt\pcol@nextpelt \pcol@pages
\global\advance\pcol@page\@ne
\endgroup}
-\def\pcol@nextpelt#1#2#3{%
+\def\pcol@nextpelt#1#2#3#4#5{%
\ifnum\@tempcnta<\z@
\ifvoid#2\@tempswafalse
- \else\ifdim\dimen#1<\z@
+ \else\ifdim\dimen#2<\z@
\if@tempswa \global\advance\pcol@page\@ne \fi
\else \@tempswafalse
\fi\fi
@@ -219,20 +265,27 @@
\@tempcnta\pcol@page \advance\@tempcnta-\pcol@basepage
\let\@elt\pcol@getpelt \pcol@pages\pcol@currpage
\endgroup}
-\def\pcol@getpelt#1#2#3{%
+\def\pcol@getpelt#1#2#3#4#5{%
\ifnum\@tempcnta=\z@
- \pcol@getpinfo{#1}#2#3{\global\c@page}{\global\@colht}{\global\topskip}\fi
+ \pcol@getpinfo{#1}#2#3{#4}{#5}%
+ {\global\c@page}{\global\@colht}{\global\topskip}%
+ \fi
\advance\@tempcnta\m@ne}
-\def\pcol@getpinfo#1#2#3#4#5#6{\pcol@nospantrue
- \gdef\pcol@spanning{#2}\gdef\pcol@footins{#3}%
- #4#1\relax
- \ifvoid#2\relax #5\textheight #6\pcol@topskip
- \else #5\dimen#2\relax #6\skip#2\relax \pcol@nospanfalse
+\def\pcol@getpinfo#1#2#3#4#5#6#7#8{\pcol@nospantrue
+ \gdef\pcol@spanning{#2}\gdef\pcol@footins{#3}\gdef\pcol@sptextlist{#4}%
+ \gdef\pcol@mparbottom{#5}%
+ #6#1\relax
+ \ifvoid#2\relax #7\textheight #8\pcol@topskip
+ \else #7\dimen#2\relax #8\skip#2\relax \pcol@nospanfalse
\fi}
\def\pcol@getcurrpinfo{%
\edef\reserved@a{\expandafter\@cdr\pcol@currpage\@nil}%
\expandafter\pcol@getpinfo\reserved@a}
+\def\pcol@floatplacement{%
+ \global\@textfloatsheight\z@ \global\pcol@textfloatsep\maxdimen
+ \@floatplacement}
+
%% Starting New Page
\def\pcol@startpage{%
@@ -240,8 +293,10 @@
\global\pcol@toppage\pcol@page
\ifx\pcol@currpage\@empty\else
\pcol@getcurrpinfo{\global\c@page}\@tempdima\@tempskipa
- \@cons\pcol@pages{{\number\c@page}\pcol@spanning\pcol@currfoot}%
- \stepcounter{page}%
+ \@cons\pcol@pages
+ {{\number\c@page}\pcol@spanning\pcol@currfoot
+ {\pcol@sptextlist}{\pcol@mparbottom}}%
+ \stepcounter{page}\ifpcol@paired\else \stepcounter{page}\fi
\fi
\global\@colht\textheight
\global\topskip\pcol@topskip
@@ -252,8 +307,8 @@
\global\setbox\@currbox\box\@outputbox}\pcol@ovf
\global\dimen\@currbox-\maxdimen
\global\skip\@currbox\pcol@topskip
- \@cons\pcol@pages{{\number\c@page}\@currbox\voidb@x}
- \stepcounter{page}%
+ \@cons\pcol@pages{{\number\c@page}\@currbox\voidb@x{}{}}%
+ \stepcounter{page}\ifpcol@paired\else \stepcounter{page}\fi
\global\advance\pcol@page\@ne \global\pcol@toppage\pcol@page
\@tryfcolumn\@dbldeferlist}%
\begingroup
@@ -263,7 +318,7 @@
\reserved@b
\endgroup
\ifx\@dbltoplist\@empty
- \pcol@defcurrpage{\number\c@page}\voidb@x\voidb@x
+ \pcol@defcurrpage{\number\c@page}\voidb@x\voidb@x{}{}%
\else
\setbox\@tempboxa\vbox{}%
\begingroup
@@ -272,76 +327,246 @@
\let\@elt\relax
\xdef\@freelist{\@freelist\@dbltoplist}%
\global\let\@dbltoplist\@empty
- \@next\@currbox\@freelist{%
- \global\setbox\@currbox\vbox{%
- \unvbox\@tempboxa \vskip-\dblfloatsep \dblfigrule
- \vskip\dbltextfloatsep}}%
- \pcol@ovf
+ \@next\@currbox\@freelist{\global\setbox\@currbox\vbox{%
+ \unvbox\@tempboxa \vskip-\dblfloatsep \dblfigrule
+ \vskip\dbltextfloatsep}}\pcol@ovf
\global\dimen\@currbox\@colht
\global\skip\@currbox\pcol@topskip
- \pcol@defcurrpage{\number\c@page}\@currbox\voidb@x
+ \pcol@defcurrpage{\number\c@page}\@currbox\voidb@x{}{}%
\endgroup
\fi
\gdef\pcol@footins{\voidb@x}}
%% Shipping Page Out
-\def\pcol@outputpage#1{\begingroup
+\def\pcol@outputcolumns#1{\begingroup
\def\@elt{\pcol@outputelt#1}\@tempswatrue \pcol@outputflttrue
\let\reserved@b\pcol@pages \gdef\pcol@pages{}%
\reserved@b
\endgroup}
-\def\pcol@outputelt#1#2#3#4{%
+\def\pcol@outputelt#1#2#3#4#5#6{%
\setbox\@outputbox\box\voidb@x
- \pcol@getpinfo{#2}#3#4\c@page\@tempdima\@tempskipa
+ \pcol@getpinfo{#2}#3#4{#5}{#6}\c@page\@tempdima\@tempskipa
\ifdim\@tempdima<\z@
\ifpcol@outputflt
- \setbox\@outputbox\box\pcol@spanning
+ \def\pcol@bg@floatheight{\pcol@bg@textheight}%
+ \setbox\@outputbox\vbox to\textheight{%
+ \pcol@bg@paintbox{Ff}\unvbox\pcol@spanning}%
\@cons\@freelist\pcol@spanning
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \setbox\pcol@rightpage\vbox to\textheight{%
+ \ifpcol@paired\else \advance\c@page\@ne \fi
+ \pcol@bg@paintbox{Ff}\vfil}%
+ \fi
\else
- \@cons\pcol@pages{{#2}#3#4}
+ \@cons\pcol@pages{{#2}#3#4{#5}{#6}}%
\fi
\else\if@tempswa
\ifnum#1=\z@ \@tempswafalse \fi
- \pcol@Logstart\pcol@outputelt
- \setbox\@outputbox\vbox to\textheight{%
- \ifpcol@nospan\else
- \@cons\@freelist\pcol@spanning
- \unvbox\pcol@spanning
- \fi
- \hb@xt@\textwidth{%
- \let\pcol@hfil\relax
- \@tempcnta\z@ \@whilenum\@tempcnta<\pcol@ncol\do{%
- \pcol@swapcolumn\@tempcnta\@tempcntb
- \expandafter\@next\expandafter\@currbox
- \csname pcol@shipped\number\@tempcntb\endcsname
- \relax{\let\@currbox\voidb@x}%
- \ifvoid\@currbox\else \@cons\@freelist\@currbox \fi
- \expandafter\@tempdima
- \csname pcol@columnwidth\number\@tempcntb \endcsname
- \pcol@hfil \hb@xt@\@tempdima{\box\@currbox\hss}%
- \let\pcol@hfil\hfil
- \advance\@tempcnta\@ne}}%
- \ifvoid\pcol@footins\else
- \pcol@Log\pcol@outputelt{output}\pcol@footins
- \pcol@putfootins\pcol@footins
- \@cons\@freelist\pcol@footins
- \fi
- \boxmaxdepth\@maxdepth}%
- \pcol@Logend\pcol@outputelt
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \pcol@Logstart{\pcol@outputelt{right}}%
+ \pcol@ioutputelt\pcol@ncolleft\pcol@ncol\pcol@rightpage
+ \pcol@Logend{\pcol@outputelt{right}}%
+ \fi
+ \pcol@Logstart{\pcol@outputelt{left}}%
+ \pcol@ioutputelt\z@\pcol@ncolleft\@outputbox
+ \pcol@Logend{\pcol@outputelt{left}}%
+ \global\pcol@firstpagefalse
\else
\pcol@outputfltfalse
- \@cons\pcol@pages{{#2}#3#4}%
+ \@cons\pcol@pages{{#2}#3#4{#5}{#6}}%
\fi\fi
\ifvoid\@outputbox\else
- \@outputpage \global\advance\pcol@basepage\@ne
+ \global\advance\pcol@basepage\@ne \@outputpage
+ \fi}
+
+\def\pcol@ioutputelt#1#2#3{\setbox#3\vbox to\textheight{%
+ \ifpcol@paired\else\ifnum#1=\z@\else \advance\c@page\@ne \fi\fi
+ \ifvoid\pcol@footins\else
+ \def\pcol@bg@footnoteheight{\@elt{\ht\pcol@footins}\@elt{\dp\pcol@footins}}%
+ \pcol@bg@paintbox{Nn}%
+ \pcol@shrinkcolbyfn\@tempdima\pcol@footins\relax
+ \fi
+ \ifpcol@nospan\else
+ \def\pcol@bg@floatheight{%
+ \@elt{\ht\pcol@spanning}\@elt{\dp\pcol@spanning}}%
+ \@tempdimb\ht\pcol@spanning \advance\@tempdimb\dp\pcol@spanning
+ \ifnum#1=\z@
+ \ifpcol@firstpage\else \pcol@bg@paintbox{Ff}\fi
+ \@cons\@freelist\pcol@spanning \unvbox\pcol@spanning
+ \else\ifpcol@firstpage
+ \ht\pcol@rightpage\ht\pcol@spanning
+ \dp\pcol@rightpage\dp\pcol@spanning
+ \box\pcol@rightpage \nointerlineskip
+ \else
+ \pcol@bg@paintbox{Ff}\pcol@phantom\pcol@spanning \nointerlineskip
+ \fi\fi
+ \advance\topmargin\@tempdimb
+ \fi
+ \pcol@buildcolseprule\@tempdima#1#2\@maxdepth \unvbox\@tempboxa
+ \hb@xt@\textwidth{%
+ \let\pcol@@hfil\relax
+ \@tempcnta#1\relax \@whilenum\@tempcnta<#2\do{%
+ \pcol@swapcolumn\@tempcnta\@tempcntb#1#2\relax
+ \expandafter\@next\expandafter\@currbox
+ \csname pcol@shipped\number\@tempcntb\endcsname
+ \relax{\let\@currbox\voidb@x}%
+ \ifvoid\@currbox\else \@cons\@freelist\@currbox \fi
+ \expandafter\@tempdima
+ \csname pcol@columnwidth\number\@tempcntb \endcsname
+ \pcol@@hfil \hb@xt@\@tempdima{\box\@currbox\hss}%
+ \edef\pcol@@hfil{\noexpand\pcol@hfil{\pcol@colsepid}}%
+ \advance\@tempcnta\@ne}}%
+ \ifvoid\pcol@footins\else
+ \ifnum#1=\z@
+ \pcol@Log\pcol@outputelt{output}\pcol@footins
+ \pcol@putfootins\pcol@footins
+ \@cons\@freelist\pcol@footins
+ \else
+ \vskip\skip\pcol@footins \nointerlineskip
+ \pcol@phantom\pcol@footins \vskip\z@
+ \fi
+ \fi
+ \boxmaxdepth\@maxdepth}}
+\def\pcol@phantom#1{{%
+ \setbox\@tempboxa\vbox{}\ht\@tempboxa\ht#1\dp\@tempboxa\dp#1\box\@tempboxa}}
+
+\def\pcol@buildcolseprule#1#2#3#4{%
+ \@tempdima#1\relax \dimen@#4\relax
+ \let\pcol@bg@from#2\relax \let\pcol@bg@to#3\relax
+ \setbox\pcol@tempbox\vbox{}\setbox\@tempboxa\vbox{}%
+ \let\@elt\pcol@buildcselt@S \pcol@sptextlist
+ \@tempdimb\z@ \let\@elt\pcol@buildcselt \pcol@sptextlist
+ \let\@elt\relax \advance\@tempdima-\@tempdimb
+ \ifdim\@tempdima>\z@
+ \setbox\pcol@tempbox\vbox{\unvbox\pcol@tempbox
+ \hrule\@height\@tempdima\@width\columnseprule}%
+ \setbox\@tempboxa\vbox{\unvbox\@tempboxa
+ \let\@elt\relax
+ \edef\pcol@bg@columntop{\number\@tempdimb sp}%
+ \edef\pcol@bg@columnheight{%
+ \@elt{\number\@tempdima sp}\@elt{\number\dimen@ sp}}%
+ \pcol@bg@paintcolumns}%
\fi}
+\def\pcol@buildcselt@S#1#2{%
+ \setbox\@tempboxa\vbox{\unvbox\@tempboxa
+ \let\@elt\relax
+ \def\pcol@bg@spanningtop{\@elt{#1sp}}%
+ \advance\@tempdima-#1sp\relax \advance\@tempdima-#2sp\relax
+ \advance\dimen@\@tempdima
+ \edef\pcol@bg@spanningheight{\@elt{#2sp}%
+ \ifdim\@tempdima>\z@\else \@elt{\number\dimen@ sp}\fi}%
+ \pcol@bg@paintbox{S}}}
+\def\pcol@buildcselt#1#2{%
+ \@tempdimc#1sp \advance\@tempdimc-\@tempdimb
+ \setbox\pcol@tempbox\vbox{\unvbox\pcol@tempbox
+ \ifdim\@tempdimc>\z@ \hrule\@height\@tempdimc\@width\columnseprule \fi
+ \vskip#2sp}%
+ \setbox\@tempboxa\vbox{\unvbox\@tempboxa
+ \let\@elt\relax
+ \edef\pcol@bg@columntop{\number\@tempdimb sp}%
+ \edef\pcol@bg@columnheight{\@elt{\number\@tempdimc sp}}%
+ \ifdim\@tempdimc>\z@ \pcol@bg@paintcolumns \fi
+ \def\pcol@bg@spanningtop{\@elt{#1sp}}%
+ \advance\@tempdima-#1sp\relax \advance\@tempdima-#2sp\relax
+ \advance\dimen@\@tempdima
+ \edef\pcol@bg@spanningheight{\@elt{#2sp}%
+ \ifdim\@tempdima>\z@\else \@elt{\number\dimen@ sp}\fi}%
+ \pcol@bg@paintbox{s}}%
+ \@tempdimb#1sp \advance\@tempdimb#2sp\relax}
+
+\def\pcol@hfil#1{{%
+ \@tempdima\csname pcol@columnsep#1\endcsname\relax
+ \ifdim\columnseprule>\z@
+ \hskip.5\@tempdima\@plus1fil\relax
+ \hskip-.5\columnseprule
+ \@ifundefined{pcol@colseprulecolor#1}%
+ {\pcol@colseprulecolor}{\@nameuse{pcol@colseprulecolor#1}}%
+ \copy\pcol@tempbox \hskip-.5\columnseprule
+ \hskip.5\@tempdima\@plus1fil\relax
+ \else \hskip\@tempdima\@plus1fil\relax
+ \fi}}
+
+\let\pcol@@outputpage\@outputpage
+\def\@outputpage{\begingroup
+ \@tempdima\topmargin \advance\@tempdima\headheight \advance\@tempdima\headsep
+ \ifpcol@output
+ \setbox\pcol@tempbox\vtop{\vskip\@tempdima \global\pcol@bg@paintedfalse
+ \let\pcol@bg@from\z@ \let\pcol@bg@to\pcol@ncolleft
+ \pcol@bg@paintpage}%
+ \ifpcol@bg@painted \@tempswatrue \else \@tempswafalse \fi
+ \setbox\@tempboxa\vtop{\vskip\@tempdima \global\pcol@bg@paintedfalse
+ \ifpcol@paired\else \advance\c@page\@ne \fi
+ \let\pcol@bg@from\pcol@ncolleft \let\pcol@bg@to\pcol@ncol
+ \pcol@bg@paintpage}%
+ \else
+ \def\reserved@a{\vskip\@tempdima \global\pcol@bg@paintedfalse
+ \ifpcol@havelastpage \ifx\set@color\relax\else
+ \pcol@bg@@paintpage \pcol@bg@@paintbox{Pp}%
+ \fi\fi}%
+ \setbox\pcol@tempbox\vbox{%
+ \let\pcol@bg@preposttop\pcol@bg@preposttop@left
+ \let\pcol@bg@from\z@ \let\pcol@bg@to\pcol@ncolleft \reserved@a}%
+ \ifpcol@bg@painted \@tempswatrue \else \@tempswafalse \fi
+ \setbox\@tempboxa\vbox{\ifpcol@paired\else \advance\c@page\@ne \fi
+ \let\pcol@bg@preposttop\pcol@bg@preposttop@right
+ \let\pcol@bg@from\pcol@ncolleft \let\pcol@bg@to\pcol@ncol
+ \reserved@a}%
+ \ifvoid\pcol@rightpage\else
+ \pcol@Logstart{\@outputpage{rightset}}%
+ \setbox\pcol@rightpage\vbox to\textheight{\unvbox\pcol@rightpage \vfil}%
+ \pcol@Logend{\@outputpage{rightset}}%
+ \fi
+ \fi
+ \ht\pcol@tempbox\z@ \dp\pcol@tempbox\z@
+ \ht\@tempboxa\z@ \dp\@tempboxa\z@
+ \ifodd\c@page \pcol@swapcolumnfalse \fi
+ \ifnum\pcol@ncolleft<\pcol@ncol\else \pcol@swapcolumnfalse \fi
+ \ifpcol@output\else \ifpcol@havelastpage\else \pcol@swapcolumnfalse \fi\fi
+ \@tempcnta\c@page
+ \ifpcol@paired\else \advance\@tempcnta\@ne \pcol@swapcolumnfalse \fi
+ \ifpcol@swapcolumn \pcol@outputpage@r\c@page \pcol@outputpage@l\@tempcnta
+ \else \pcol@outputpage@l\c@page \pcol@outputpage@r\@tempcnta
+ \fi
+ \global\pcol@havelastpagefalse \gdef\pcol@bg@preposttop@left{0pt}%
+ \global\let\pcol@bg@preposttop@right\pcol@bg@preposttop@left
+ \global\let\pcol@mparbottom@out\pcol@mparbottom@zero
+ \endgroup}
+
+\def\pcol@outputpage@l#1{%
+ \pcol@Logstart{\@outputpage{left}}%
+ \global\c@page#1\relax
+ \let\@themargin\oddsidemargin
+ \if@twoside\ifodd\c@page\else \let\@themargin\evensidemargin \fi\fi
+ \if@tempswa \everyvbox{\pcol@outputpage@ev\pcol@tempbox}\fi
+ \pcol@@outputpage
+ \pcol@Logend{\@outputpage{left}}}
+\def\pcol@outputpage@r#1{%
+ \begingroup
+ \ifvoid\pcol@rightpage\else
+ \global\c@page#1\relax
+ \let\@outputbox\pcol@rightpage
+ \pcol@Logstart{\@outputpage{right}}%
+ \let\@themargin\oddsidemargin
+ \if@twoside\ifodd\c@page\else \let\@themargin\evensidemargin \fi\fi
+ \ifpcol@bg@painted \everyvbox{\pcol@outputpage@ev\@tempboxa}\fi
+ \pcol@@outputpage
+ \pcol@Logend{\@outputpage{right}}%
+ \fi
+ \endgroup}
+\def\pcol@outputpage@ev#1{%
+ \edef\reserved@a{\meaning\yoko}\edef\reserved@b{\string\yoko}%
+ \ifx\reserved@a\reserved@b \yoko\fi
+ \moveright\@themargin\box#1\nointerlineskip \everyvbox{}%
+ \ifx\reserved@a\reserved@b \let\yoko\relax \fi}
%% Starting New Column Page
\def\pcol@startcolumn#1{%
\@tempdima\@colht \@tempdimb\z@
- \ifvoid\pcol@footins\else \pcol@shrinkcolbyfn\pcol@footins \fi
+ \ifvoid\pcol@footins\else
+ \pcol@shrinkcolbyfn\@colht\pcol@footins\@tempdimb
+ \fi
\global\@colroom\@colht
\@tryfcolumn\@deferlist
\if@fcolmade\else
@@ -368,6 +593,185 @@
\reserved@b
\endgroup}
+%% Background Painting
+
+\let\pcol@bg@to\pcol@ncol
+\def\pcol@bg@@paintpage{%
+ \pcol@bg@paint@i{%
+ \pcol@bg@paint@ii{TBLR}{G}{C}\pcol@bg@paint@ii{tblr}{}{}}}
+\def\pcol@bg@@paintcolumns{\pcol@bg@paint@i{\pcol@bg@paint@ii{}{g}{c}}}
+\def\pcol@bg@@paintbox#1{\pcol@bg@paint@i{\pcol@bg@paint@ii{#1}{}{}}}
+
+\def\pcol@bg@paint@i#1{%
+ \setbox\@tempboxa\vtop{\vskip\z@
+ \global\pcol@bg@paintedfalse
+ \let\pcol@bg@leftmargin\pcol@lrmargin
+ \pagerim-\pagerim \advance\pcol@bg@to\m@ne
+ \offinterlineskip #1}%
+ \ht\@tempboxa\z@ \dp\@tempboxa\z@ \wd\@tempboxa\z@
+ \ifpcol@bg@painted \nointerlineskip \box\@tempboxa \nointerlineskip \fi}
+\def\pcol@bg@paint@ii#1#2#3{%
+ \pcol@bg@swappage\ifpcol@bg@swap\fi
+ \@tfor\reserved@b:=#1\do{\pcol@bg@paintregion\reserved@b\m@ne}%
+ \pcol@bg@swappage\ifpcol@swapcolumn\fi
+ \@tfor\reserved@b:=#2#3\do{%
+ \pcol@currcol\pcol@bg@from \@whilenum\pcol@currcol<\pcol@bg@to\do{%
+ \pcol@bg@paintregion\reserved@b\pcol@currcol
+ \advance\pcol@currcol\@ne}}%
+ \@tfor\reserved@b:=#3\do{\pcol@bg@paintregion\reserved@b\pcol@currcol}}
+\def\pcol@bg@swappage#1#2{%
+ \pcol@bg@leftmargin\oddsidemargin \pcol@bg@@swapfalse
+ \ifodd\c@page\else
+ \if@twoside \pcol@bg@leftmargin\evensidemargin \fi
+ #1% \ifpcol@{bg@swap,swapcolumn}
+ \pcol@bg@@swaptrue
+ \advance\pcol@bg@leftmargin\textwidth \advance\pcol@bg@leftmargin2in
+ \advance\pcol@bg@leftmargin-\paperwidth
+ \pcol@bg@leftmargin-\pcol@bg@leftmargin
+ #2% \fi
+ \fi}
+
+\def\pcol@bg@paintregion#1#2{%
+ \@ifundefined{pcol@bg@color@#1@\number#2}%
+ {\def\reserved@a{#1}}{\edef\reserved@a{#1@\number#2}}%
+ \@ifundefined{pcol@bg@color@\reserved@a}\relax
+ {\setbox\@tempboxa\vtop{\vskip\z@
+ \expandafter\expandafter\expandafter
+ \pcol@bg@paintregion@i\csname pcol@bg@@#1\endcsname}%
+ \global\pcol@bg@paintedtrue
+ \ht\@tempboxa\z@ \dp\@tempboxa\z@ \wd\@tempboxa\z@ \box\@tempboxa}}
+\def\pcol@bg@paintregion@i#1#2#3#4{%
+ \pcol@bg@calculate\@tempdima\z@{#1}%
+ \pcol@bg@calculate\@tempdimb\z@{#2}%
+ \pcol@bg@calculate\@tempdimc\@tempdima{#3}%
+ \pcol@bg@calculate\dimen@\@tempdimb{#4}%
+ \pcol@bg@addext\@tempdima{-}{l}\pcol@bg@addext\@tempdimc{}{r}%
+ \pcol@bg@addext\@tempdimb{-}{t}\pcol@bg@addext\dimen@{}{b}%
+ \vskip\@tempdimb
+ \ifpcol@bg@@swap
+ \advance\@tempdima-\@tempdimc \@tempdima-\@tempdima
+ \advance\@tempdimc-\textwidth \@tempdimc-\@tempdimc
+ \moveright\@tempdimc\hbox{%
+ \advance\dimen@-\@tempdimb
+ \edef\current@color{\@nameuse{pcol@bg@color@\reserved@a}}\pcol@set@color
+ \vrule\@width\@tempdima\@height\dimen@}%
+ \else
+ \moveright\@tempdima\hbox{%
+ \advance\@tempdimc-\@tempdima \advance\dimen@-\@tempdimb
+ \edef\current@color{\@nameuse{pcol@bg@color@\reserved@a}}\pcol@set@color
+ \vrule\@width\@tempdimc\@height\dimen@}%
+ \fi}
+
+\def\pcol@bg@calculate#1#2#3{\let\pcol@bg@dimen#1\relax
+ \let\@elt\pcol@bg@advance \pcol@bg@dimen#2\relax #3}
+\def\pcol@bg@negative#1{\let\@elt\pcol@bg@nadvance #1\relax
+ \let\@elt\pcol@bg@advance}
+\def\pcol@bg@advance#1{\advance\pcol@bg@dimen#1\relax}
+\def\pcol@bg@nadvance#1{\advance\pcol@bg@dimen-#1\relax}
+
+\def\pcol@bg@addext#1#2#3{%
+ \dimen@ii\@nameuse{pcol@bg@ext@#3@\reserved@a}\relax
+ \ifdim\dimen@ii<9000\p@\relax \advance#1#2\dimen@ii
+ \else
+ \pcol@bg@calculate#1\z@{\@nameuse{pcol@bg@ext@inf@#3}}%
+ \advance\dimen@ii-\@M\p@ \advance#1#2\dimen@ii
+ \fi}
+\def\pcol@bg@ext@inf@l{\pcol@bg@negative\pcol@bg@pageleft}
+\def\pcol@bg@ext@inf@r{\pcol@bg@negative\pcol@bg@pageleft
+ \pcol@bg@paperwidth}
+\def\pcol@bg@ext@inf@t{\pcol@bg@negative\pcol@bg@pagetop}
+\def\pcol@bg@ext@inf@b{\pcol@bg@negative\pcol@bg@pagetop
+ \pcol@bg@paperheight}
+
+\def\pcol@bg@paperwidth{\@elt\paperwidth \@elt{2\pagerim}}
+\def\pcol@bg@paperheight{\@elt\paperheight \@elt{2\pagerim}}
+\def\pcol@bg@pageleft{\@elt{1in}\@elt\pcol@bg@leftmargin \@elt\pagerim}
+\def\pcol@bg@pagetop{\@elt{1in}\@elt\topmargin \@elt\headheight \@elt\headsep
+ \@elt\pagerim}
+\def\pcol@bg@textheight{\@elt\textheight \@elt\@maxdepth}
+\def\pcol@bg@columnleft{%
+ \@tempcnta\pcol@bg@from \@whilenum\@tempcnta<\pcol@currcol\do{%
+ \@elt{\@nameuse{pcol@columnwidth\number\@tempcnta}}%
+ \@elt{\@nameuse{pcol@columnsep\number\@tempcnta}}%
+ \advance\@tempcnta\@ne}}
+\def\pcol@bg@columnright{\pcol@bg@columnleft \pcol@bg@columnwidth}
+\def\pcol@bg@columnwidth{\@elt{\@nameuse{pcol@columnwidth\number\pcol@currcol}}}
+\def\pcol@bg@columnsep{\@elt{\@nameuse{pcol@columnsep\number\pcol@currcol}}}
+\def\pcol@bg@preposttop@left{0pt}
+\let\pcol@bg@preposttop@right\pcol@bg@preposttop@left
+
+\def\pcol@bg@@c{%
+ {\pcol@bg@columnleft}%
+ {\@elt\pcol@bg@columntop}%
+ {\pcol@bg@columnwidth}%
+ {\pcol@bg@columnheight}}
+\def\pcol@bg@@C{%
+ {\pcol@bg@columnleft}%
+ {}%
+ {\pcol@bg@columnwidth}%
+ {\pcol@bg@textheight}}
+\def\pcol@bg@@g{%
+ {\pcol@bg@columnright}%
+ {\@elt\pcol@bg@columntop}%
+ {\pcol@bg@columnsep}%
+ {\pcol@bg@columnheight}}
+\def\pcol@bg@@G{%
+ {\pcol@bg@columnright}%
+ {}%
+ {\pcol@bg@columnsep}%
+ {\pcol@bg@textheight}}
+\def\pcol@bg@@s{%
+ {}%
+ {\pcol@bg@spanningtop}%
+ {\@elt\textwidth}%
+ {\pcol@bg@spanningheight}}
+\def\pcol@bg@@t{%
+ {\pcol@bg@negative\pcol@bg@pageleft}%
+ {\pcol@bg@negative\pcol@bg@pagetop}%
+ {\pcol@bg@paperwidth}%
+ {\pcol@bg@pagetop}}
+\def\pcol@bg@@b{%
+ {\pcol@bg@negative\pcol@bg@pageleft}%
+ {\pcol@bg@textheight}%
+ {\pcol@bg@paperwidth}%
+ {\pcol@bg@paperheight
+ \pcol@bg@negative{\pcol@bg@pagetop \pcol@bg@textheight}}}
+\def\pcol@bg@@l{%
+ {\pcol@bg@negative\pcol@bg@pageleft}%
+ {}%
+ {\pcol@bg@pageleft}%
+ {\pcol@bg@textheight}}
+\def\pcol@bg@@r{%
+ {\@elt\textwidth}%
+ {}%
+ {\pcol@bg@paperwidth
+ \pcol@bg@negative{\pcol@bg@pageleft \@elt\textwidth}}%
+ {\pcol@bg@textheight}}
+\def\pcol@bg@@f{%
+ {}%
+ {}%
+ {\@elt\textwidth}%
+ {\pcol@bg@floatheight}}
+\def\pcol@bg@@n{%
+ {}%
+ {\pcol@bg@textheight
+ \pcol@bg@negative{\pcol@bg@footnoteheight \@elt{\skip\footins}}}%
+ {\@elt\textwidth}%
+ {\pcol@bg@footnoteheight \@elt{\skip\footins}}}
+\def\pcol@bg@@p{%
+ {}%
+ {\@elt\pcol@bg@preposttop}%
+ {\@elt\textwidth}%
+ {\pcol@bg@textheight \pcol@bg@negative{\@elt\pcol@bg@preposttop}}}
+\let\pcol@bg@@S\pcol@bg@@s
+\let\pcol@bg@@T\pcol@bg@@t
+\let\pcol@bg@@B\pcol@bg@@b
+\let\pcol@bg@@L\pcol@bg@@l
+\let\pcol@bg@@R\pcol@bg@@r
+\let\pcol@bg@@F\pcol@bg@@f
+\let\pcol@bg@@N\pcol@bg@@n
+\let\pcol@bg@@P\pcol@bg@@p
+
%% Special Output Routines: Dispatcher
\def\pcol@op@start{-10010}
@@ -378,6 +782,16 @@
\def\pcol@op@cpush{-10015}
\def\pcol@op@cpop{-10016}
\def\pcol@op@cset{-10017}
+
+\def\pcol@mcpushlimit{100}
+\@tempcnta\@M
+\advance\@tempcnta\pcol@mcpushlimit
+\edef\pcol@op@mcpush{\number\@tempcnta}\advance\@tempcnta\m@ne
+\edef\pcol@op@mcpush@pone{\number-\@tempcnta}\advance\@tempcnta\@ne
+\advance\@tempcnta\pcol@mcpushlimit
+\edef\pcol@op@mcpop{\number\@tempcnta}\advance\@tempcnta\m@ne
+\edef\pcol@op@mcpop@pone{\number-\@tempcnta}\advance\@tempcnta\@ne
+
\def\pcol@specialoutput{%
\ifnum\outputpenalty=\pcol@op@start\relax
\let\reserved@a\pcol@output@start
@@ -395,8 +809,14 @@
\let\reserved@a\pcol@output@cpop
\else\ifnum\outputpenalty=\pcol@op@cset\relax
\let\reserved@a\pcol@output@cset
+ \else\ifnum\outputpenalty<\pcol@op@mcpop@pone\relax
+ \advance\outputpenalty\pcol@op@mcpop\relax \@tempcnta-\outputpenalty
+ \let\reserved@a\pcol@output@mcpop
+ \else\ifnum\outputpenalty<\pcol@op@mcpush@pone\relax
+ \advance\outputpenalty\pcol@op@mcpush\relax \@tempcnta-\outputpenalty
+ \let\reserved@a\pcol@output@mcpush
\else \let\reserved@a\@specialoutput
- \fi\fi\fi\fi\fi\fi\fi\fi
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\ifnum\outputpenalty=-\@Miv\relax
\ifvoid\footins\else \pcol@Log\dummy{dummy}\footins \fi
\fi
@@ -423,26 +843,43 @@
\fi
\ifx\@botlist\@empty\else \advance\@tempdima-\textfloatsep \fi
\ifdim\@tempdima<1.5\baselineskip
- \pcol@makenormalcol\z@
- \@outputpage
+ \setbox\@cclv\box\@holdpg \@makecol
+ \pcol@outputfalse \@outputpage \pcol@outputtrue
\global\let\pcol@currpage\@empty \pcol@startpage
- \global\topskip\pcol@topskip
+ \global\topskip\pcol@topskip \global\pcol@firstpagefalse
\else
- \pcol@makenormalcol\@ne
+ \pcol@makenormalcol
\@tempdima\ht\@outputbox \advance\@tempdima\dp\@outputbox
\global\advance\@colht-\@tempdima
- \@next\@currbox\@freelist{\global\setbox\@currbox\box\@outputbox}\pcol@ovf
+ \def\reserved@a{%
+ \ifdim\pcol@bg@preposttop=\@tempdima\else
+ \edef\pcol@bg@textheight{\@elt{\number\@tempdima sp}}%
+ \pcol@bg@paintbox{Pp}%
+ \fi}
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \global\setbox\pcol@rightpage\vbox{%
+ \ifpcol@paired\else \advance\c@page\@ne \fi
+ \let\pcol@bg@preposttop\pcol@bg@preposttop@right
+ \reserved@a \unvbox\pcol@rightpage}%
+ \fi
+ \@next\@currbox\@freelist{\global\setbox\@currbox\vbox{%
+ \let\pcol@bg@preposttop\pcol@bg@preposttop@left
+ \reserved@a \unvbox\@outputbox}}\pcol@ovf
\global\dimen\@currbox\@colht
\ifdim\@tempdima=\z@ \@tempskipa\topskip \else \@tempskipa\z@ \fi
\global\skip\@currbox\@tempskipa \global\topskip\@tempskipa
- \pcol@defcurrpage{\number\c@page}\@currbox\voidb@x
+ \def\pcol@do@mpbout@whole##1##2##3##4{%
+ \xdef\pcol@mparbottom@out{{##1}{##2}{##3}{##4}}}%
+ \def\pcol@do@mpbout@elem\@elt##1##2{\@elt{0}{\number\@mparbottom}}%
+ \pcol@do@mpbout
+ \pcol@bias@mpbout{-\@tempdima}%
+ \pcol@defcurrpage{\number\c@page}\@currbox\voidb@x{}{\pcol@mparbottom@out}%
+ \global\pcol@firstpagetrue
\fi
- \global\@colroom\@colht
- \pcol@floatplacement
+ \global\@colroom\@colht \pcol@floatplacement
\pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{%
\@next\@currbox\@freelist{\global\setbox\@currbox\vbox{%
- \ifdim\topskip=\z@ \hrule\@height\z@\@width\z@
- \fi}}\pcol@ovf
+ \ifdim\topskip=\z@ \hrule\@height\z@\@width\z@ \fi}}\pcol@ovf
\pcol@setcurrcolnf
\global\count\@currbox\z@
\global\dimen\@currbox\@colroom
@@ -457,31 +894,41 @@
\insert\footins{\box\footins\penalty\interlinepenalty}%
\fi}
-\def\pcol@makenormalcol#1{%
- \ifvoid\footins \@tempswafalse \else \@tempswatrue \fi
- \ifpcol@mgfnote \ifnum#1=\@ne \@tempswafalse \fi\fi
- \if@tempswa
- \pcol@Log\pcol@makenormalcol{output}\footins
- \pcol@combinefootins\@holdpg\footins
+\def\pcol@makenormalcol{%
+ \ifpcol@mgfnote \setbox\@tempboxa\box\footins \fi
+ \begingroup
+ \ifx\@botlist\@empty
+ \ifvoid\footins \setbox\@outputbox\box\@holdpg
+ \else \pcol@combinefootins\@holdpg\footins
+ \fi
+ \let\@elt\relax \xdef\@freelist{\@freelist\@midlist}%
+ \global\let\@midlist\@empty
+ \pcol@combinefloats
\else
- \setbox\@outputbox\box\@holdpg
+ \pcol@lastpagetrue
+ \setbox\@cclv\box\@holdpg \let\@textbottom\relax \vbadness\@M
+ \@makecol
\fi
- \let\@elt\relax
- \xdef\@freelist{\@freelist\@midlist}%
- \global\let\@midlist\@empty
- \ifnum#1=\@ne \pcol@lastpagetrue \fi
- \pcol@combinefloats \pcol@lastpagefalse}
-
-\def\pcol@floatplacement{%
- \global\@mparbottom\z@ \global\@textfloatsheight\z@
- \global\pcol@textfloatsep\maxdimen
- \@floatplacement}
+ \global\setbox\@outputbox\vbox{\unvbox\@outputbox}%
+ \endgroup
+ \ifpcol@mgfnote \setbox\footins\box\@tempboxa \fi}
%% Special Output Routines: Column-Switching
\def\pcol@output@switch{%
+ \ifpcol@sptext\ifnum\pcol@currcol=\z@
+ \ifvoid\pcol@prespan\else \global\advance\@colroom\ht\pcol@prespan \fi
+ \pcol@getcurrpinfo\@tempcnta\@tempdima\@tempskipa
+ \@tempdimb\ht\@holdpg \advance\@tempdimb\dp\@holdpg
+ \dimen@\ht\pcol@prespan \pcol@addflhd\@toplist\pcol@textfloatsep
+ \@cons\pcol@sptextlist{{\number\dimen@}{\number\@tempdimb}}%
+ \pcol@defcurrpage{\number\@tempcnta}\pcol@spanning\pcol@footins
+ {\pcol@sptextlist}{\pcol@mparbottom}%
+ \pcol@shiftspanning\@holdpg
+ \setbox\@holdpg\vbox{\unvbox\pcol@prespan \unvbox\@holdpg}%
+ \fi\fi
\@next\@currbox\@freelist{\global\setbox\@currbox\vbox{
- \pcol@clearcst@unvbox\@holdpg}}\pcol@ovf
+ \pcol@clearcst@unvbox\@holdpg}}\pcol@ovf
\def\pcol@currfoot{\voidb@x}%
\ifvoid\footins\else
\ifpcol@scfnote
@@ -490,6 +937,7 @@
\pcol@Log\pcol@output@switch{save}\footins
\pcol@savefootins\pcol@footins
\pcol@defcurrpage{\number\@tempcnta}\pcol@spanning\pcol@footins
+ {\pcol@sptextlist}{\pcol@mparbottom}%
\else
\pcol@Log\pcol@output@switch{discard}\footins
\setbox\@tempboxa\box\footins
@@ -503,28 +951,30 @@
\pcol@setcurrcol
\global\count\@currbox\pcol@page
\global\dimen\@currbox\@colroom
- \@tempswafalse
\let\reserved@a\@nobreakfalse \let\reserved@b\@afterindentfalse
- \ifpcol@sync
- \ifpcol@mctext
- \if@nobreak \let\reserved@a\@nobreaktrue \fi
- \if@afterindent \let\reserved@b\@afterindenttrue \fi
- \@temptokena\everypar
- \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{%
- \pcol@getcurrcol \reserved@a \reserved@b \everypar\@temptokena
- \pcol@setcurrcol
- \advance\pcol@currcol\@ne}%
- \fi
- \@tempswatrue
- \global\pcol@mctextfalse
- \fi
- \ifpcol@clear \@tempswatrue \fi
+ \ifpcol@sptext\ifnum\pcol@currcol=\z@
+ \if@nobreak \let\reserved@a\@nobreaktrue \fi
+ \if@afterindent \let\reserved@b\@afterindenttrue \fi
+ \@temptokena\everypar
+ \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{%
+ \pcol@getcurrcol \reserved@a \reserved@b \everypar\@temptokena
+ \pcol@setcurrcol
+ \advance\pcol@currcol\@ne}%
+ \global\pcol@sptextfalse
+ \fi\fi
+ \@tempswafalse \ifpcol@sync \@tempswatrue \fi \ifpcol@clear \@tempswatrue \fi
\if@tempswa \pcol@sync \fi
\@tempswatrue
\ifpcol@clear \ifpcol@sync\else \@tempswafalse \fi\fi
\if@tempswa \pcol@restartcolumn \fi
\global\pcol@syncfalse}
+\def\pcol@shiftspanning#1{%
+ \ifpcol@swapcolumn\ifodd\c@page\else
+ \setbox#1\vbox{\@tempdima\textwidth \advance\@tempdima-\columnwidth
+ \moveleft\@tempdima\box#1}
+ \fi\fi}
+
\def\pcol@restartcolumn{%
\global\pcol@currcol\pcol@nextcol
\pcol@getcurrcol
@@ -532,35 +982,38 @@
\global\@colroom\dimen\@currbox
\@cons\@freelist\@currbox
\pcol@getcurrpage
- \@tempswafalse
\ifpcol@scfnote
\edef\pcol@currfoot{\pcol@footins}%
- \ifnum\pcol@page=\pcol@toppage\else \@tempswatrue \fi
- \fi
- \if@tempswa\else
- \pcol@restorecst@restart
- \if@nobreak \nobreak \else \addpenalty\interlinepenalty \fi
- \fi
- \@tempdima\@colht \@tempdimb\z@
- \ifvoid\pcol@currfoot\else
- \if@tempswa
- \pcol@getcurrfoot\copy
- \pcol@Log\pcol@restartcolumn{insdmy}\footins
+ \ifnum\pcol@page=\pcol@toppage
+ \@tempdima\@colht \@tempdimb\z@
+ \pcol@putbackmvl
+ \if@nobreak \nobreak \else \addpenalty\interlinepenalty \fi
+ \ifvoid\pcol@footins\else
+ \pcol@getcurrfoot\box \@cons\@freelist\pcol@currfoot
+ \pcol@Log\pcol@restartcolumn{insert}\footins
+ \pcol@shrinkcolbyfn\@colht\footins\@tempdimb
+ \insert\footins{\unvbox\footins}%
+ \fi
+ \pcol@deferredfootins\pcol@restartcolumn
+ \@colht\@tempdima
\else
- \pcol@getcurrfoot\box \@cons\@freelist\pcol@currfoot
- \pcol@Log\pcol@restartcolumn{insert}\footins
+ \ifvoid\pcol@footins\else
+ \pcol@getcurrfoot\copy
+ \pcol@Log\pcol@restartcolumn{insdmy}\footins
+ \insert\footins{\unvbox\footins}%
+ \fi
+ \pcol@putbackmvl
+ \if@nobreak \nobreak \else \addpenalty\interlinepenalty \fi
+ \fi
+ \else
+ \pcol@putbackmvl
+ \ifvoid\pcol@currfoot\else
+ \pcol@getcurrfoot\box \@cons\@freelist\pcol@currfoot
+ \pcol@Log\pcol@restartcolumn{insert}\footins
+ \insert\footins{\unvbox\footins}%
\fi
- \pcol@shrinkcolbyfn\footins
- \insert\footins{\unvbox\footins}%
- \fi
- \if@tempswa
- \pcol@restorecst@restart
\if@nobreak \nobreak \else \addpenalty\interlinepenalty \fi
- \fi
- \ifpcol@scfnote \ifnum\pcol@page=\pcol@toppage
- \pcol@deferredfootins\pcol@restartcolumn
- \fi\fi
- \@colht\@tempdima}
+ \fi}
\def\pcol@getcurrcol{%
\expandafter\expandafter\expandafter\pcol@igetcurrcol
@@ -571,18 +1024,18 @@
\def\@currbox{#1}\def\pcol@currfoot{#2}\global\pcol@prevdepth#3sp\relax
\gdef\@toplist{#4}\gdef\@midlist{#5}\gdef\@botlist{#6}\gdef\@deferlist{#7}%
\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
- \global\@botnum#5\relax \global\@botroom#6sp\relax
- \global\@colnum#7\relax
+\def\pcol@iigetcurrcol#1#2#3#4#5#6#7#8{%
+ \global\@textfloatsheight#1sp\relax
+ \global\@topnum#2\relax \global\@toproom#3sp\relax
+ \global\@botnum#4\relax \global\@botroom#5sp\relax
+ \global\@colnum#6\relax
\global\@afterindentfalse \@nobreaktrue
- \ifcase#8
+ \ifcase#7
\@nobreakfalse \or
\global\@afterindenttrue \else
\relax
\fi
- \global\everypar{#9}}
+ \global\everypar{#8}}
\def\pcol@getcurrfoot#1{%
\ifvoid\pcol@currfoot \global\setbox\footins\box\voidb@x
\else
@@ -596,88 +1049,43 @@
\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\@textfloatsheight}%
{\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: Color
-
-\def\pcol@set@color@push{\pcol@set@color
- \ifmmode\else \ifinner \pcol@innertrue \fi\fi
- \ifpcol@inner\else
- \aftergroup\pcol@reset@color@pop
- \let\pcol@elt@save\@elt \let\@elt\relax
- \edef\pcol@colorstack@shadow{\pcol@colorstack@shadow\@elt{\current@color}}%
- \@cons\pcol@colorstack@buf{{\current@color}}%
- \let\@elt\pcol@elt@save
- \pcol@color@invokeoutput\pcol@op@cpush
- \fi}
-\def\pcol@reset@color@pop{\ifpcol@output
- \pcol@color@invokeoutput\pcol@op@cpop \fi}
-
-\def\columncolor{\def\pcol@colorcommand{\string\columncolor}%
- \@ifnextchar[%]
- \pcol@xcolumncolor\pcol@ycolumncolor}
-\def\pcol@xcolumncolor[#1]#2{\pcol@columncolor{\color[#1]{#2}}}
-\def\pcol@ycolumncolor#1{\pcol@columncolor{\color{#1}}}
-\def\pcol@columncolor#1{\@ifnextchar[%]
- {\pcol@icolumncolor{#1}}{\pcol@icolumncolor{#1}[\number\pcol@currcol]}}
-\def\normalcolumncolor{\def\pcol@colorcommand{\string\normalcolumncolor}%
- \@ifnextchar[%]
- {\pcol@icolumncolor\normalcolor}%
- {\pcol@icolumncolor\normalcolor[\number\pcol@currcol]}}
-\def\pcol@icolumncolor#1[#2]{%
- \ifx\set@color\relax
- \PackageWarning{paracol}{\pcol@colorcommand\space is not effective
- without some coloring package}%
- \else\ifpcol@inner
- \PackageWarning{paracol}{\pcol@colorcommand\space is not effective
- when not in outer par mode}%
- \else\ifinner
- \PackageWarning{paracol}{\pcol@colorcommand\space is not effective
- when not in outer par mode}%
- \else
- \begingroup
- \let\@elt\relax
- \ifx\pcol@paracol\paracol
- \pcol@iicolumncolor{#1}{pcol@columncolor#2}{}%
- \pcol@iicolumncolor{#1}{pcol@columncolor@shadow#2}{}%
- \else\ifnum#2=\pcol@currcol
- \begingroup
- \pcol@getshadowcc{#2}\let\pcol@colorstack\pcol@colorstack@shadow
- \pcol@clearcolorstack
- \pcol@iicolumncolor{#1}{pcol@colorstack@buf}{\pcol@colorstack@buf}%
- \pcol@iicolumncolor{#1}{pcol@columncolor@shadow#2}{}%
- \pcol@getshadowcc{#2}\pcol@restorecolorstack
- \endgroup
- \pcol@color@invokeoutput\pcol@op@cset
+\def\pcol@putbackmvl{%
+ \ifpcol@flush \pcol@sptextstartfalse \fi
+ \ifpcol@sync\else \pcol@sptextstartfalse \fi
+ \pcol@ifempty\@currbox
+ {\pcol@savecolorstack
+ \ifpcol@sptextstart \global\setbox\pcol@prespan\box\voidb@x \fi}%
+ {\gdef\pcol@colorstack@saved{}%
+ \ifpcol@sptextstart
+ \global\setbox\pcol@prespan\vbox{
+ \unvbox\@currbox \pcol@restorecolorstack}%
+ \global\advance\@colroom-\ht\pcol@prespan
+ \global\topskip\z@ \hrule\@height\z@\@width\z@
\else
- \pcol@iicolumncolor{#1}{pcol@columncolor#2}{}%
- \pcol@iicolumncolor{#1}{pcol@columncolor@shadow#2}{}%
- \fi\fi
- \endgroup
- \fi\fi\fi
- \ignorespaces}
-\def\pcol@iicolumncolor#1#2#3{\let\set@color\relax #1%
- \expandafter\xdef\csname#2\endcsname{#3\@elt{\current@color}}}
-\def\pcol@getshadowcc#1{%
- \expandafter\let\expandafter\reserved@a
- \csname pcol@columncolor@shadow#1\endcsname
- \expandafter\let\csname pcol@columncolor#1\endcsname\reserved@a}
+ \unvbox\@currbox \pcol@restorecolorstack
+ \fi}}
-\def\pcol@color@invokeoutput#1{%
- \ifvmode \pcol@color@invokeoutput@v{#1}
- \else \vadjust{\pcol@color@invokeoutput@v{#1}}\ifhmode \hskip\z@ \fi
- \fi}
-\def\pcol@color@invokeoutput@v#1{\penalty-\@Miv \@tempdima\prevdepth
- \vbox{}\prevdepth\@tempdima \penalty#1\relax}
+%% Special Output Routines: Color Management
\def\pcol@output@cpush{%
\expandafter\pcol@output@icpush\pcol@colorstack@buf\@nil
\pcol@return@from@color}
\def\pcol@output@icpush\@elt#1#2\@nil{%
\@cons\pcol@colorstack{{#1}}\gdef\pcol@colorstack@buf{#2}}
+\def\pcol@output@mcpush{\begingroup
+ \let\pcol@reset@color@mpop\pcol@output@imcpush
+ \@nameuse{pcol@reset@color@mpop@\number\@tempcnta}%
+ \endgroup
+ \pcol@return@from@color}
+\def\pcol@output@imcpush#1#2{%
+ \@cons\pcol@colorstack{{#2}}%
+ \@cons\pcol@colorstack@mpushed{{#1}}}
+
\def\pcol@output@cpop{\begingroup
\let\reserved@a\pcol@colorstack
\gdef\pcol@colorstack{}\let\@elt\pcol@reset@color@elt
@@ -689,6 +1097,16 @@
\else \@cons\pcol@colorstack{{#1}}\def\reserved@b{\@elt{#2}}%
\fi
\reserved@b}
+\def\pcol@output@mcpop{\begingroup
+ \let\@elt\pcol@output@mcpop@elt \@tempswafalse
+ \pcol@colorstack@mpushed
+ \if@tempswa \global\let\@gtempa\pcol@output@cpop
+ \else \global\let\@gtempa\pcol@return@from@color
+ \fi
+ \endgroup
+ \@gtempa}
+\def\pcol@output@mcpop@elt#1{\ifnum#1=\@tempcnta \@tempswatrue \fi}
+
\def\pcol@output@cset{%
\expandafter\pcol@output@icset\pcol@colorstack@buf\@nil
\pcol@return@from@color}
@@ -696,6 +1114,7 @@
\expandafter\xdef\csname pcol@columncolor\number\pcol@currcol\endcsname{%
\@elt{#1}}%
\gdef\pcol@colorstack@buf{#2}}}
+
\def\pcol@return@from@color{\unvbox\@holdpg \@reinserts
\if@nobreak\nobreak \else\addpenalty\interlinepenalty \fi}
@@ -715,10 +1134,6 @@
\def\pcol@clearcolorstack{{\def\@elt##1{\reset@color}%
\pcol@colorstack@full}}
-\def\pcol@restorecst@restart{%
- \pcol@ifempty\@currbox
- \pcol@savecolorstack
- {\gdef\pcol@colorstack@saved{}\unvbox\@currbox \pcol@restorecolorstack}}
\def\pcol@restorecolorstack{\pcol@restorecst\pcol@colorstack@full}
\def\pcol@restorecst#1{{\let\@elt\pcol@set@color@elt#1}}
\def\pcol@set@color@elt#1{\def\current@color{#1}\let\aftergroup\@gobble
@@ -741,17 +1156,18 @@
\global\dimen#1\dimen\footins
\global\skip#1\skip\footins}{\def#1{\voidb@x}\pcol@ovf}}
-\def\pcol@shrinkcolbyfn#1{%
- \@tempdimb-\skip#1\relax
- \advance\@colht-\ht#1\advance\@colht-\dp#1\advance\@colht\@tempdimb}
+\def\pcol@shrinkcolbyfn#1#2#3{%
+ \ifx#3\relax\else #3-\skip#2\relax \fi
+ \advance#1-\ht#2\advance#1-\dp#2\advance#1-\skip#2\relax}
\def\pcol@unvbox@cclv#1{%
\@tempdima\dp\@cclv \unvbox\@cclv
\vskip \ifdim\@tempdima>\@maxdepth -\@maxdepth \else -\@tempdima \fi
\vskip\skip#1\@tempdima\skip#1\vskip-\@tempdima}
\def\pcol@deferredfootins#1{%
- \ifdim\@tempdimb=\z@ \@tempdimb-\skip\footins \fi
- \advance\@tempdimb\@colht\relax
+ \ifdim\@tempdimb=\z@ \@tempdimb\@colht \advance\@tempdimb-\skip\footins
+ \else \@tempdimb\@colht
+ \fi
\ifvoid\pcol@topfnotes\else \ifdim\@tempdimb>\z@
\begingroup
\splitmaxdepth\@maxdepth \splittopskip\z@ \vbadness\@M
@@ -781,14 +1197,165 @@
\unvbox#1\relax
\color@endgroup \vskip\z@}
+%% Special Output Routines: Marginal Notes
+
+\def\pcol@addmarginpar{%
+ \pcol@getcurrpage \@firstcolumntrue
+ \ifnum\pcol@currcol<\pcol@ncolleft
+ \let\reserved@a\z@ \let\reserved@b\pcol@ncolleft
+ \ifnum\pcol@mpthreshold@l>\pcol@currcol\else \@firstcolumnfalse \fi
+ \else
+ \let\reserved@a\pcol@ncolleft \let\reserved@b\pcol@ncol
+ \ifnum\pcol@mpthreshold@r>\pcol@currcol\else \@firstcolumnfalse \fi
+ \fi
+ \ifpcol@swapmarginpar
+ \ifodd\c@page\else
+ \if@firstcolumn \@firstcolumnfalse \else \@firstcolumntrue \fi
+ \fi
+ \ifpcol@paired\else \ifnum\pcol@currcol<\pcol@ncolleft\else
+ \if@firstcolumn \@firstcolumnfalse \else \@firstcolumntrue \fi
+ \fi\fi
+ \fi
+ \if@reversemargin
+ \if@firstcolumn \@firstcolumnfalse \else \@firstcolumntrue \fi
+ \fi
+ \pcol@swapcolumn\pcol@currcol\count@\reserved@a\reserved@b
+ \@tempdima\z@
+ \@tempcnta\reserved@a \@whilenum\@tempcnta<\count@\do{%
+ \pcol@swapcolumn\@tempcnta\@tempcntb\reserved@a\reserved@b
+ \advance\@tempdima\csname pcol@columnwidth\number\@tempcntb\endcsname\relax
+ \advance\@tempdima\csname pcol@columnsep\pcol@colsepid\endcsname\relax
+ \advance\@tempcnta\@ne}%
+ \if@firstcolumn \advance\marginparwidth\@tempdima
+ \else
+ \advance\marginparsep\textwidth \advance\marginparsep-\@tempdima
+ \advance\marginparsep-\columnwidth
+ \fi
+ \if@firstcolumn\let\pcol@marbox\@currbox \else\let\pcol@marbox\@marbox \fi
+ \@tempdima\@pageht \advance\@tempdima-\ht\pcol@marbox
+ \@tempdimb\ht\pcol@marbox \advance\@tempdimb\dp\pcol@marbox
+ \advance\@tempdimb\marginparpush
+ \pcol@getmparbottom\@tempdima\@tempdimb
+ \begingroup
+ \@tempcnta\pcol@page \advance\@tempcnta-\pcol@basepage
+ \edef\reserved@a{\pcol@pages\pcol@currpage}%
+ \global\let\pcol@pages\@empty \global\let\pcol@currpage\@empty
+ \let\@elt\pcol@setmpbelt \reserved@a
+ \endgroup
+ \pcol@@addmarginpar}
+
+\def\pcol@getmparbottom#1#2{%
+ \global\@mparbottom\z@
+ \ifx\pcol@mparbottom\@empty
+ \begingroup
+ \@tempdimc#2\relax \advance\@tempdimc#1\relax \let\@elt\relax
+ \xdef\pcol@mpblist{\@elt{\number#1}{\number\@tempdimc}}%
+ \endgroup
+ \else
+ \expandafter\pcol@getmparbottom@i\pcol@mparbottom
+ \begingroup
+ \@tempdima#1\relax \@tempdimb#2\relax \@tempswafalse
+ \let\@elt\pcol@getmpbelt \global\let\pcol@mpblist\@empty \reserved@a
+ \if@tempswa\else
+ \ifdim\@tempdima<\@mparbottom \@tempdima\@mparbottom \fi
+ \advance\@tempdimb\@tempdima
+ \@cons\pcol@mpblist{{\number\@tempdima}{\number\@tempdimb}}%
+ \fi
+ \endgroup
+ \fi}
+\def\pcol@getmparbottom@i#1#2#3#4{%
+ \ifnum\pcol@currcol<\pcol@ncolleft
+ \if@firstcolumn \def\reserved@a{#1}\else\def\reserved@a{#2}\fi
+ \else
+ \if@firstcolumn \def\reserved@a{#3}\else\def\reserved@a{#4}\fi
+ \fi}
+\def\pcol@getmpbelt#1#2{%
+ \ifdim#1sp<\@tempdima
+ \global\@mparbottom#2sp\relax \@cons\pcol@mpblist{{#1}{#2}}%
+ \else
+ \@tempdimc\@tempdima \advance\@tempdimc\@tempdimb
+ \ifdim#1sp<\@tempdimc
+ \@tempdima#2sp\relax \global\@mparbottom#2sp\relax
+ \@cons\pcol@mpblist{{#1}{#2}}%
+ \else
+ \@cons\pcol@mpblist{{\number\@tempdima}{\number\@tempdimc}\@elt{#1}{#2}}%
+ \@tempswatrue
+ \def\pcol@getmpbelt##1##2{\@cons\pcol@mpblist{{##1}{##2}}}
+ \fi
+ \fi}
+
+\def\pcol@setmpbelt#1#2#3#4#5{%
+ {\let\@elt\relax \xdef\pcol@pages{\pcol@pages\pcol@currpage}}%
+ \ifnum\@tempcnta=\z@
+ \def\reserved@a{#5}%
+ \ifx\reserved@a\@empty \pcol@setmpbelt@i{}{}{}{}\else \pcol@setmpbelt@i#5\fi
+ \pcol@defcurrpage{#1}{#2}{#3}{#4}{\reserved@a}%
+ \else \gdef\pcol@currpage{\@elt{#1}#2#3{#4}{#5}}%
+ \fi
+ \advance\@tempcnta\m@ne}
+\def\pcol@setmpbelt@i#1#2#3#4{%
+ \ifnum\pcol@currcol<\pcol@ncolleft
+ \if@firstcolumn \def\reserved@a{{\pcol@mpblist}{#2}{#3}{#4}}%
+ \else \def\reserved@a{{#1}{\pcol@mpblist}{#3}{#4}}%
+ \fi
+ \else
+ \if@firstcolumn \def\reserved@a{{#1}{#2}{\pcol@mpblist}{#4}}%
+ \else \def\reserved@a{{#1}{#2}{#3}{\pcol@mpblist}}%
+ \fi
+ \fi}
+
+\gdef\pcol@mparbottom@zero{{\@elt{0}{0}}{\@elt{0}{0}}{\@elt{0}{0}}{\@elt{0}{0}}}
+\global\let\pcol@mparbottom@out\pcol@mparbottom@zero
+
+\def\pcol@do@mpbout{\expandafter\pcol@do@mpbout@i\pcol@mparbottom@out}
+\def\pcol@do@mpbout@i#1#2#3#4{\@tempcnta\@ne
+ \if@mparswitch \ifodd\c@page\else \@tempcnta\m@ne \fi\fi
+ \if@reversemargin \@tempcnta-\@tempcnta \fi
+ \ifnum\@tempcnta<\z@
+ \pcol@do@mpbout@whole{\pcol@do@mpbout@elem#1}{#2}{#3}{#4}%
+ \else
+ \pcol@do@mpbout@whole{#1}{\pcol@do@mpbout@elem#2}{#3}{#4}%
+ \fi}
+
+\def\pcol@bias@mpbout#1{\def\reserved@a{\pcol@bias@mpbout@i{#1}}%
+ \pcol@do@mpb@all\pcol@mparbottom@out}
+\def\pcol@bias@mpbout@i#1\@elt#2#3\@nil{%
+ \dimen@#2sp\relax \advance\dimen@#1\relax
+ \dimen@ii#3sp\relax \advance\dimen@ii#1\relax
+ \def\reserved@b{\@elt{\number\dimen@}{\number\dimen@ii}}}
+
+\def\pcol@getmparbottom@last#1{%
+ \ifx\pcol@mparbottom\@empty
+ \global\let\pcol@mparbottom@out\pcol@mparbottom@zero
+ \pcol@bias@mpbout{#1}%
+ \else
+ \def\reserved@a{\pcol@getmparbottom@last@i{#1}}%
+ \pcol@do@mpb@all\pcol@mparbottom
+ \fi}
+\def\pcol@getmparbottom@last@i#1#2\@nil{%
+ \edef\reserved@b{\@elt{\number#1}{\number#1}}%
+ \def\@elt##1##2{\def\reserved@b{\@elt{##1}{##2}}}%
+ #2\let\@elt\relax}
+
+\def\pcol@do@mpb@all#1{\expandafter\pcol@do@mpb@all@i#1}
+\def\pcol@do@mpb@all@i#1#2#3#4{\begingroup \let\@elt\relax
+ \gdef\pcol@mparbottom@out{}%
+ \pcol@do@mpb@all@ii#1\@nil\pcol@do@mpb@all@ii#2\@nil
+ \pcol@do@mpb@all@ii#3\@nil\pcol@do@mpb@all@ii#4\@nil
+ \endgroup}
+\def\pcol@do@mpb@all@ii#1\@nil{%
+ \reserved@a#1\@nil
+ \xdef\pcol@mparbottom@out{\pcol@mparbottom@out{\reserved@b}}}
+
%% Special Output Routines: Synchronization
\def\pcol@sync{%
\pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do\pcol@flushcolumn
- \pcol@outputpage\@ne
+ \pcol@outputcolumns\@ne
\pcol@getcurrpinfo{\global\c@page}{\global\@colht}{\global\topskip}%
\@tempdima-\maxdimen \@tempdimb-\maxdimen \pcol@colht-\maxdimen
\@pageht-\maxdimen \@tempdimc\maxdimen \@pagedp\maxdimen \@tempcntb\z@
+ \pcol@dfloatsfalse
\pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do\pcol@measurecolumn
\@tempswatrue \global\pcol@flushfalse
\ifpcol@clear
@@ -805,7 +1372,15 @@
\advance\@tempdimb\ht\pcol@footins \advance\@tempdimb\dp\pcol@footins
\advance\@tempdimb\skip\pcol@footins
\fi\fi
- \ifdim\@tempdimb>\@colht
+ \dimen@\@tempdimb
+ \ifpcol@clear\else \ifdim\dimen@<\z@\else
+ \ifdim\@tempdimc=\maxdimen\else \ifdim\@tempdimc<\z@\else
+ \advance\dimen@-\@tempdimc
+ \fi\fi
+ \advance\dimen@\pcol@@ensurevspace
+ \ifdim\dimen@<\@tempdimb \dimen@\@tempdimb \fi
+ \fi\fi
+ \ifdim\dimen@>\@colht
\global\pcol@flushtrue \@tempswafalse \pcol@nextcol\@tempcntb
\fi
\ifdim\@tempdimb<\z@\else \if@tempswa
@@ -822,15 +1397,19 @@
\ifvoid\pcol@currfoot\else \@cons\@freelist\pcol@currfoot \fi
\pcol@getcurrfoot\box
\pcol@getcurrpage
- \ifvoid\pcol@footins\else
- \pcol@shrinkcolbyfn\pcol@footins
+ \ifvoid\pcol@footins
+ \ifdim\ht\@cclv>\@colht
+ \setbox\@cclv\vbox{\boxmaxdepth\@maxdepth \unvbox\@cclv \unskip}%
+ \fi
+ \else
+ \pcol@shrinkcolbyfn\@colht\pcol@footins\relax
\setbox\@cclv\vbox{\pcol@unvbox@cclv\pcol@footins}%
\fi
\pcol@Logstart{\pcol@flushcolumn(\number\c@page:\number\pcol@currcol)}
\ifdim\@toproom=\maxdimen
\setbox\@outputbox\pcol@makefcolpage \global\@toproom\z@
\else
- \pcol@@makecol
+ \pcol@@makecol\@maxdepth
\fi
\pcol@Logend\pcol@flushcolumn
\global\setbox\@currbox\box\@outputbox
@@ -840,7 +1419,9 @@
\ifx\@deferlist\@empty\else
\@whilenum\pcol@page<\pcol@toppage\do{%
\pcol@getcurrpage
- \ifvoid\pcol@footins\else \pcol@shrinkcolbyfn\pcol@footins \fi
+ \ifvoid\pcol@footins\else
+ \pcol@shrinkcolbyfn\@colht\pcol@footins\relax
+ \fi
\@makefcolumn\@deferlist
\if@fcolmade
\@next\@currbox\@freelist{\global\setbox\@currbox\box\@outputbox}%
@@ -854,7 +1435,7 @@
\@next\@currbox\@freelist{\global\setbox\@currbox\vbox{}}\pcol@ovf
\pcol@getcurrpinfo\@tempcnta{\global\@colht}\@tempskipa
\@pageht\@colht
- \ifvoid\pcol@footins\else \pcol@shrinkcolbyfn\pcol@footins \fi
+ \ifvoid\pcol@footins\else \pcol@shrinkcolbyfn\@colht\pcol@footins\relax \fi
\global\@colroom\@colht \pcol@floatplacement
\ifx\@deferlist\@empty\else
\ifpcol@clear
@@ -920,10 +1501,15 @@
\@pageht\dimen@ \@tempcntb\pcol@currcol
\fi\fi
\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
+ \ifpcol@bfbottom
+ \ifvoid\pcol@currfoot\else \dimen@ii\dp\pcol@currfoot \fi
+ \ifx\@botlist\@empty\else \dimen@ii\z@ \advance\dimen@\textfloatsep \fi
+ \else
+ \ifx\@botlist\@empty\else \dimen@ii\z@ \advance\dimen@\textfloatsep \fi
+ \ifvoid\pcol@currfoot\else \dimen@ii\dp\pcol@currfoot \fi
+ \fi
\pcol@measureupdate\pcol@colht\dimen@\@pagedp\dimen@ii
+ \ifx\@deferlist\@empty\else \pcol@dfloatstrue \fi
\advance\pcol@currcol\@ne}
\def\pcol@addflhd#1#2{%
\ifx#1\@empty\else
@@ -991,6 +1577,10 @@
\pcol@Logstart\pcol@output@flush
\setbox\@outputbox\vbox to\textheight{\boxmaxdepth\@maxdepth
\unvbox\@outputbox}%
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \setbox\pcol@rightpage\vbox to\textheight{\boxmaxdepth\@maxdepth
+ \unvbox\pcol@rightpage}%
+ \fi
\pcol@Logend\pcol@output@flush
\@outputpage
\pcol@freshpage}
@@ -1000,91 +1590,167 @@
\pcol@Logstart\pcol@output@clear
\setbox\@outputbox\vbox to\textheight{\boxmaxdepth\@maxdepth
\unvbox\@outputbox}%
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \setbox\pcol@rightpage\vbox to\textheight{\boxmaxdepth\@maxdepth
+ \unvbox\pcol@rightpage}%
+ \fi
\pcol@Logend\pcol@output@clear
\@outputpage
\pcol@flushfloats
\begingroup
+ \setbox\pcol@rightpage\box\voidb@x
\@dblfloatplacement
\@makefcolumn\@dbldeferlist
- \@whilesw\if@fcolmade\fi{\@outputpage \@makefcolumn\@dbldeferlist}%
+ \@whilesw\if@fcolmade\fi{%
+ \def\pcol@bg@floatheight{\pcol@bg@textheight}%
+ \setbox\@outputbox\vbox to\textheight{%
+ \pcol@bg@paintbox{Ff}\unvbox\@outputbox}%
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \setbox\pcol@rightpage\vbox to\textheight{\pcol@bg@paintbox{Ff}\vfil}%
+ \fi
+ \@outputpage
+ \@makefcolumn\@dbldeferlist}%
\endgroup
\pcol@freshpage}
\def\pcol@makeflushedpage#1{%
\pcol@cleartrue \pcol@output@switch \pcol@clearfalse
\pcol@getcurrpinfo{\global\c@page}{\global\@colht}\@tempskipa
- \global\@fcolmadefalse
- \setbox\@outputbox\vbox{%
- \ifpcol@nospan\else
- \unvbox\pcol@spanning
+ \ifpcol@lastpage \@tempswafalse \else \@tempswatrue \fi
+ \ifdim\pcol@colht=-\maxdimen\else \@tempswatrue \fi
+ \ifvoid\pcol@footins\else \@tempswatrue \fi
+ \begingroup
+ \ifpcol@nospan
+ \global\setbox\@outputbox\box\voidb@x
+ \global\setbox\pcol@rightpage\box\voidb@x
+ \else
+ \ifpcol@dfloats \@tempswatrue \fi
+ \let\@elt\relax
+ \edef\pcol@bg@floatheight{%
+ \@elt{\number\ht\pcol@spanning sp}\@elt{\number\dp\pcol@spanning sp}}%
+ \def\reserved@a{%
+ \ifpcol@firstpage\else \if@tempswa \pcol@bg@paintbox{Ff}\fi\fi}%
+ \@tempdima\ht\pcol@spanning \advance\@tempdima\dp\pcol@spanning
+ \global\setbox\@outputbox\vbox{%
+ \reserved@a \unvbox\pcol@spanning
+ \ifpcol@firstpage\else \if@tempswa\else \unskip \fi\fi}%
+ \global\setbox\@outputbox\vbox{\box\@outputbox}%
\@cons\@freelist\pcol@spanning
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \global\setbox\pcol@rightpage\vbox{%
+ \ifpcol@paired\else \advance\c@page\@ne \fi
+ \reserved@a \unvbox\pcol@rightpage}%
+ \global\ht\pcol@rightpage\ht\@outputbox
+ \global\dp\pcol@rightpage\dp\@outputbox
+ \global\setbox\pcol@rightpage\vbox{\box\pcol@rightpage}%
+ \fi
+ \advance\topmargin\@tempdima
\fi
- \ifdim#1=-\maxdimen
- \pcol@currcol\z@ \@whilenum\pcol@currcol<\pcol@ncol\do{%
- \pcol@getcurrcol
- \ifx\@deferlist\@empty\else \global\@fcolmadetrue \fi
- \advance\pcol@currcol\@ne}%
- \else
- \hb@xt@\textwidth{%
- \ifvoid\pcol@footins\else \pcol@shrinkcolbyfn\pcol@footins \fi
- \let\pcol@hfil\relax \@pageht\@colht \ifdim#1<\@colht \@colht#1\fi
- \@tempcntb\z@ \@whilenum\@tempcntb<\pcol@ncol\do{%
- \pcol@swapcolumn\@tempcntb\pcol@currcol
- \pcol@getcurrcol
- \ifx\@deferlist\@empty\else \global\@fcolmadetrue \fi
- \setbox\@cclv\box\@currbox
- \ifvoid\pcol@currfoot\else \@cons\@freelist\pcol@currfoot \fi
- \pcol@getcurrfoot\box
- \@tempswafalse
- \begingroup
- \ifdim\@toproom=\maxdimen
- \let\topfigrule\relax \ifdim\@colht=\@pageht \@tempswatrue \fi
- \fi
- \if@tempswa
- \pcol@Logstart{\pcol@makeflushedpage(1)}%
- \setbox\@outputbox\pcol@makefcolpage
- \pcol@Logend{\pcol@makeflushedpage(1)}%
- \else
- \pcol@Logstart{\pcol@makeflushedpage(2)}%
- \pcol@@makecol
- \pcol@Logend{\pcol@makeflushedpage(2)}%
- \fi
- \pcol@hfil \hb@xt@\columnwidth{\box\@outputbox\hss}%
- \endgroup
- \let\pcol@hfil\hfil
- \pcol@setcurrcolnf
- \advance\@tempcntb\@ne}}%
+ \global\pcol@firstpagefalse
+ \if@tempswa
+ \ifvoid\pcol@footins\else
+ \pcol@shrinkcolbyfn\@colht\pcol@footins\relax
+ \fi
+ \let\pcol@@hfil\relax \@pageht\@colht
+ \ifpcol@lastpage \ifpcol@dfloats
+ \ifdim\pcol@colht<\z@ \def\@textbottom{\vfil}\fi
+ \pcol@lastpagefalse
+ \fi\fi
+ \ifpcol@lastpage \ifdim#1<\@colht \@colht#1\fi\fi
+ \ifdim\@colht<\z@ \else
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \pcol@imakeflushedpage\pcol@ncolleft\pcol@ncol\pcol@rightpage
+ \fi
+ \pcol@imakeflushedpage\z@\pcol@ncolleft\@outputbox
+ \fi
\fi
+ \gdef\pcol@fnheight@lpage{0pt}%
\ifvoid\pcol@footins\else
- \@tempswatrue \ifpcol@mgfnote\ifpcol@lastpage \@tempswafalse \fi\fi
+ \@tempswatrue \ifpcol@lastpage \ifpcol@mgfnote \@tempswafalse \fi\fi
\if@tempswa
\pcol@Log\pcol@makeflushedpage{output}\pcol@footins
- \pcol@putfootins\pcol@footins
+ \@tempdima\ht\pcol@footins \advance\@tempdima\dp\pcol@footins
+ \xdef\pcol@fnheight@lpage{\number\@tempdima sp}%
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \global\setbox\pcol@rightpage\vbox{\unvbox\pcol@rightpage
+ \vskip\skip\pcol@footins \nointerlineskip
+ \pcol@phantom\pcol@footins \vskip\z@}%
+ \fi
+ \global\setbox\@outputbox\vbox{%
+ \unvbox\@outputbox \pcol@putfootins\pcol@footins}%
\@cons\@freelist\pcol@footins \gdef\pcol@footins{\voidb@x}%
- \ifpcol@lastpage \ifdim\pcol@colht=-\maxdimen
- \global\pcol@colht\z@
- \fi\fi
+ \ifdim\pcol@colht=-\maxdimen \global\pcol@colht\z@ \fi
\fi
- \fi}%
- }
+ \fi
+ \endgroup}
+
+\def\pcol@imakeflushedpage#1#2#3{\global\setbox#3\vbox{%
+ \ifpcol@paired\else\ifnum#1=\z@\else \advance\c@page\@ne \fi\fi
+ \ifvoid\pcol@footins\else \ifpcol@lastpage\else
+ \def\pcol@bg@footnoteheight{%
+ \@elt{\ht\pcol@footins}\@elt{\dp\pcol@footins}}%
+ \pcol@bg@paintbox{Nn}%
+ \fi\fi
+ \unvbox#3\nointerlineskip
+ \ifpcol@lastpage \pcol@buildcolseprule\@colht#1#2\z@
+ \else \pcol@buildcolseprule\@colht#1#2\@maxdepth
+ \fi
+ \unvbox\@tempboxa
+ \hb@xt@\textwidth{%
+ \@tempcntb#1\@whilenum\@tempcntb<#2\do{%
+ \pcol@swapcolumn\@tempcntb\pcol@currcol#1#2\relax
+ \pcol@getcurrcol
+ \setbox\@cclv\box\@currbox
+ \ifvoid\pcol@currfoot\else \@cons\@freelist\pcol@currfoot \fi
+ \pcol@getcurrfoot\box
+ \@tempswafalse
+ \begingroup
+ \ifdim\@toproom=\maxdimen
+ \let\topfigrule\relax \ifdim\@colht=\@pageht \@tempswatrue \fi
+ \fi
+ \if@tempswa
+ \pcol@Logstart{\pcol@makeflushedpage(1)}%
+ \setbox\@outputbox\pcol@makefcolpage
+ \pcol@Logend{\pcol@makeflushedpage(1)}%
+ \else
+ \pcol@Logstart{\pcol@makeflushedpage(2)}%
+ \ifpcol@lastpage \pcol@@makecol\z@ \else \pcol@@makecol\@maxdepth \fi
+ \pcol@Logend{\pcol@makeflushedpage(2)}%
+ \fi
+ \pcol@@hfil \hb@xt@\columnwidth{\box\@outputbox\hss}%
+ \endgroup
+ \edef\pcol@@hfil{\noexpand\pcol@hfil{\pcol@colsepid}}%
+ \pcol@setcurrcolnf
+ \advance\@tempcntb\@ne}}}}
\def\pcol@flushfloats{%
\global\@colht\textheight
\@whilesw\if@fcolmade\fi{%
- \setbox\@outputbox\vbox{\hb@xt@\textwidth{%
- \let\pcol@hfil\relax
- \@tempswafalse
- \@tempcntb\z@ \@whilenum\@tempcntb<\pcol@ncol\do{%
- \pcol@swapcolumn\@tempcntb\pcol@currcol
- \pcol@getcurrcol
- \@makefcolumn\@deferlist
- \pcol@hfil \hb@xt@\columnwidth{\if@fcolmade \box\@outputbox \fi \hss}%
- \ifx\@deferlist\@empty\else \@tempswatrue \fi
- \let\pcol@hfil\hfil
- \pcol@setcurrcolnf
- \advance\@tempcntb\@ne}%
- \if@tempswa \global\@fcolmadetrue \else \global\@fcolmadefalse \fi}}%
+ \global\@fcolmadefalse
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \pcol@iflushfloats\pcol@ncolleft\pcol@ncol\pcol@rightpage
+ \else
+ \setbox\pcol@rightpage\box\voidb@x
+ \fi
+ \pcol@iflushfloats\z@\pcol@ncolleft\@outputbox
\@outputpage}}
+\def\pcol@iflushfloats#1#2#3{\setbox#3\vbox{%
+ \ifpcol@paired\else\ifnum#1=\z@\else \advance\c@page\@ne \fi\fi
+ \pcol@buildcolseprule\@colht#1#2\@maxdepth \unvbox\@tempboxa
+ \hb@xt@\textwidth{%
+ \let\pcol@@hfil\relax
+ \if@fcolmade \@tempswatrue \else \@tempswafalse \fi
+ \@tempcntb#1\@whilenum\@tempcntb<#2\do{%
+ \pcol@swapcolumn\@tempcntb\pcol@currcol#1#2\relax
+ \pcol@getcurrcol
+ \@makefcolumn\@deferlist
+ \pcol@@hfil \hb@xt@\columnwidth{%
+ \if@fcolmade \box\@outputbox \else \vbox to\@colht{}\fi \hss}%
+ \ifx\@deferlist\@empty\else \@tempswatrue \fi
+ \edef\pcol@@hfil{\noexpand\pcol@hfil{\pcol@colsepid}}%
+ \pcol@setcurrcolnf
+ \advance\@tempcntb\@ne}%
+ \if@tempswa \global\@fcolmadetrue \else \global\@fcolmadefalse \fi}}}
\def\pcol@freshpage{%
\global\pcol@page\z@ \global\pcol@toppage\z@ \global\pcol@basepage\z@
@@ -1109,39 +1775,56 @@
\def\pcol@output@end{%
\pcol@Logstart\pcol@output@end
\pcol@makeflushedpage\pcol@colht
- \global\pcol@outputfalse \@tempswafalse
- \if@fcolmade
- \ifdim\pcol@colht>-\maxdimen \@tempswatrue \fi
- \ifpcol@nospan\else \@tempswatrue \fi
- \ifvoid\pcol@footins\else \@tempswatrue \fi
- \if@tempswa
- \pcol@Logstart{\pcol@output@end(1)}%
- \setbox\@outputbox\vbox to\textheight{\boxmaxdepth\@maxdepth
- \unvbox\@outputbox \vfil
- \ifvoid\pcol@footins\else
- \pcol@Log\pcol@output@end{output}\pcol@footins
- \pcol@putfootins\pcol@footins
- \@cons\@freelist\pcol@footins \gdef\pcol@footins{\voidb@x}%
+ \@tempdima\pcol@colht \ifdim\pcol@colht<\z@ \@tempdima\z@ \fi
+ \advance\@tempdima-\ht\@outputbox
+ \pcol@getmparbottom@last\@tempdima
+ \pcol@bias@mpbout{-\@tempdima}
+ \def\pcol@do@mpbout@whole##1##2##3##4{\setbox\@tempboxa\hbox{##1##2##3##4}}%
+ \def\pcol@do@mpbout@elem\@elt##1##2{\global\@mparbottom##2sp}%
+ \pcol@do@mpbout
+ \@tempswafalse
+ \ifpcol@dfloats
+ \ifvoid\@outputbox\else \@outputpage \fi
+ \global\@fcolmadetrue \pcol@flushfloats
+ \global\pcol@outputfalse
+ \@tempswatrue \@pagedp\@m\p@ \global\@mparbottom\z@
+ \global\let\pcol@mparbottom@out\pcol@mparbottom@zero
+ \else
+ \global\pcol@outputfalse
+ \ifdim\pcol@colht=-\maxdimen
+ \ifx\pcol@firstprevdepth\relax
+ \@tempswatrue \@pagedp\@m\p@ \global\@mparbottom\z@
+ \global\let\pcol@mparbottom@out\pcol@mparbottom@zero
+ \ifpcol@nospan\else
+ \@next\@currbox\@freelist{\global\setbox\@currbox\box\@outputbox}%
+ \pcol@ovf
+ \count\@currbox10\relax
+ {\let\@elt\relax \xdef\@dbldeferlist{\@elt\@currbox\@dbldeferlist}}%
+ \global\setbox\pcol@rightpage\box\voidb@x
+ \fi
+ \else \unvbox\@outputbox \@pagedp\pcol@firstprevdepth sp\relax
+ \fi
+ \else
+ \global\pcol@havelastpagetrue
+ \@tempdima\ht\@outputbox \advance\@tempdima\dp\@outputbox
+ \xdef\pcol@bg@preposttop@left{\number\@tempdima sp}%
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \global\let\pcol@bg@preposttop@right\pcol@bg@preposttop@left
+ \fi
+ \def\pcol@bg@textheight{\@elt{\ht\@outputbox}\@elt{\dp\@outputbox}}%
+ \def\reserved@a{%
+ \ifdim\pcol@fnheight@lpage>\z@
+ \def\pcol@bg@footnoteheight{\@elt\pcol@fnheight@lpage}%
+ \pcol@bg@paintbox{Nn}%
\fi}%
- \pcol@Logend{\pcol@output@end(1)}%
- \@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}}%
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \global\setbox\pcol@rightpage\vbox{%
+ \ifpcol@paired\else \advance\c@page\@ne \fi
+ \reserved@a \unvbox\pcol@rightpage}%
\fi
- \else \unvbox\@outputbox \@pagedp\pcol@firstprevdepth sp\relax
+ \topskip\z@ \vbox{\reserved@a \unvbox\@outputbox}%
\fi
- \else
- \topskip\z@ \box\@outputbox
- \fi\fi
+ \fi
\ifvoid\pcol@footins\else
\pcol@Log\pcol@output@end{insert}\pcol@footins
\insert\footins{\unvbox\pcol@footins}\@cons\@freelist\pcol@footins
@@ -1152,6 +1835,7 @@
\@whilenum\pcol@currcol<\pcol@ncol\do{%
\pcol@getcurrcol \@cons\@freelist\@currbox
\advance\pcol@currcol\@ne}%
+ \pcol@currcol\pcol@lastcol\relax \pcol@getcurrcol
\global\pcol@prevdepth\@pagedp
\global\@colht\textheight
\global\@colroom\textheight
@@ -1177,8 +1861,26 @@
\hsize\columnwidth
\pcol@Logend{\pcol@invokeoutput{#1}}}
-\def\paracol#1{\par
- \global\pcol@ncol#1\relax
+\def\paracol{\global\pcol@pairedtrue \@ifnextchar[%]
+ \pcol@yparacol\pcol@xparacol}
+\def\pcol@xparacol#1{\pcol@zparacol[#1]{#1}}
+\def\pcol@yparacol[#1]{%
+ \@ifstar{\global\pcol@pairedfalse \pcol@zparacol[#1]}%
+ {\pcol@zparacol[#1]}}
+\def\pcol@zparacol[#1]#2{\par
+ \global\pcol@ncolleft#1\relax \global\pcol@ncol#2\relax
+ \ifnum\pcol@ncolleft>\pcol@ncol \global\pcol@ncolleft\pcol@ncol \fi
+ \ifnum\pcol@ncolleft<\pcol@ncol\else \global\pcol@pairedtrue \fi
+ \ifpcol@paired\else \pcol@swapcolumnfalse \fi
+ \if@newlist
+ \if@nobreak \@nbitem
+ \else
+ \addpenalty\@beginparpenalty
+ \addvspace\@topsep
+ \addvspace{-\parskip}\addvspace{-\itemsep}%
+ \fi
+ \global\@newlistfalse
+ \fi
\global\let\pcol@counters\cl@@ckpt
\let\@elt\pcol@remctrelt \pcol@gcounters
\let\@elt\pcol@thectrelt \pcol@counters
@@ -1188,17 +1890,23 @@
\pcol@synccounter\@gtempa
\endgroup
\global\@twocolumntrue \col@number\@ne
- \pcol@swapcolumn\z@\@tempcntb
- \ifnum\@tempcntb=\z@ \global\@firstcolumntrue \else \global\@firstcolumnfalse
+ \pcol@setcolumnwidth\z@\pcol@ncolleft
+ \pcol@columnratioleft\pcol@colwidthspecleft
+ \ifnum\pcol@ncolleft<\pcol@ncol
+ \pcol@setcolumnwidth\pcol@ncolleft\pcol@ncol
+ \pcol@columnratioright\pcol@colwidthspecright
\fi
- \pcol@setcolumnwidth
\pcol@lrmargin\textwidth \advance\pcol@lrmargin-\linewidth
\global\pcol@topskip\topskip
\global\pcol@textfloatsep\maxdimen
\pcol@lastpagefalse \xdef\pcol@firstprevdepth{\number\prevdepth}%
\let\pcol@@combinefloats\@combinefloats \let\@combinefloats\pcol@combinefloats
- \let\pcol@set@color\set@color
- \ifx\set@color\relax\else
+ \let\pcol@@addmarginpar\@addmarginpar \let\@addmarginpar\pcol@addmarginpar
+ \global\let\pcol@set@color\set@color
+ \ifx\set@color\relax
+ \let\pcol@bg@paintpage\relax \let\pcol@bg@paintbox\@gobble
+ \let\pcol@bg@paintcolumns\relax
+ \else
\let\set@color\pcol@set@color@push
\pcol@innerfalse
\global\pcol@everyvbox{\pcol@dummytoken}%
@@ -1206,6 +1914,9 @@
\everyvbox{\the\pcol@everyvbox \pcol@innertrue}
\let\everyvbox\pcol@everyvbox
\aftergroup\pcol@restoreeveryvbox
+ \let\pcol@bg@paintpage\pcol@bg@@paintpage
+ \let\pcol@bg@paintbox\pcol@bg@@paintbox
+ \let\pcol@bg@paintcolumns\pcol@bg@@paintcolumns
\fi
\gdef\pcol@colorstack{}%
\gdef\pcol@colorstack@buf{}\gdef\pcol@colorstack@shadow{}%
@@ -1217,8 +1928,10 @@
\def\footnoterule{{\columnwidth\textwidth \pcol@footnoterule}}%
\fi
\let\@footnotetext\pcol@fntext
+ \def\pcol@twosided[#1]{\pcol@ignore\twosided}%
\def\swapcolumninevenpages{\pcol@ignore\swapcolumninevenpages}%
\def\noswapcolumninevenpages{\pcol@ignore\noswapcolumninevenpages}%
+ \def\footnotelayout#1{\pcol@ignore\footnotelayout}%
\def\multicolumnfootnotes{\pcol@ignore\multicolumnfootnotes}%
\def\singlecolumnfootnotes{\pcol@ignore\singlecolumnfootnotes}%
\def\mergedfootnotes{\pcol@ignore\mergedfootnotes}%
@@ -1228,7 +1941,7 @@
\global\let\pcol@com@column\pcol@defcolumn
\global\@namedef{pcol@com@column*}{\pcol@defcolumn
\@ifnextchar[%]
- \pcol@mctext\relax}%
+ \pcol@sptext\relax}%
\def\paracol##1{\PackageError{paracol}{%
Environment paracol cannot be nested.}\@eha}%
\output{\pcol@output}%
@@ -1236,31 +1949,10 @@
\pcol@invokeoutput\pcol@op@start
\pcol@nextcol\z@
\@ifnextchar[%]
- \pcol@mctext\relax}
+ \pcol@sptext\relax}
\let\pcol@paracol\paracol
-\def\columnratio{\gdef\pcol@columnratio}
-\columnratio{}
-\def\pcol@setcolumnwidth{
- \@tempcntb\pcol@ncol \advance\@tempcntb\m@ne
- \@tempdima-\columnsep \multiply\@tempdima\@tempcntb
- \advance\@tempdima\textwidth \@tempdimb\@tempdima
- \@tempcnta\z@
- \@for\reserved@a:=\pcol@columnratio\do{%
- \ifnum\@tempcnta<\@tempcntb
- \@tempdimc\reserved@a\@tempdima
- \expandafter\edef\csname pcol@columnwidth\number\@tempcnta\endcsname{%
- \number\@tempdimc sp}%
- \advance\@tempdimb-\@tempdimc
- \advance\@tempcnta\@ne
- \fi}%
- \@tempcntb\pcol@ncol \advance\@tempcntb-\@tempcnta
- \divide\@tempdimb\@tempcntb
- \@whilenum\@tempcnta<\pcol@ncol\do{%
- \expandafter\edef\csname pcol@columnwidth\number\@tempcnta\endcsname{%
- \number\@tempdimb sp}%
- \advance\@tempcnta\@ne}%
-}
+\def\thecolumn{\number\pcol@currcol}
\def\pcol@ignore#1{\PackageWarning{paracol}{The command \string#1 is not
effective in paracol environment and thus ignored}}
@@ -1272,12 +1964,170 @@
\@elt{leftcolumn}\@elt{endleftcolumn}\@elt{leftcolumn*}\@elt{endleftcolumn*}%
\@elt{rightcolumn}\@elt{endrightcolumn}%
\@elt{rightcolumn*}\@elt{endrightcolumn*}%
- \@elt{flushpage}\@elt{clearpage}%
+ \@elt{flushpage}\@elt{clearpage}\@elt{cleardoublepage}%
\@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}
+%% Column Width Setting
+
+\def\columnratio#1{\global\let\pcol@colwidthspecleft\relax
+ \gdef\pcol@columnratioleft{#1}%
+ \@ifnextchar[%]
+ \pcol@icolumnratio{\gdef\pcol@columnratioright{#1}}}
+\def\pcol@icolumnratio[#1]{\gdef\pcol@columnratioright{#1}}
+\columnratio{}\relax
+
+\def\setcolumnwidth#1{\global\let\pcol@columnratioleft\relax
+ \gdef\pcol@colwidthspecleft{#1}%
+ \@ifnextchar[%]
+ \pcol@isetcolumnwidth{\gdef\pcol@colwidthspecright{#1}}}
+\def\pcol@isetcolumnwidth[#1]{\gdef\pcol@colwidthspecright{#1}}
+
+\def\pcol@setcolumnwidth{%
+ \ifx\pcol@columnratioleft\relax \let\reserved@a\pcol@setcolwidth@s
+ \else \let\reserved@a\pcol@setcolwidth@r
+ \fi
+ \reserved@a}
+
+\def\pcol@setcolwidth@r#1#2#3#4{%
+ \@tempcntb#2\advance\@tempcntb-#1\advance\@tempcntb\m@ne
+ \@tempdima-\columnsep \multiply\@tempdima\@tempcntb
+ \advance\@tempdima\textwidth \@tempdimb\@tempdima
+ \@tempcnta#1\relax\@tempcntb#2\advance\@tempcntb\m@ne
+ \@for\reserved@a:=#3\do{%
+ \ifnum\@tempcnta<\@tempcntb
+ \@tempdimc\reserved@a\@tempdima
+ \expandafter\xdef\csname pcol@columnwidth\number\@tempcnta\endcsname{%
+ \number\@tempdimc sp}%
+ \global\@namedef{pcol@columnsep\number\@tempcnta}{\columnsep}%
+ \advance\@tempdimb-\@tempdimc
+ \advance\@tempcnta\@ne
+ \fi}%
+ \@tempcntb#2\advance\@tempcntb-\@tempcnta
+ \divide\@tempdimb\@tempcntb
+ \@whilenum\@tempcnta<#2\do{%
+ \expandafter\xdef\csname pcol@columnwidth\number\@tempcnta\endcsname{%
+ \number\@tempdimb sp}%
+ \global\@namedef{pcol@columnsep\number\@tempcnta}{\columnsep}%
+ \advance\@tempcnta\@ne}%
+}
+
+\def\pcol@setcolwidth@s#1#2#3#4{\begingroup
+ \dimen@\z@ \dimen@ii\z@ \def\pcol@setcw@filunit{\@ne\p@}%
+ \let\pcol@setcw@c\pcol@setcw@accumwd \let\pcol@setcw@s\pcol@setcw@accumwd
+ \pcol@setcw@scan#1#2{#4}%
+ \advance\dimen@-\@tempdima \advance\dimen@ii-\@tempdimb
+ \pcol@setcw@calcfactors
+ \def\pcol@setcw@c{\pcol@setcw@set{width}}%
+ \def\pcol@setcw@s{\pcol@setcw@set{sep}}%
+ \let\pcol@setcw@filunit\dimen@ii
+ \pcol@setcw@scan#1#2{#4}%
+ \endgroup}
+\def\pcol@setcw@scan#1#2#3{\def\reserved@a{#3}%
+ \@tempcnta#1\relax \@whilenum\@tempcnta<#2\do{
+ \edef\reserved@a{\reserved@a,}\advance\@tempcnta\@ne}%
+ \@tempcnta#1\relax
+ \expandafter\@for\expandafter\reserved@a\expandafter:\expandafter=\reserved@a
+ \do{%
+ \ifnum\@tempcnta<#2\relax
+ \expandafter\pcol@setcw@getspec\reserved@a//\@nil
+ \fi
+ \advance\@tempcnta\@ne}}
+\def\pcol@setcw@getspec#1/#2/#3\@nil{%
+ \pcol@setcw@getspec@i\fill{#1}\pcol@setcw@c
+ \pcol@setcw@getspec@i\columnsep{#2}\pcol@setcw@s}
+\def\pcol@setcw@getspec@i#1#2{%
+ \def\reserved@a{}%
+ \@tfor\reserved@b:=#2\do{\edef\reserved@a{\reserved@a\reserved@b}}
+ \ifx\reserved@a\@empty \let\reserved@a#1\fi
+ \let\@gtempa\relax
+ {\def\fill{1\p@\gdef\@gtempa{}}\@tempskipa\reserved@a}%
+ \ifx\@gtempa\relax \@tempskipa\reserved@a\relax
+ \else \expandafter\pcol@setcw@fill\reserved@a
+ \fi
+ \@tempdima\@tempskipa
+ \advance\@tempskipa0\p@\@plus\@m\p@\@minus\@m\p@\relax
+ \expandafter\pcol@extract@fil\the\@tempskipa\@nil}
+\def\pcol@setcw@fill#1\fill{\def\reserved@b{#1}%
+ \ifx\reserved@b\@empty \let\reserved@b\@ne \fi
+ \@tempskipa0\p@\@plus\reserved@b fil\relax}
+
+\def\pcol@setcw@accumwd{\advance\dimen@\@tempdima \advance\dimen@ii\@tempdimb}
+\def\pcol@setcw@set#1{%
+ \@tempdima\pcol@setcw@scale\@tempdima \advance\@tempdima\@tempdimb
+ \expandafter\xdef\csname pcol@column#1\number\@tempcnta\endcsname{%
+ \number\@tempdima sp}}
+
+\def\pcol@setcw@calcfactors{%
+ \ifdim\dimen@=\textwidth \def\pcol@setcw@scale{}\dimen@ii\z@
+ \else
+ \pcol@setcw@calcf\textwidth\dimen@\pcol@setcw@scale
+ \ifdim\dimen@<\textwidth \ifdim\dimen@ii>\z@
+ \def\pcol@setcw@scale{}%
+ \@tempdimc\textwidth \advance\@tempdimc-\dimen@
+ \pcol@setcw@calcf\@tempdimc\dimen@ii\reserved@a \dimen@ii\@tempdimb
+ \else \dimen@ii\z@ \fi
+ \else \dimen@ii\z@ \fi
+ \fi}
+\def\pcol@setcw@calcf#1#2#3{%
+ \@tempdimb#1\@tempdima#2\@tempcnta\z@
+ \ifdim\@tempdima=\z@ \@tempdima1sp\relax\fi
+ \@whiledim\@tempdimb<8192\p@\do{%
+ \multiply\@tempdimb\tw@ \advance\@tempcnta\@ne}%
+ \@tempdimc\@tempdima
+ \@whiledim\@tempdima=\@tempdimc\do{%
+ \divide\@tempdimc\tw@ \multiply\@tempdimc\tw@
+ \ifdim\@tempdima=\@tempdimc
+ \divide\@tempdima\tw@ \divide\@tempdimc\tw@ \advance\@tempcnta\@ne
+ \fi}
+ \advance\@tempdima-1sp\relax
+ \@whilenum\@tempdima>32768\do{\divide\@tempdima\tw@ \advance\@tempcnta\@ne}%
+ \advance\@tempdima1sp\relax
+ \divide\@tempdimb\@tempdima \@tempdimc\@tempdimb \@tempcntb\@tempcnta
+ \@whilenum\@tempcntb>\z@\do{\divide\@tempdimc\tw@ \advance\@tempcntb\m@ne}
+ \ifnum\@tempdimc>16383\relax
+ \PackageError{%
+ Scaling/filling factor for column/gap width is too large.}\@eha
+ \@tempdimb\@M\p@
+ \else
+ \@tempcntb\sixt@@n \advance\@tempcntb-\@tempcnta
+ \ifnum\@tempcntb<\z@
+ \@whilenum\@tempcntb<\z@\do{\divide\@tempdimb\tw@ \advance\@tempcntb\@ne}%
+ \else
+ \@whilenum\@tempcntb>\z@\do{%
+ \multiply\@tempdimb\tw@ \advance\@tempcntb\m@ne}%
+ \fi
+ \fi
+ \expandafter\pcol@extract@pt\the\@tempdimb#3}
+
+\@tempskipa 1\p@\@plus1fil\@minus1fil\relax
+\def\pcol@defkw1.0#1 #2 1.0#3 #4 1.0#5\@nil{%
+ \def\pcol@kw@pt{#1}\def\pcol@kw@plus{#2}\def\pcol@kw@fil{#3}%
+ \def\pcol@kw@minus{#4}}
+\expandafter\pcol@defkw\the\@tempskipa\@nil
+
+\edef\pcol@def@extract@fil{%
+ \def\noexpand\pcol@extract@fil
+ ##1\space\pcol@kw@plus\space##2\space\pcol@kw@minus##3\noexpand\@nil{%
+ \noexpand\pcol@extract@fil@i##2\noexpand\@nil}}
+\pcol@def@extract@fil
+\def\pcol@extract@fil@i#1.#2\@nil{\def\reserved@a{#1.#2}%
+ \afterassignment\pcol@extract@fil@ii\count@#2\@nil}
+\def\pcol@extract@fil@ii#1\@nil{\def\reserved@b{#1}%
+ \ifx\reserved@b\pcol@kw@pt \@tempdimb\z@
+ \else \expandafter\pcol@extract@fil@iii\reserved@a\@nil
+ \fi}
+\edef\pcol@def@extract@fil@iii{%
+ \def\noexpand\pcol@extract@fil@iii##1\pcol@kw@fil##2\noexpand\@nil{%
+ \@tempdimb\noexpand\pcol@setcw@filunit\relax \@tempdimb##1\@tempdimb}}
+\pcol@def@extract@fil@iii
+
+\edef\pcol@def@extract@pt{%
+ \def\noexpand\pcol@extract@pt##1\pcol@kw@pt##2{\def##2{##1}}}
+\pcol@def@extract@pt
+
%% Counter Operations
\def\globalcounter#1{{%
@@ -1386,25 +2236,27 @@
\ifnum#1<\pcol@ncol\else \@tempswatrue \fi
\if@tempswa
\PackageError{paracol}{%
- Column number \number#1 must be less than\number\pcol@ncol}\@eha
+ Column number \number#1 must be less than \number\pcol@ncol}\@eha
\pcol@nextcol\z@
\fi
\@ifstar\pcol@iswitchcolumn\pcol@switchcol}
\def\pcol@iswitchcolumn{%
\global\pcol@synctrue
\@ifnextchar[%]
- \pcol@mctext\pcol@switchcol}
+ \pcol@sptext\pcol@switchcol}
-\long\def\pcol@mctext[#1]{%
+\long\def\pcol@sptext[#1]{%
\@tempcnta\pcol@nextcol
- \global\pcol@synctrue \pcol@swapcolumn\z@\pcol@nextcol
+ \global\pcol@synctrue \pcol@nextcol\z@
+ \global\pcol@sptextstarttrue
\pcol@switchcol
+ \global\pcol@sptextstartfalse \global\pcol@sptexttrue
\begingroup
\columnwidth\textwidth \hsize\columnwidth
\linewidth\columnwidth \advance\linewidth-\pcol@lrmargin
\ifdim\pcol@lrmargin>\z@ \parshape\@ne\@totalleftmargin\linewidth \fi
\col@number\@ne #1\pcol@par
- \global\pcol@mctexttrue
+ \global\let\@svsechd\@svsechd \global\let\@svsec\@svsec
\expandafter\global\expandafter\everypar\expandafter{\the\everypar}%
\endgroup
\pcol@nextcol\@tempcnta \global\pcol@synctrue \pcol@switchcol}
@@ -1412,22 +2264,21 @@
\def\pcol@switchcol{%
\pcol@savecounters
\ifpcol@sync
+ \@tempdima\pcol@ensurevspace\relax
+ \edef\pcol@@ensurevspace{\number\@tempdima sp\relax}%
\global\pcol@syncfalse \pcol@visitallcols\@@par \global\pcol@synctrue
\pcol@invokeoutput\pcol@op@switch
\@whilesw\ifpcol@flush\fi{%
\vfil \penalty-\@M
\global\pcol@syncfalse \pcol@visitallcols\newpage \global\pcol@synctrue
\pcol@invokeoutput\pcol@op@switch}%
+ \ensurevspace{\baselineskip}%
\else
\pcol@invokeoutput\pcol@op@switch
\fi
- \pcol@swapcolumn\pcol@currcol\@tempcntb
- \ifnum\@tempcntb=\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}
+ \let\@elt\pcol@aconlyelt \pcol@aconly \let\@elt\relax}
\def\pcol@visitallcols#1{\begingroup
\@tempcnta\z@ \@tempcntb\pcol@currcol
@@ -1452,7 +2303,7 @@
\def\pcol@switchenv#1{\let\reserved@a\switchcolumn
\def\switchcolumn{\PackageError{paracol}{%
- Column swicthing commands and environments cannot be used in #1}\@eha}
+ Column switching commands and environments cannot be used in #1}\@eha}
\reserved@a}
\def\pcol@com@endcolumn{\pcol@par
@@ -1465,6 +2316,9 @@
\let\pcol@com@endrightcolumn\pcol@com@endcolumn
\expandafter\let\csname pcol@com@endrightcolumn*\endcsname\pcol@com@endcolumn
+\def\ensurevspace#1{{\@tempdima#1\relax \gdef\pcol@ensurevspace{#1}}}
+\ensurevspace{\baselineskip}
+
%% Disabling \addcontentsline
\def\addcontentsonly#1#2{%
@@ -1509,6 +2363,9 @@
\pcol@invokeoutput\pcol@op@flush}
\def\pcol@com@clearpage{\pcol@flushclear\voidb@x
\pcol@invokeoutput\pcol@op@clear}
+\def\pcol@com@cleardoublepage{\pcol@com@clearpage
+ \if@twoside \ifodd\c@page\else \ifpcol@paired\else \pcol@com@flushpage
+ \fi\fi\fi}
\def\pcol@flushclear#1{\pcol@par
\pcol@nextcol\pcol@currcol
\pcol@visitallcols\@@par
@@ -1525,11 +2382,18 @@
%% Commands for Footnotes
-\def\multicolumnfootnotes{\global\pcol@scfnotefalse \global\pcol@mgfnotefalse
+\def\footnotelayout#1{\@ifundefined{pcol@fnlayout@#1}%
+ {\PackageError{paracol}{Unknown footnote layout specifier #1}}%
+ {\@nameuse{pcol@fnlayout@#1}}}
+\def\pcol@fnlayout@c{\global\pcol@scfnotefalse \global\pcol@mgfnotefalse
\localcounter{footnote}\nofncounteradjustment}
-\def\singlecolumnfootnotes{\global\pcol@scfnotetrue \global\pcol@mgfnotefalse
+\def\pcol@fnlayout@p{\global\pcol@scfnotetrue \global\pcol@mgfnotefalse
\globalcounter{footnote}\fncounteradjustment}
-\def\mergedfootnotes{\singlecolumnfootnotes \global\pcol@mgfnotetrue}
+\def\pcol@fnlayout@m{\pcol@fnlayout@p\global\pcol@mgfnotetrue}
+
+\let\multicolumnfootnotes\pcol@fnlayout@c
+\let\singlecolumnfootnotes\pcol@fnlayout@p
+\let\mergedfootnotes\pcol@fnlayout@m
\def\pcol@fntext{%
\let\reserved@a\pcol@fntexttop
@@ -1597,19 +2461,249 @@
%% Column Swapping
+\def\twosided{\@ifnextchar[%]
+ {\pcol@twosided}{\pcol@twosided[pcmb]}}
+\def\pcol@twosided[#1]{%
+ \global\@twosidefalse \global\pcol@swapcolumnfalse
+ \global\pcol@swapmarginparfalse \global\pcol@bg@swapfalse
+ \@tfor\reserved@a:=#1\do{%
+ \@ifundefined{pcol@twosided@\reserved@a}%
+ {\PackageError{paracol}{Unknown two-siding feature \reserved@a}}%
+ {\@nameuse{pcol@twosided@\reserved@a}}}}
+\def\pcol@twosided@p{\global\@twosidetrue}
+\def\pcol@twosided@c{\global\pcol@swapcolumntrue}
+\def\pcol@twosided@m{\global\pcol@swapmarginpartrue}
+\def\pcol@twosided@b{\global\pcol@bg@swaptrue}
+
\def\swapcolumninevenpages{\global\pcol@swapcolumntrue}
\def\noswapcolumninevenpages{\global\pcol@swapcolumnfalse}
-\def\pcol@swapcolumn#1#2{%
+
+\def\pcol@swapcolumn#1#2#3#4{%
+ \edef\pcol@colsepid{\number#1}%
\ifpcol@swapcolumn
\ifodd\c@page\relax #2#1\relax
- \else #2\pcol@ncol \advance#2-#1\relax \advance#2\m@ne
+ \else
+ #2#4\relax \advance#2-#1\relax \advance#2#3\relax \advance#2-\tw@
+ \edef\pcol@colsepid{\number#2}%
+ \advance#2\@ne
\fi
\else #2#1\relax
\fi}
+\def\marginparthreshold#1{\@tempcnta#1\relax
+ \xdef\pcol@mpthreshold@l{\number\@tempcnta}%
+ \@ifnextchar[%]
+ \pcol@marginparthreshold{\xdef\pcol@mpthreshold@r{\number\@tempcnta}}}
+\def\pcol@marginparthreshold[#1]{\@tempcnta#1\relax
+ \xdef\pcol@mpthreshold@r{\number\@tempcnta}}
+\marginparthreshold{1}
+
+%% Commands for Text Coloring
+
+\def\columncolor{\def\pcol@colorcommand{\string\columncolor}%
+ \@ifnextchar[%]
+ \pcol@xcolumncolor\pcol@ycolumncolor}
+\def\pcol@xcolumncolor[#1]#2{\pcol@columncolor{\color[#1]{#2}}}
+\def\pcol@ycolumncolor#1{\pcol@columncolor{\color{#1}}}
+\def\pcol@columncolor#1{\@ifnextchar[%]
+ {\pcol@icolumncolor{#1}}{\pcol@icolumncolor{#1}[\number\pcol@currcol]}}
+\def\normalcolumncolor{\def\pcol@colorcommand{\string\normalcolumncolor}%
+ \@ifnextchar[%]
+ {\pcol@icolumncolor\normalcolor}%
+ {\pcol@icolumncolor\normalcolor[\number\pcol@currcol]}}
+\def\pcol@icolumncolor#1[#2]{%
+ \@tempswafalse
+ \ifpcol@inner \@tempswatrue \fi
+ \ifinner \@tempswatrue \fi
+ \ifmmode \@tempswatrue \fi
+ \ifx\set@color\relax
+ \PackageWarning{paracol}{\pcol@colorcommand\space is not effective
+ without some coloring package}%
+ \else\if@tempswa
+ \PackageWarning{paracol}{\pcol@colorcommand\space is not effective
+ when not in outer par mode}%
+ \else
+ \begingroup
+ \let\@elt\relax
+ \ifx\pcol@paracol\paracol
+ \pcol@iicolumncolor{#1}{pcol@columncolor#2}{}%
+ \pcol@iicolumncolor{#1}{pcol@columncolor@shadow#2}{}%
+ \else\ifnum#2=\pcol@currcol
+ \begingroup
+ \pcol@getshadowcc{#2}\let\pcol@colorstack\pcol@colorstack@shadow
+ \pcol@clearcolorstack
+ \pcol@iicolumncolor{#1}{pcol@colorstack@buf}{\pcol@colorstack@buf}%
+ \pcol@iicolumncolor{#1}{pcol@columncolor@shadow#2}{}%
+ \pcol@getshadowcc{#2}\pcol@restorecolorstack
+ \endgroup
+ \pcol@color@invokeoutput\pcol@op@cset\relax
+ \else
+ \pcol@iicolumncolor{#1}{pcol@columncolor#2}{}%
+ \pcol@iicolumncolor{#1}{pcol@columncolor@shadow#2}{}%
+ \fi\fi
+ \endgroup
+ \fi\fi
+ \ignorespaces}
+\def\pcol@iicolumncolor#1#2#3{\let\set@color\relax #1%
+ \expandafter\xdef\csname#2\endcsname{#3\@elt{\current@color}}}
+\def\pcol@getshadowcc#1{%
+ \expandafter\let\expandafter\reserved@a
+ \csname pcol@columncolor@shadow#1\endcsname
+ \expandafter\let\csname pcol@columncolor#1\endcsname\reserved@a}
+
+\def\pcol@set@color@push{\pcol@set@color
+ \ifmmode\ifpcol@inner\else
+ \ifnum\pcol@mcid=\z@ \gdef\pcol@colorstack@mpushed{}\fi
+ \ifnum\pcol@mcid<\pcol@mcpushlimit\relax
+ \expandafter\aftergroup
+ \csname pcol@reset@color@mpop@\number\pcol@mcid\endcsname
+ \expandafter\xdef
+ \csname pcol@reset@color@mpop@\number\pcol@mcid\endcsname
+ {\noexpand\pcol@reset@color@mpop
+ {\number\pcol@mcid}{\current@color}}%
+ \@tempcnta-\pcol@op@mcpush\relax \advance\@tempcnta-\pcol@mcid
+ \pcol@color@invokeoutput\@tempcnta\relax
+ \global\advance\pcol@mcid\@ne
+ \else
+ \PackageError{paracol}{Too many coloring commands in math mode}\@ehb
+ \fi\fi
+ \else
+ \ifinner \pcol@innertrue \fi
+ \ifpcol@inner\else
+ \aftergroup\pcol@reset@color@pop
+ \let\pcol@elt@save\@elt \let\@elt\relax
+ \edef\pcol@colorstack@shadow{\pcol@colorstack@shadow
+ \@elt{\current@color}}%
+ \let\@elt\pcol@elt@save
+ \@cons\pcol@colorstack@buf{{\current@color}}%
+ \pcol@color@invokeoutput\pcol@op@cpush\pcol@fcwhyphenate
+ \fi
+ \fi}
+
+\def\pcol@reset@color@pop{\ifpcol@output
+ \pcol@color@invokeoutput\pcol@op@cpop\relax \fi}
+\def\pcol@reset@color@mpop#1#2{\@tempcnta-\pcol@op@mcpop\relax
+ \advance\@tempcnta-#1\relax
+ \pcol@color@invokeoutput\@tempcnta\relax}
+
+\def\pcol@color@invokeoutput#1#2{%
+ \ifvmode \pcol@color@invokeoutput@v{#1}%
+ \else \vadjust{\pcol@color@invokeoutput@v{#1}}\ifhmode #2\fi
+ \fi}
+\def\pcol@color@invokeoutput@v#1{\penalty-\@Miv \@tempdima\prevdepth
+ \vbox{}\prevdepth\@tempdima \penalty#1\relax}
+
+\def\coloredwordhyphenated{\def\pcol@fcwhyphenate{\hskip\z@}}
+\def\nocoloredwordhyphenated{\let\pcol@fcwhyphenate\relax}
+\coloredwordhyphenated
+
+%% Commands for Column-Separating Rule Color and Background Painting
+
+\def\colseprulecolor{\def\pcol@colorcommand{\string\colseprulecolor}%
+ \@ifnextchar[%]
+ \pcol@defcseprulecolor@x\pcol@defcseprulecolor@y}
+\def\pcol@defcseprulecolor@x[#1]#2{\pcol@defcseprulecolor{\color[#1]{#2}}}
+\def\pcol@defcseprulecolor@y#1{\pcol@defcseprulecolor{\color{#1}}}
+\def\pcol@defcseprulecolor#1{\@ifnextchar[%]
+ {\pcol@defcseprulecolor@i{#1}}{\pcol@defcseprulecolor@i{#1}[]}}
+\def\normalcolseprulecolor{%
+ \def\pcol@colorcommand{\string\normalcolseprulecolor}%
+ \@ifnextchar[%]
+ {\pcol@defcseprulecolor@i\normalcolor}%
+ {\pcol@defcseprulecolor@i\normalcolor[]}}
+\def\pcol@defcseprulecolor@i#1[#2]{%
+ \ifx\set@color\relax
+ \PackageWarning{paracol}{\pcol@colorcommand\space is not effective
+ without some coloring package}%
+ \else
+ {\let\set@color\relax #1}%
+ \global\@namedef{pcol@colseprulecolor#2}{#1}%
+ \fi}
+\gdef\pcol@colseprulecolor{\normalcolor}
+
+\def\backgroundcolor#1{\@tempswatrue
+ \let\pcol@backgroundcolor@e\pcol@backgroundcolor@w
+ \pcol@backgroundcolor#1\@nil}
+\def\nobackgroundcolor#1{\@tempswafalse
+ \let\pcol@backgroundcolor@e\pcol@backgroundcolor@z
+ \pcol@backgroundcolor#1\@nil}
+\def\pcol@backgroundcolor#1{%
+ \@ifundefined{pcol@bg@@#1}%
+ {\PackageError{paracol}%
+ {Invalid background coloring region identifier #1}%
+ \def\pcol@bg@region{xx}\pcol@backgroundcolor@e}%
+ {\def\pcol@bg@region{#1}%
+ \@ifnextchar[%]
+ \pcol@backgroundcolor@i \pcol@backgroundcolor@ii}}
+\def\pcol@backgroundcolor@i[#1]{%
+ \@ifundefined{pcol@bg@mayhavecol@\pcol@bg@region}%
+ {\PackageError{paracol}%
+ {Column number \number#1 is not effective for background coloring region
+ \pcol@bg@region}%
+ \def\pcol@bg@region{xx}\pcol@backgroundcolor@e}%
+ {\edef\pcol@bg@region{\pcol@bg@region @#1}%
+ \pcol@backgroundcolor@ii}}
+\def\pcol@backgroundcolor@ii{%
+ \if@tempswa
+ \ifx\set@color\relax
+ \PackageWarning{paracol}{\string\backgroundcolor\space is not effective
+ without some coloring package}%
+ \let\reserved@b\pcol@backgroundcolor@w
+ \else
+ \let\reserved@b\pcol@backgroundcolor@iii
+ \@cons\pcol@bg@defined{{\pcol@bg@region}}%
+ \fi
+ \else
+ \let\reserved@b\pcol@backgroundcolor@z
+ \fi
+ \reserved@b}
+\def\pcol@backgroundcolor@iii{%
+ \pcol@bg@defext{l}\z@ \pcol@bg@defext{r}\z@
+ \pcol@bg@defext{t}\z@ \pcol@bg@defext{b}\z@
+ \@ifnextchar(%)
+ \pcol@backgroundcolor@iv \pcol@backgroundcolor@x}
+\def\pcol@backgroundcolor@iv(#1,#2){%
+ \pcol@bg@defext{l}{#1}\pcol@bg@defext{r}{#1}%
+ \pcol@bg@defext{t}{#2}\pcol@bg@defext{b}{#2}%
+ \@ifnextchar(%)
+ \pcol@backgroundcolor@v \pcol@backgroundcolor@x}
+\def\pcol@backgroundcolor@v(#1,#2){%
+ \pcol@bg@defext{r}{#1}\pcol@bg@defext{b}{#2}%
+ \pcol@backgroundcolor@x}
+\def\pcol@backgroundcolor@x#1\@nil{\begingroup
+ \let\set@color\pcol@backgroundcolor@y \color}
+\def\pcol@backgroundcolor@y{%
+ \expandafter\xdef\csname pcol@bg@color@\pcol@bg@region\endcsname
+ {\current@color}%
+ \endgroup}
+\def\pcol@backgroundcolor@z#1\@nil{\pcol@backgroundcolor@wi[]{}}
+\def\pcol@backgroundcolor@w#1\@nil{\@ifnextchar[%]
+ \pcol@backgroundcolor@wi{\pcol@backgroundcolor@wi[]}}
+\def\pcol@backgroundcolor@wi[#1]#2{%
+ \expandafter\global\expandafter\let
+ \csname pcol@bg@color@\pcol@bg@region\endcsname\relax}
+
+\def\pcol@bg@mayhavecol@c{}
+\def\pcol@bg@mayhavecol@C{}
+\def\pcol@bg@mayhavecol@g{}
+\def\pcol@bg@mayhavecol@G{}
+
+\def\pcol@bg@defext#1#2{%
+ \@tempdima#2\relax
+ \expandafter\xdef\csname pcol@bg@ext@#1@\pcol@bg@region\endcsname{%
+ \number\@tempdima sp}}
+
+\def\resetbackgroundcolor{{%
+ \let\@elt\pcol@resetbackgroundcolor \pcol@bg@defined
+ \gdef\pcol@bgdefined{}}}
+\def\pcol@resetbackgroundcolor#1{%
+ \expandafter\global\expandafter\let\csname pcol@bg@color@#1\endcsname\relax}
+\gdef\pcol@bg@defined{}
+
%% Closing Environment
\def\endparacol{\pcol@par
+ \edef\pcol@lastcol{\number\pcol@currcol}%
\pcol@nextcol\z@ \pcol@switchcol
\pcol@lastpagetrue
\ifpcol@mgfnote \pcol@flushclear\voidb@x