From 116405a01899ba783a14653896d02888e298fbb1 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sat, 15 Dec 2007 00:23:34 +0000
Subject: oberdiek: luacolor1.0 luatex1.0 ... (14dec07)

git-svn-id: svn://tug.org/texlive/trunk@5785 c570f23f-e606-0410-a88d-b1316a301751
---
 .../source/latex/oberdiek/pdfcolparallel.dtx       | 497 +++++++++++++--------
 1 file changed, 314 insertions(+), 183 deletions(-)

(limited to 'Master/texmf-dist/source/latex/oberdiek/pdfcolparallel.dtx')

diff --git a/Master/texmf-dist/source/latex/oberdiek/pdfcolparallel.dtx b/Master/texmf-dist/source/latex/oberdiek/pdfcolparallel.dtx
index 25c6a72da3a..7d5897c6e09 100644
--- a/Master/texmf-dist/source/latex/oberdiek/pdfcolparallel.dtx
+++ b/Master/texmf-dist/source/latex/oberdiek/pdfcolparallel.dtx
@@ -68,7 +68,7 @@
 \input docstrip.tex
 \Msg{************************************************************************}
 \Msg{* Installation}
-\Msg{* Package: pdfcolparallel 2007/09/09 v1.0 Color stacks support for parallel (HO)}
+\Msg{* Package: pdfcolparallel 2007/12/12 v1.1 Fixed parallel with color stacks support (HO)}
 \Msg{************************************************************************}
 
 \keepsilent
@@ -137,7 +137,7 @@ and the derived files
 %<*driver>
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{pdfcolparallel.drv}%
-  [2007/09/09 v1.0 Color stacks support for parallel (HO)]%
+  [2007/12/12 v1.1 Fixed parallel with color stacks support (HO)]%
 \documentclass{ltxdoc}
 \usepackage{holtxdoc}[2007/11/11]
 \begin{document}
@@ -146,7 +146,7 @@ and the derived files
 %</driver>
 % \fi
 %
-% \CheckSum{582}
+% \CheckSum{714}
 %
 % \CharacterTable
 %  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -167,15 +167,15 @@ and the derived files
 % \GetFileInfo{pdfcolparallel.drv}
 %
 % \title{The \xpackage{pdfcolparallel} package}
-% \date{2007/09/09 v1.0}
+% \date{2007/12/12 v1.1}
 % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}}
 %
 % \maketitle
 %
 % \begin{abstract}
-% Since version 1.40 \pdfTeX\ supports several color stacks.
-% This package uses them to fix color problems in
-% package \xpackage{parallel}.
+% This packages fixes bugs in \xpackage{parallel} and
+% improves color support by using several color stacks
+% that are provided by \pdfTeX\ since version 1.40.
 % \end{abstract}
 %
 % \tableofcontents
@@ -186,9 +186,10 @@ and the derived files
 % |\usepackage{pdfcolparallel}|
 % \end{quote}
 % The package \xpackage{pdfcolparallel} loads package \xpackage{parallel}
-% \cite{parallel}. If color stacks are available then the
-% macros of \xpackage{parallel} are patched to add support
-% for color stacks.
+% \cite{parallel} and redefines some macros to fix bugs.
+%
+% If color stacks are available then package \xpackage{parallel}
+% is further patched to support them.
 %
 % \subsection{Future}
 %
@@ -207,12 +208,10 @@ and the derived files
 %<*package>
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{pdfcolparallel}%
-  [2007/09/09 v1.0 Color stacks support for parallel (HO)]%
+  [2007/12/12 v1.1 Fixed parallel with color stacks support (HO)]%
 %    \end{macrocode}
 %
-% \subsection{Load packages}
-%
-% \subsubsection{Package \xpackage{parallel}}
+% \subsection{Load and fix package \xpackage{parallel}}
 %
 %    Package \xpackage{parallel} is loaded. Before options of package
 %    \xpackage{pdfcolparallel} are passed to package \xpackage{parallel}.
@@ -224,52 +223,52 @@ and the derived files
 \RequirePackage{parallel}[2003/04/13]
 %    \end{macrocode}
 %
-% \subsubsection{Package \xpackage{pdfcol}}
-%
-%    \begin{macrocode}
-\RequirePackage{pdfcol}[2007/09/09]
-\ifpdfcolAvailable
-\else
-  \PackageInfo{pdfcolparallel}{%
-    Loading aborted, because color stacks are not available%
-  }%
-  \expandafter\endinput
-\fi
-%    \end{macrocode}
-%
-% \subsubsection{Package \xpackage{infwarerr}}
-%
 %    \begin{macrocode}
 \RequirePackage{infwarerr}[2007/09/09]
 %    \end{macrocode}
 %
