From a41b6fc74912fbdd819966fff48a9780288bc947 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 28 Jun 2013 21:56:20 +0000
Subject: paracol (28jun13)

git-svn-id: svn://tug.org/texlive/trunk@31009 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/paracol/paracol.sty | 165 ++++++++++++++++++------
 1 file changed, 127 insertions(+), 38 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/paracol/paracol.sty')

diff --git a/Master/texmf-dist/tex/latex/paracol/paracol.sty b/Master/texmf-dist/tex/latex/paracol/paracol.sty
index f4f82d09360..ebead1e932b 100644
--- a/Master/texmf-dist/tex/latex/paracol/paracol.sty
+++ b/Master/texmf-dist/tex/latex/paracol/paracol.sty
@@ -1,5 +1,5 @@
 %% Style file `paracol'.
-%% Copyright (C) 2005-2012
+%% Copyright (C) 2005-2013
 %%   Hiroshi Nakashima <h.nakashima@DOMAIN;  DOMAIN=media.kyoto-u.ac.jp>
 %%   (Kyoto University)
 %% This program can be redistributed and/or modified under the terms
@@ -9,7 +9,7 @@
 
 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
 \ProvidesPackage{paracol}
-[2013/05/11 v1.2 ]
+[2013/06/30 v1.22 ]
 
 %% Register Declaration
 
@@ -34,12 +34,14 @@
 \newif\ifpcol@mgfnote \pcol@mgfnotefalse
 \newif\ifpcol@fncounteradjustment \pcol@fncounteradjustmentfalse
 \newif\ifpcol@swapcolumn \global\pcol@swapcolumnfalse
+\newif\ifpcol@inner
 \newdimen\pcol@prevdepth
 \newdimen\pcol@colht
 \newdimen\pcol@textfloatsep
 \newdimen\pcol@lrmargin
 \newskip\pcol@topskip
 \newbox\pcol@topfnotes
+\newtoks\pcol@everyvbox
 
 %% Logging Tools
 
@@ -73,8 +75,9 @@
 \def\pcol@ovf{%
   \PackageError{paracol}{Too many unprocessed columns/floats}\@ehb}
 
-\def\pcol@output{\let\par\@@par
-  \pcol@Logstart{\pcol@output\number\outputpenalty}%
+\def\pcol@output{\let\par\@@par \let\set@color\pcol@set@color
+  \pcol@Logstart{\pcol@output\number\outputpenalty
+    (\number\c@page:\number\pcol@currcol)}%
   \ifnum\outputpenalty<-\@M
     \pcol@specialoutput
   \else\ifpcol@output
@@ -372,6 +375,9 @@
 \def\pcol@op@flush{-10012}
 \def\pcol@op@clear{-10013}
 \def\pcol@op@end{-10014}
+\def\pcol@op@cpush{-10015}
+\def\pcol@op@cpop{-10016}
+\def\pcol@op@cset{-10017}
 \def\pcol@specialoutput{%
   \ifnum\outputpenalty=\pcol@op@start\relax
     \let\reserved@a\pcol@output@start
@@ -383,11 +389,17 @@
     \let\reserved@a\pcol@output@clear
   \else\ifnum\outputpenalty=\pcol@op@end\relax
     \let\reserved@a\pcol@output@end
+  \else\ifnum\outputpenalty=\pcol@op@cpush\relax
+    \let\reserved@a\pcol@output@cpush
+  \else\ifnum\outputpenalty=\pcol@op@cpop\relax
+    \let\reserved@a\pcol@output@cpop
+  \else\ifnum\outputpenalty=\pcol@op@cset\relax
+    \let\reserved@a\pcol@output@cset
   \else \let\reserved@a\@specialoutput
-  \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
+    \ifvoid\footins\else \pcol@Log\dummy{dummy}\footins \fi
+  \fi
   \ifx\reserved@a\@specialoutput\else
     \global\setbox\@holdpg\vbox{\unvbox\@holdpg \unvbox\@cclv
       \setbox\@tempboxa\lastbox \unskip}%
@@ -438,7 +450,7 @@
    \advance\pcol@currcol\@ne}%
   \global\pcol@currcol\z@
   \pcol@getcurrcol
-  \gdef\pcol@colorstack{}\pcol@savecolorstack
+  \pcol@savecolorstack
   \@cons\@freelist\@currbox \unvbox\@currbox
   \ifvoid\footins\else
     \pcol@Log\pcol@output@start{insert}\footins
@@ -592,16 +604,100 @@
 %% Special Output Routines: Color
 
 \def\pcol@set@color@push{\pcol@set@color
-  \@cons\pcol@colorstack{{\current@color}}}
-\def\pcol@reset@color@pop{\pcol@reset@color \begingroup
+  \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
+    \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}
+
+\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}
+
+\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@cpop{\begingroup
   \let\reserved@a\pcol@colorstack
   \gdef\pcol@colorstack{}\let\@elt\pcol@reset@color@elt
-  \reserved@a\@elt\@nil \endgroup}
+  \reserved@a\@elt\@nil
+  \endgroup
+  \pcol@return@from@color}
 \def\pcol@reset@color@elt#1\@elt#2{\def\reserved@b{#2}%
   \ifx\reserved@b\@nnil \let\reserved@b\relax
   \else \@cons\pcol@colorstack{{#1}}\def\reserved@b{\@elt{#2}}%
   \fi
   \reserved@b}
+\def\pcol@output@cset{%
+  \expandafter\pcol@output@icset\pcol@colorstack@buf\@nil
+  \pcol@return@from@color}
+\def\pcol@output@icset\@elt#1#2\@nil{{\let\@elt\relax
+  \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}
 
 \def\pcol@magicpenalty{12345}
 \def\pcol@ifempty#1#2#3{%
@@ -616,7 +712,7 @@
   \pcol@ifempty#1\relax
    {\pcol@restorecst\pcol@colorstack@saved
     \unvbox#1\pcol@clearcolorstack}}
-\def\pcol@clearcolorstack{{\def\@elt##1{\pcol@reset@color}%
+\def\pcol@clearcolorstack{{\def\@elt##1{\reset@color}%
   \pcol@colorstack@full}}
 
 \def\pcol@restorecst@restart{%
@@ -636,26 +732,6 @@
   \else \@nameuse{pcol@columncolor\number\pcol@currcol}\fi
   \pcol@colorstack}
 
-\def\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{\@ifnextchar[%]
-  {\pcol@icolumncolor\normalcolor}%
-  {\pcol@icolumncolor\normalcolor[\number\pcol@currcol]}}
-\def\pcol@icolumncolor#1[#2]{%
-  \ifx\set@color\relax\else
-    \ifx\pcol@paracol\paracol\else \pcol@clearcolorstack \fi
-    \begingroup
-    \let\@elt\relax \let\set@color\relax #1%
-    \expandafter\xdef\csname pcol@columncolor#2\endcsname
-      {\@elt{\current@color}}%
-    \endgroup
-    \ifx\pcol@paracol\paracol\else \pcol@restorecolorstack \fi
-  \fi}
-
 %% Special Output Routines: Footnote Handling
 
 \def\pcol@savefootins#1{%
@@ -750,7 +826,7 @@
       \pcol@shrinkcolbyfn\pcol@footins
       \setbox\@cclv\vbox{\pcol@unvbox@cclv\pcol@footins}%
     \fi
-    \pcol@Logstart\pcol@flushcolumn
+    \pcol@Logstart{\pcol@flushcolumn(\number\c@page:\number\pcol@currcol)}
     \ifdim\@toproom=\maxdimen
       \setbox\@outputbox\pcol@makefcolpage \global\@toproom\z@
     \else
@@ -787,7 +863,7 @@
         \pcol@trynextcolumn
     \fi\fi
     \pcol@setcurrcolnf
-    \global\count\@currbox\pcol@page
+    \global\count\@currbox\pcol@toppage
     \advance\@pageht-\@colht \advance\@pageht\@colroom
     \global\dimen\@currbox\@pageht
   \fi %\ifnum\count\@currbox<\pcol@toppage
@@ -1090,7 +1166,7 @@
 
 %% Starting Environment
 
-\def\pcol@invokeoutput#1{%
+\def\pcol@invokeoutput#1{\deadcycles\z@
   \pcol@Logstart{\pcol@invokeoutput
     {#1:\the\pcol@currcol/\the\pcol@nextcol%
      \ifnum#1=-10011:\ifpcol@sync s\fi \ifpcol@clear c\fi\fi}}%
@@ -1121,10 +1197,18 @@
   \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 \let\pcol@reset@color\reset@color
+  \let\pcol@set@color\set@color
   \ifx\set@color\relax\else
-    \let\set@color\pcol@set@color@push \let\reset@color\pcol@reset@color@pop
+    \let\set@color\pcol@set@color@push
+    \pcol@innerfalse
+    \global\pcol@everyvbox{\pcol@dummytoken}%
+    \pcol@everyvbox\everyvbox
+    \everyvbox{\the\pcol@everyvbox \pcol@innertrue}
+    \let\everyvbox\pcol@everyvbox
+    \aftergroup\pcol@restoreeveryvbox
   \fi
+  \gdef\pcol@colorstack{}%
+  \gdef\pcol@colorstack@buf{}\gdef\pcol@colorstack@shadow{}%
   \pcol@footnotebase\c@footnote \global\pcol@nfootnotes\z@
   \let\footnote\pcol@footnote
   \let\footnotemark\pcol@footnotemark
@@ -1194,7 +1278,7 @@
   \expandafter\let\expandafter\reserved@a\csname pcol@com@#1\endcsname
   \expandafter\let\csname #1\endcsname\reserved@a}
 
-%% Counter Opearations
+%% Counter Operations
 
 \def\globalcounter#1{{%
   \@tempswafalse \def\reserved@a{#1}%
@@ -1539,3 +1623,8 @@
     \global\c@footnote\pcol@footnotebase
     \global\advance\c@footnote\pcol@nfootnotes
   \fi}
+
+\def\pcol@restoreeveryvbox{%
+  \expandafter\def\expandafter\reserved@a\expandafter{\the\pcol@everyvbox}%
+  \def\reserved@b{\pcol@dummytoken}%
+  \ifx\reserved@a\reserved@b\else \global\everyvbox\pcol@everyvbox \fi}
-- 
cgit v1.2.3