-% \subsection{Color stack macros}
-%
+%    \begin{macro}{\pcp@ColorPatch}
 %    \begin{macrocode}
-\pdfcolInitStack{pcp@Left}
-\pdfcolInitStack{pcp@Right}
-%    \end{macrocode}
-%    \begin{macro}{\pcp@SwitchStack}
-%    \begin{macrocode}
-\def\pcp@SwitchStack#1{%
-  \pdfcolSwitchStack{pcp@#1}%
-}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname currentgrouplevel\endcsname\relax
+  \def\pcp@ColorPatch{}%
+\else
+  \def\pcp@ColorPatch{%
+    \@ifundefined{set@color}{%
+      \gdef\pcp@ColorPatch{}%
+    }{%
+      \gdef\pcp@ColorPatch{%
+        \gdef\pcp@ColorResets{}%
+        \bgroup
+        \aftergroup\pcp@ColorResets
+        \aftergroup\egroup
+        \let\pcp@OrgSetColor\set@color
+        \let\set@color\pcp@SetColor
+        \edef\pcp@GroupLevel{\the\currentgrouplevel}%
+      }%
+    }%
+    \pcp@ColorPatch
+  }%
 %    \end{macrocode}
 %    \end{macro}
-%    \begin{macro}{\pcp@SetCurrent}
+%    \begin{macro}{\pcp@SetColor}
 %    \begin{macrocode}
-\def\pcp@SetCurrent#1{%
-  \ifx\\#1\\%
-    \pdfcolSetCurrent{}%
-  \else
-    \pdfcolSetCurrent{pcp@#1}%
-  \fi
-}
+  \def\pcp@SetColor{%
+    \ifnum\pcp@GroupLevel=\currentgrouplevel
+      \let\pcp@OrgAfterGroup\aftergroup
+      \def\aftergroup{%
+        \g@addto@macro\pcp@ColorResets
+      }%
+      \pcp@OrgSetColor
+      \let\aftergroup\pcp@OrgAfterGroup
+    \else
+      \pcp@OrgSetColor
+    \fi
+  }%
+\fi
 %    \end{macrocode}
 %    \end{macro}
 %
-% \subsection{Redefinitions}
-%
 %    \begin{macro}{\pcp@CmdCheckRedef}
 %    \begin{macrocode}
 \def\pcp@CmdCheckRedef#1{%
@@ -296,6 +295,13 @@ and the derived files
 %    \end{macrocode}
 %    \end{macro}
 %
+%    \begin{macrocode}
+\def\pcp@SwitchStack#1#2{}
+%    \end{macrocode}
+%    \begin{macrocode}
+\def\pcp@SetCurrent#1{}
+%    \end{macrocode}
+%
 %    \begin{macro}{\ParallelLText}
 %    \begin{macrocode}
 \pcp@CmdCheckRedef\ParallelLText{%
@@ -314,14 +320,17 @@ and the derived files
 }{%
   \everypar{}%
   \@restorepar
+  \@nobreakfalse
   \begingroup
     \hbadness=3000 %
     \let\footnote=\ParallelLFootnote
     \ParallelWhichBox=0 %
     \global\setbox\ParallelLBox=\vbox\bgroup
       \hsize=\ParallelLWidth
-      \pcp@SwitchStack{Left}%
+      \linewidth=\ParallelLWidth
+      \pcp@SwitchStack{Left}\ParallelLBox
       \aftergroup\ParallelAfterText
+      \pcp@ColorPatch
       \begingroup
         \afterassignment\ParallelCheckOpenBrace
         \let\x=%
@@ -351,6 +360,7 @@ and the derived files
 }{%
   \everypar{}%
   \@restorepar
+  \@nobreakfalse
   \begingroup
     \hbadness=3000 %
     \ifnum\ParallelFNMode=\@ne
@@ -361,8 +371,10 @@ and the derived files
     \ParallelWhichBox=\@ne
     \global\setbox\ParallelRBox=\vbox\bgroup
       \hsize=\ParallelRWidth
-      \pcp@SwitchStack{Right}%
+      \linewidth=\ParallelRWidth
+      \pcp@SwitchStack{Right}\ParallelRBox
       \aftergroup\ParallelAfterText
+      \pcp@ColorPatch
       \begingroup
         \afterassignment\ParallelCheckOpenBrace
         \let\x=%
@@ -370,6 +382,204 @@ and the derived files
 %    \end{macrocode}
 %    \end{macro}
 %
+%    \begin{macro}{\ParallelParTwoPages}
+%    \begin{macrocode}
+\pcp@CmdCheckRedef\ParallelParTwoPages{%
+  \ifnum\ParallelBoolVar=\@ne
+    \par
+    \begingroup
+      \global\ParallelWhichBox=\@ne
+      \newpage
+      \vbadness=10000 %
+      \vfuzz=3ex %
+      \splittopskip=\z@skip
+      \loop%
+        \ifnum\ParallelBoolVar=\@ne%
+          \ifnum\ParallelWhichBox=\@ne
+            \ifvoid\ParallelLBox
+              \mbox{} %
+              \newpage
+            \else
+              \global\ParallelWhichBox=\z@
+            \fi
+          \else
+            \ifvoid\ParallelRBox
+              \mbox{} %
+              \newpage
+            \else
+              \global\ParallelWhichBox=\@ne
+            \fi
+          \fi
+          \ifnum\ParallelWhichBox=\z@
+            \ifodd\thepage
+              \mbox{} %
+              \newpage
+            \fi
+            \hbox to\textwidth{%
+              \vbox{\vsplit\ParallelLBox to.98\textheight}%
+            }%
+          \else
+            \ifodd\thepage\relax
+            \else
+              \mbox{} %
+              \newpage
+            \fi
+            \hbox to\textwidth{%
+              \vbox{\vsplit\ParallelRBox to.98\textheight}%
+            }%
+          \fi
+          \vspace*{\fill}%
+          \newpage
+        \fi
+        \ifvoid\ParallelLBox
+          \ifvoid\ParallelRBox
+            \global\ParallelBoolVar=\z@
+          \fi
+        \fi
+      \ifnum\ParallelBoolVar=\@ne
+      \repeat
+      \par
+    \endgroup
+  \fi
+}{%
+%    \end{macrocode}
+%    Additional fixes:
+%    \begin{itemize}
+%    \item Unnecessary white space removed.
+%    \item |\ifodd\thepage| changed to |\ifodd\value{page}|.
+%    \end{itemize}
+%    \begin{macrocode}
+  \ifnum\ParallelBoolVar=\@ne
+    \par
+    \begingroup
+      \global\ParallelWhichBox=\@ne
+      \newpage
+      \vbadness=10000 %
+      \vfuzz=3ex %
+      \splittopskip=\z@skip
+      \loop%
+        \ifnum\ParallelBoolVar=\@ne%
+          \ifnum\ParallelWhichBox=\@ne
+            \ifvoid\ParallelLBox
+              \mbox{}%
+              \newpage
+            \else
+              \global\ParallelWhichBox=\z@
+            \fi
+          \else
+            \ifvoid\ParallelRBox
+              \null
+              \newpage
+            \else
+              \global\ParallelWhichBox=\@ne
+            \fi
+          \fi
+          \ifnum\ParallelWhichBox=\z@
+            \ifodd\value{page}%
+              \null
+              \newpage
+            \fi
+            \hbox to\textwidth{%
+              \pcp@SetCurrent{Left}%
+              \setbox\z@=\vsplit\ParallelLBox to.98\textheight
+              \vbox to.98\textheight{%
+                \@texttop
+                \unvbox\z@
+                \@textbottom
+              }%
+            }%
+          \else
+            \ifodd\value{page}%
+            \else
+              \mbox{}%
+              \newpage
+            \fi
+            \hbox to\textwidth{%
+              \pcp@SetCurrent{Right}%
+              \setbox\z@=\vsplit\ParallelRBox to.98\textheight
+              \vbox to.98\textheight{%
+                \@texttop
+                \unvbox\z@
+                \@textbottom
+              }%
+            }%
+          \fi
+          \vspace*{\fill}%
+          \newpage
+        \fi
+        \ifvoid\ParallelLBox
+          \ifvoid\ParallelRBox
+            \global\ParallelBoolVar=\z@
+          \fi
+        \fi
+      \ifnum\ParallelBoolVar=\@ne
+      \repeat
+      \par
+    \endgroup
+    \pcp@SetCurrent{}%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsection{Color stack support}
+%
+%    \begin{macrocode}
+\RequirePackage{pdfcol}[2007/12/12]
+\ifpdfcolAvailable
+\else
+  \PackageInfo{pdfcolparallel}{%
+    Loading aborted, because color stacks are not available%
+  }%
+  \expandafter\endinput
+\fi
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\pdfcolInitStack{pcp@Left}
+\pdfcolInitStack{pcp@Right}
+%    \end{macrocode}
+%    \begin{macro}{\pcp@Box}
+%    \begin{macrocode}
+\newbox\pcp@Box
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\pcp@SwitchStack}
+%    \begin{macrocode}
+\def\pcp@SwitchStack#1#2{%
+  \pdfcolSwitchStack{pcp@#1}%
+  \global\setbox\pcp@Box=\vbox to 0pt{%
+    \pdfcolSetCurrentColor
+  }%
+  \aftergroup\pcp@FixBox
+  \aftergroup#2%
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\pcp@FixBox}
+%    \begin{macrocode}
+\def\pcp@FixBox#1{%
+  \global\setbox#1=\vbox{%
+    \unvbox\pcp@Box
+    \unvbox#1%
+  }%
+}
+%    \end{macrocode}
+%    \end{macro}
+%    \begin{macro}{\pcp@SetCurrent}
+%    \begin{macrocode}
+\def\pcp@SetCurrent#1{%
+  \ifx\\#1\\%
+    \pdfcolSetCurrent{}%
+  \else
+    \pdfcolSetCurrent{pcp@#1}%
+  \fi
+}
+%    \end{macrocode}
+%    \end{macro}
+%
+% \subsection{Redefinitions}
+%
 %    \begin{macro}{\ParallelParOnePage}
 %    \begin{macrocode}
 \pcp@CmdCheckRedef\ParallelParOnePage{%
@@ -497,136 +707,6 @@ and the derived files
 %    \end{macrocode}
 %    \end{macro}
 %
-%    \begin{macro}{\ParallelParTwoPages}
-%    \begin{macrocode}
-\pcp@CmdCheckRedef\ParallelParTwoPages{%
-  \ifnum\ParallelBoolVar=\@ne
-    \par
-    \begingroup
-      \global\ParallelWhichBox=\@ne
-      \newpage
-      \vbadness=10000 %
-      \vfuzz=3ex %
-      \splittopskip=\z@skip
-      \loop%
-        \ifnum\ParallelBoolVar=\@ne%
-          \ifnum\ParallelWhichBox=\@ne
-            \ifvoid\ParallelLBox
-              \mbox{} %
-              \newpage
-            \else
-              \global\ParallelWhichBox=\z@
-            \fi
-          \else
-            \ifvoid\ParallelRBox
-              \mbox{} %
-              \newpage
-            \else
-              \global\ParallelWhichBox=\@ne
-            \fi
-          \fi
-          \ifnum\ParallelWhichBox=\z@
-            \ifodd\thepage
-              \mbox{} %
-              \newpage
-            \fi
-            \hbox to\textwidth{%
-              \vbox{\vsplit\ParallelLBox to.98\textheight}%
-            }%
-          \else
-            \ifodd\thepage\relax
-            \else
-              \mbox{} %
-              \newpage
-            \fi
-            \hbox to\textwidth{%
-              \vbox{\vsplit\ParallelRBox to.98\textheight}%
-            }%
-          \fi
-          \vspace*{\fill}%
-          \newpage
-        \fi
-        \ifvoid\ParallelLBox
-          \ifvoid\ParallelRBox
-            \global\ParallelBoolVar=\z@
-          \fi
-        \fi
-      \ifnum\ParallelBoolVar=\@ne
-      \repeat
-      \par
-    \endgroup
-  \fi
-}{%
-%    \end{macrocode}
-%    Additional fixes:
-%    \begin{itemize}
-%    \item Unnecessary white space removed.
-%    \item |\ifodd\thepage| changed to |\ifodd\value{page}|.
-%    \end{itemize}
-%    \begin{macrocode}
-  \ifnum\ParallelBoolVar=\@ne
-    \par
-    \begingroup
-      \global\ParallelWhichBox=\@ne
-      \newpage
-      \vbadness=10000 %
-      \vfuzz=3ex %
-      \splittopskip=\z@skip
-      \loop%
-        \ifnum\ParallelBoolVar=\@ne%
-          \ifnum\ParallelWhichBox=\@ne
-            \ifvoid\ParallelLBox
-              \mbox{}%
-              \newpage
-            \else
-              \global\ParallelWhichBox=\z@
-            \fi
-          \else
-            \ifvoid\ParallelRBox
-              \mbox{}%
-              \newpage
-            \else
-              \global\ParallelWhichBox=\@ne
-            \fi
-          \fi
-          \ifnum\ParallelWhichBox=\z@
-            \ifodd\value{page}%
-              \mbox{}%
-              \newpage
-            \fi
-            \hbox to\textwidth{%
-              \pcp@SetCurrent{Left}%
-              \vbox{\vsplit\ParallelLBox to.98\textheight}%
-            }%
-          \else
-            \ifodd\value{page}%
-            \else
-              \mbox{}%
-              \newpage
-            \fi
-            \hbox to\textwidth{%
-              \pcp@SetCurrent{Right}%
-              \vbox{\vsplit\ParallelRBox to.98\textheight}%
-            }%
-          \fi
-          \vspace*{\fill}%
-          \newpage
-        \fi
-        \ifvoid\ParallelLBox
-          \ifvoid\ParallelRBox
-            \global\ParallelBoolVar=\z@
-          \fi
-        \fi
-      \ifnum\ParallelBoolVar=\@ne
-      \repeat
-      \par
-    \endgroup
-    \pcp@SetCurrent{}%
-  \fi
-}
-%    \end{macrocode}
-%    \end{macro}
-%
 %    \begin{macrocode}
 %</package>
 %    \end{macrocode}
@@ -646,7 +726,7 @@ and the derived files
 }
 \documentclass{article}
 \usepackage{xcolor}
-\usepackage{pdfcolparallel}[2007/09/09]
+\usepackage{pdfcolparallel}[2007/12/12]
 
 \begin{document}
   \color{green}%
@@ -664,8 +744,37 @@ and the derived files
         Ein Absatz, der sich ueber zwei Zeilen erstrecken soll.%
       }%
     }%
+    \ParallelPar
+    \ParallelLText{%
+      Default %
+      \color{red}%
+      Ein Absatz, der sich ueber zwei Zeilen erstrecken soll. %
+      Ein Absatz, der sich ueber zwei Zeilen erstrecken soll.%
+    }%
+    \ParallelRText{%
+      Default %
+      \color{blue}%
+      Ein Absatz, der sich ueber zwei Zeilen erstrecken soll. %
+      Ein Absatz, der sich ueber zwei Zeilen erstrecken soll.%
+    }%
+    \ParallelPar
+    \ParallelLText{%
+      \begin{enumerate}%
+      \item left text, left text, left text, left text, %
+            left text, left text, left text, left text,%
+      \item left text, left text, left text, left text, %
+            left text, left text, left text, left text.%
+      \end{enumerate}%
+    }%
+    \ParallelRText{%
+      \begin{enumerate}%
+      \item right text, right text, right text, right text, %
+            right text, right text, right text, right text.%
+      \item right text, right text, right text, right text, %
+            right text, right text, right text, right text.%
+      \end{enumerate}%
+    }%
   \end{Parallel}%
-  Green%
   \begin{Parallel}[p]{\textwidth}{\textwidth}%
     \ParallelLText{%
       \textcolor{red}{%
@@ -673,6 +782,8 @@ and the derived files
         Ein Absatz, der sich ueber zwei Zeilen erstrecken soll. %
         Foo bar bla bla bla.%
       }%
+      \par
+      Und noch ein Absatz.%
     }%
     \ParallelRText{%
       \textcolor{blue}{%
@@ -682,6 +793,14 @@ and the derived files
       }%
     }%
   \end{Parallel}%
+  \begin{Parallel}[p]{\textwidth}{\textwidth}%
+    \ParallelLText{%
+      \rule{1pt}{.98\textheight}\Huge g%
+    }%
+    \ParallelRText{%
+      \rule{1pt}{.98\textheight}y%
+    }%
+  \end{Parallel}%
   Green%
 \end{document}
 %</test1>
@@ -888,6 +1007,18 @@ and the derived files
 %   \item
 %     First version.
 %   \end{Version}
+%   \begin{Version}{2007/12/12 v1.1}
+%   \item
+%     Adds patch for setting \cs{linewidth} to fix bug
+%     in package \xpackage{parallel}.
+%   \item
+%     Package \xpackage{parallel} is also fixed if color
+%     stacks are not available.
+%   \item
+%     Bug fix, switched stacks now initialized with current color.
+%   \item
+%     Fix for package \xpackage{parallel}: \cs{raggedbottom} is respected.
+%   \end{Version}
 % \end{History}
 %
 % \PrintIndex
-- 
cgit v1.2.3

