From 9c01b63974296c5795e3a8b63460ff6a46bf3b4d Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sat, 31 Mar 2012 22:27:14 +0000
Subject: prerex 6.3.2 (31mar12)

git-svn-id: svn://tug.org/texlive/trunk@25800 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/prerex/prerex.sty | 217 ++++++++++++++++++++++----
 1 file changed, 185 insertions(+), 32 deletions(-)

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

diff --git a/Master/texmf-dist/tex/latex/prerex/prerex.sty b/Master/texmf-dist/tex/latex/prerex/prerex.sty
index 4059f122835..f60a1c06484 100644
--- a/Master/texmf-dist/tex/latex/prerex/prerex.sty
+++ b/Master/texmf-dist/tex/latex/prerex/prerex.sty
@@ -1,6 +1,6 @@
 %% This is file 'prerex.sty'
 %%
-%% Copyright (C) 2006-11 R. D. Tennent, rdt@cs.queensu.ca
+%% Copyright (C) 2006-12 R. D. Tennent, rdt@cs.queensu.ca
 %% 
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3
@@ -14,7 +14,7 @@
 %
 % Instructions supported inside  \begin{chart} ... \end{chart}:
 %
-%   \[req]{half|full}course[c] x,y: {course code}{course title}{timetable code}[{color}]  
+%   \[req|opt]{half|full}course[c] x,y: {course code}{course title}{timetable code}[{color}]  
 %
 %   \mini x,y: {course code}
 %
@@ -32,8 +32,9 @@
 %   \dottedarrow    in-line dotted arrow
 %   \dashedarrow    in-line dashed arrow
 %
-%   \lightbox  in-line light course box
-%   \boldbox   in-line bold course box
+%   \lightbox   in-line light course box
+%   \boldbox    in-line bold course box
+%   \dottedbox  in-line dotted course box
 %
 % The following defaults are defined in prerex.sty (but may be re-defined by the user):
 %
@@ -62,10 +63,19 @@
 % The nominal diagram width is 10 + (\textwidth divided by \unit).
 %
 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\ProvidesPackage{prerex}[2011/10/28 v6.2 LaTeX style for prerequisite charts, pgf version]
+\ProvidesPackage{prerex}[2012/03/29 v6.3.2 LaTeX style for prerequisite charts, pgf version]
 
 % Changelog:
 %
+%  Version 6.3.2
+%
+%    Use pgf layers to keep grid below arrows below boxes (thanks to Ryan Kavanagh).
+%    Add struts to stand-alone \...box commands.
+%
+%  Version 6.3
+%
+%    Allow "opt" course boxes (with dotted outlines).
+%
 %  Version 6.2
 %
 %    Allow for multi-line "timetable" arguments by using nested tabular environments.
@@ -221,6 +231,7 @@
 \definecolor{verylight}{gray}{0.85}
 \definecolor{white}{rgb}{1.0,1.0,1.0} % not transparent, hides grid
 
+
 \newcommand{\DefaultCurvature}{20} % 0 for no curvature
 \newcommand{\CourseURL}[3]{file:#3.html}
 \newcommand{\background}{yellow!15}
@@ -279,7 +290,45 @@
 \immediate\write\@imapfile{<area shape=rect coords="\thexNW,\theyNW,\thexSE,\theySE" href="\CourseURL{#1}{#2}{#3}" target="new" alt="#3">}%
 }
 
+\pgfsetlayers{}
+\def\solidarrow{%
+\tikz[x=\unit,y=\unit,baseline=\baselineAdj]
+\draw[-latex',line width =\solidwidth] (0,0) -- (4,0);
+}
+
+\def\dottedarrow{%
+\tikz[x=\unit,y=\unit,baseline=\baselineAdj]
+\draw[loosely dotted,line width=\dottedwidth,-latex'] (0,0) -- (4,0);
+}
+
+\def\dashedarrow{%
+\tikz[x=\unit,y=\unit,baseline=\baselineAdj]
+\draw[dashed,line width=\dashedwidth,-latex'] (0,0) -- (4,0);
+}
+
+\def\lightbox{%
+\tikz[thin,baseline=\baselineAdj]\node[draw,fill=\background,rounded corners=2pt,inner xsep=1.8pt] 
+{\rule[-2pt]{0pt}{4pt}\textsf{light}};
+}
+
+\def\boldbox{%
+\tikz[baseline=\baselineAdj]\node[draw,line width=\boldwidth,fill=\background,rounded corners=2pt,inner xsep=1.8pt] 
+{\rule[-2pt]{0pt}{4pt}\textsf{\textbf{bold}}};
+}
+
+
+\def\dottedbox{%
+\tikz[baseline=\baselineAdj]\node[draw,dotted,line width=\boldwidth,fill=\background,rounded corners=2pt,inner xsep=1.8pt] 
+{\rule[-2pt]{0pt}{4pt}\textsf{\textsf{dotted}}};
+}
+
+\pgfdeclarelayer{arrows}
+\pgfdeclarelayer{courses}
+\pgfdeclarelayer{grid}
+\pgfsetlayers{grid,arrows,courses,main}
+
 \def\@halfcourse#1,#2:#3#4#5{%
+\begin{pgfonlayer}{courses}%
 \node[draw,thin,fill=\background,rounded corners=2pt,inner ysep=0.5pt,minimum height=\@unitmult](x#1y#2) at (#1,#2)%
 {\textsf{%
 \renewcommand{\arraystretch}{0.8}%
@@ -291,9 +340,11 @@
 \end{tabular}}}%
 };%
 \@outputImapData#1,#2:{#3}{4}{2}%
+\end{pgfonlayer}%
 }
 
 \def\@halfcoursec#1,#2:#3#4#5#6{%
+\begin{pgfonlayer}{courses}%
 \node[draw,thin,fill=#6,rounded corners=2pt,inner ysep=0.5pt,minimum height=\@unitmult](x#1y#2) at (#1,#2)%
 {\textsf{%
 \renewcommand{\arraystretch}{0.8}%
@@ -305,9 +356,11 @@
 \end{tabular}}}%
 };%
 \@outputImapData#1,#2:{#3}{4}{2}%
+\end{pgfonlayer}%
 }
 
 \def\@reqhalfcourse#1,#2:#3#4#5{%
+\begin{pgfonlayer}{courses}%
 \node[draw,line width=\boldwidth,fill=\background,rounded corners=2pt,inner ysep=0.5pt,minimum height=\@unitmult](x#1y#2) at (#1,#2)%
 {\textsf{\textbf{%
 \renewcommand{\arraystretch}{0.8}%
@@ -319,9 +372,11 @@
 \end{tabular}}}%
 }};%
 \@outputImapData#1,#2:{#3}{4}{2}%
+\end{pgfonlayer}%
 }
 
 \def\@reqhalfcoursec#1,#2:#3#4#5#6{%
+\begin{pgfonlayer}{courses}%
 \node[draw,line width=\boldwidth,fill=#6,rounded corners=2pt,inner ysep=0.5pt,minimum height=\@unitmult](x#1y#2) at (#1,#2)%
 {\textsf{\textbf{%
 \renewcommand{\arraystretch}{0.8}%
@@ -333,9 +388,44 @@
 \end{tabular}}}%
 }};%
 \@outputImapData#1,#2:{#3}{4}{2}%
+\end{pgfonlayer}%
+}
+
+
+\def\@opthalfcourse#1,#2:#3#4#5{%
+\begin{pgfonlayer}{courses}%
+\node[draw,dotted,line width=\boldwidth,fill=\background,rounded corners=2pt,inner ysep=0.5pt,minimum height=\@unitmult](x#1y#2) at (#1,#2)%
+{\textsf{%
+\renewcommand{\arraystretch}{0.8}%
+\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}%
+\mbox{\smallersize#3}%
+\,\hfill\,%
+\mbox{\smallersize\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}%
+\\ #4%
+\end{tabular}}}%
+};%
+\@outputImapData#1,#2:{#3}{4}{2}%
+\end{pgfonlayer}%
+}
+
+\def\@opthalfcoursec#1,#2:#3#4#5#6{%
+\begin{pgfonlayer}{courses}%
+\node[draw,dotted,line width=\boldwidth,fill=#6,rounded corners=2pt,inner ysep=0.5pt,minimum height=\@unitmult](x#1y#2) at (#1,#2)%
+{\textsf{%
+\renewcommand{\arraystretch}{0.8}%
+\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}%
+\mbox{\smallersize#3}%
+\,\hfill\,%
+\mbox{\smallersize\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}%
+\\ #4%
+\end{tabular}}}%
+};%
+\@outputImapData#1,#2:{#3}{4}{2}%
+\end{pgfonlayer}%
 }
 
 \def\@fullcourse#1,#2:#3#4#5{%
+\begin{pgfonlayer}{courses}%
 \node[draw,thin,fill=\background,rounded corners=2pt,inner ysep=0.5pt](x#1y#2) at (#1,#2)%
 {\textsf{%
 \renewcommand{\arraystretch}{1.7}%
@@ -347,9 +437,11 @@
 \end{tabular}}}%
 };%
 \@outputImapData#1,#2:{#3}{4}{5}%
+\end{pgfonlayer}%
 }
 
 \def\@fullcoursec#1,#2:#3#4#5#6{%
+\begin{pgfonlayer}{courses}%
 \node[draw,thin,fill=#6,rounded corners=2pt,inner ysep=0.5pt](x#1y#2) at (#1,#2)%
 {\textsf{%
 \renewcommand{\arraystretch}{1.7}%
@@ -360,10 +452,12 @@
 \\ #4%
 \end{tabular}}}%
 };%
+\end{pgfonlayer}%
 \@outputImapData#1,#2:{#3}{4}{5}%
 }
 
 \def\@reqfullcourse#1,#2:#3#4#5{%
+\begin{pgfonlayer}{courses}%
 \node[draw,line width=\boldwidth,fill=\background,rounded corners=2pt,inner ysep=0.5pt](x#1y#2) at (#1,#2)%
 {\textsf{\textbf{%
 \renewcommand{\arraystretch}{1.7}%
@@ -375,9 +469,11 @@
 \end{tabular}}}}%
 };%
 \@outputImapData#1,#2:{#3}{4}{5}%
+\end{pgfonlayer}%
 }
 
 \def\@reqfullcoursec#1,#2:#3#4#5#6{%
+\begin{pgfonlayer}{courses}%
 \node[draw,line width=\boldwidth,fill=#6,rounded corners=2pt,inner ysep=0.5pt](x#1y#2) at (#1,#2)%
 {\textsf{\textbf{%
 \renewcommand{\arraystretch}{1.7}%
@@ -389,24 +485,85 @@
 \end{tabular}}}}%
 };%
 \@outputImapData#1,#2:{#3}{4}{5}%
+\end{pgfonlayer}%
 }
 
-\def\@mini#1,#2:#3{%
-\node[fill=white,draw=white,inner ysep=1.8pt](x#1y#2) at (#1,#2)%
+\def\@fullcoursec#1,#2:#3#4#5#6{%
+\begin{pgfonlayer}{courses}%
+\node[draw,thin,fill=#6,rounded corners=2pt,inner ysep=0.5pt](x#1y#2) at (#1,#2)%
 {\textsf{%
-\href{\CourseURL{#1}{#2}{#3}}{%
-\mbox{\smallersize#3}}}};%
+\renewcommand{\arraystretch}{1.7}%
+\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}%
+\mbox{\smallersize#3}%
+\,\hfill\,%
+\mbox{\smallersize\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}%
+\\ #4%
+\end{tabular}}}%
+};%
+\@outputImapData#1,#2:{#3}{4}{5}%
+\end{pgfonlayer}%
+}
+
+\def\@optfullcourse#1,#2:#3#4#5{%
+\begin{pgfonlayer}{courses}%
+\node[draw,dotted,line width=\boldwidth,fill=\background,rounded corners=2pt,inner ysep=0.5pt](x#1y#2) at (#1,#2)%
+{\textsf{%
+\renewcommand{\arraystretch}{1.7}%
+\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}%
+\mbox{\smallersize#3}%
+\,\hfill\,%
+\mbox{\smallersize\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}%
+\\ #4%
+\end{tabular}}}%
+};%
+\@outputImapData#1,#2:{#3}{4}{5}%
+\end{pgfonlayer}%
+}
+
+
+\def\@optfullcoursec#1,#2:#3#4#5#6{%
+\begin{pgfonlayer}{courses}%
+\node[draw,dotted,line width=\boldwidth,fill=#6,rounded corners=2pt,inner ysep=0.5pt](x#1y#2) at (#1,#2)%
+{\textsf{%
+\renewcommand{\arraystretch}{1.7}%
+\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}%
+\mbox{\smallersize#3}%
+\,\hfill\,%
+\mbox{\smallersize\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}%
+\\ #4%
+\end{tabular}}}%
+};%
+\@outputImapData#1,#2:{#3}{4}{5}%
+\end{pgfonlayer}%
+}
+
+\def\@mini#1,#2:#3{%
+\begin{pgfonlayer}{courses}%
+\ifgridon
+  \node[fill=white,draw=white,inner ysep=1.8pt](x#1y#2) at (#1,#2)%
+  {\textsf{%
+  \href{\CourseURL{#1}{#2}{#3}}{%
+  \mbox{\smallersize#3}}}};%
+\else
+  \node[fill=none,draw=none,inner ysep=1.8pt](x#1y#2) at (#1,#2)%
+  {\textsf{%
+  \href{\CourseURL{#1}{#2}{#3}}{%
+  \mbox{\smallersize#3}}}};%
+\fi
 \@outputImapData#1,#2:{#3}{2}{1}%
+\end{pgfonlayer}%
 }
 
 \def\@text#1,#2:#3{%
 % include coordinates if grid on, but don't hyperlink if grid off
+\begin{pgfonlayer}{courses}%
 \ifgridon
   \node[fill=white,draw=white,inner ysep=1.8pt](x#1y#2) at (#1,#2)%
 {\href{coord: #1,#2}{\mbox{#3}}};%
 \else
-  \node[fill=white,draw=white,inner ysep=1.8pt](x#1y#2) at (#1,#2){\mbox{#3}};%
+  \node[fill=none,draw=none,inner ysep=1.8pt](x#1y#2) at (#1,#2){\mbox{#3}};%
 \fi
+\end{pgfonlayer}%
 }
 
 \def\@prereq#1,#2,#3,#4:{%
@@ -475,6 +632,7 @@
 
 
 \def\@straight#1,#2,#3,#4:{%
+  \begin{pgfonlayer}{arrows}
   \draw[draw=white,line width=1.5pt](x#1y#2) -- (x#3y#4) ;
   \draw[-latex',draw=white,very thin](x#1y#2) -- (x#3y#4) ;
   \ifgridon
@@ -482,6 +640,7 @@
   \else
     \draw[line width=\solidwidth](x#1y#2) -- (x#3y#4) ;
   \fi
+  \end{pgfonlayer}
 }
 
 
@@ -496,6 +655,7 @@
   \fi
   \setcounter{@myangle}{\the@myangle / ((\the@dx + \the@dy) * (\the@dx + \the@dy))}
   \setcounter{@inangle}{180 - \the@myangle}
+  \begin{pgfonlayer}{arrows}
   \draw[draw=white,line width=1.5pt](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] (x#3y#4) ;
   \draw[-latex',draw=white,very thin](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] (x#3y#4) ;
   \ifgridon
@@ -503,9 +663,11 @@
   \else
     \draw[line width=\solidwidth](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] (x#3y#4) ;
   \fi
+  \end{pgfonlayer}
 }
 
 \def\@straightDashed#1,#2,#3,#4:{%
+\begin{pgfonlayer}{arrows}
 \draw[draw=white,line width=1.5pt] (x#1y#2) -- (x#3y#4);
 \draw[-latex',draw=white,very thin] (x#1y#2) -- (x#3y#4);
 \ifgridon
@@ -513,6 +675,7 @@
 \else
   \draw[dashed,line width=\dashedwidth] (x#1y#2) -- (x#3y#4);
 \fi
+\end{pgfonlayer}
 }
 
 \def\@curvedDashed#1,#2,#3,#4;#5:{
@@ -526,6 +689,7 @@
   \fi
   \setcounter{@myangle}{\the@myangle / ((\the@dx + \the@dy) * (\the@dx + \the@dy))}
   \setcounter{@inangle}{180 - \the@myangle}
+  \begin{pgfonlayer}{arrows}
   \draw[draw=white,line width=1.5pt](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] (x#3y#4) ;
   \draw[-latex',draw=white,very thin](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] (x#3y#4) ;
   \ifgridon
@@ -533,9 +697,11 @@
   \else
     \draw[dashed,line width=\dashedwidth](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] (x#3y#4);
   \fi
+  \end{pgfonlayer}
 }
 
 \def\@straightDotted#1,#2,#3,#4:{%
+  \begin{pgfonlayer}{arrows}
   \draw[draw=white,line width=1.5pt] (x#1y#2) -- (x#3y#4);
   \draw[-latex',draw=white,very thin] (x#1y#2) -- (x#3y#4);
   \ifgridon
@@ -543,6 +709,7 @@
   \else
     \draw[loosely dotted,line width=\dottedwidth] (x#1y#2) -- (x#3y#4);
   \fi
+  \end{pgfonlayer}
 }
 
 \def\@curvedDotted#1,#2,#3,#4;#5:{
@@ -556,6 +723,7 @@
   \fi
   \setcounter{@myangle}{\the@myangle / ((\the@dx + \the@dy) * (\the@dx + \the@dy))}
   \setcounter{@inangle}{180 - \the@myangle}
+  \begin{pgfonlayer}{arrows}
   \draw[draw=white,line width=1.5pt](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] (x#3y#4) ;
   \draw[-latex',draw=white,very thin](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] (x#3y#4) ;
   \ifgridon
@@ -563,35 +731,15 @@
   \else
     \draw[loosely dotted,line width=\dottedwidth](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] (x#3y#4) ;
   \fi
+  \end{pgfonlayer}
 }
 
-\def\solidarrow{%
-\tikz[x=\unit,y=\unit,baseline=\baselineAdj]
-\draw[-latex',line width =\solidwidth] (0,0) -- (4,0);
-}
-
-\def\dottedarrow{%
-\tikz[x=\unit,y=\unit,baseline=\baselineAdj]
-\draw[loosely dotted,line width=\dottedwidth,-latex'] (0,0) -- (4,0);
-}
-
-\def\dashedarrow{%
-\tikz[x=\unit,y=\unit,baseline=\baselineAdj]
-\draw[dashed,line width=\dashedwidth,-latex'] (0,0) -- (4,0);
-}
-
-\def\lightbox{%
-\tikz[thin,baseline=\baselineAdj]\node[draw,fill=\background,rounded corners=2pt,inner sep=1.8pt] 
-{\textsf{light}};}
-
-\def\boldbox{%
-\tikz[baseline=\baselineAdj]\node[draw,line width=\boldwidth,fill=\background,rounded corners=2pt,inner sep=1.8pt] 
-{\textsf{\textbf{bold}}};}
 
 \def\@grid{
   \gridontrue
   \renewcommand{\CourseURL}[3]{coord: ##1,##2} % "coord:" makes it look like a URI
 
+  \begin{pgfonlayer}{grid}
   \draw[line width=0.3pt,draw=verylight] (0,0) grid [step=1]  (\value{@gridright},\value{@gridtop});
   \draw[line width=0.4pt,draw=somewhatlight] (0,0) grid [step=5] (\value{@gridright},\value{@gridtop});
    
@@ -613,6 +761,7 @@
   \setcounter{@gridtop}{\value{@gridtop} + 4}
   \setcounter{@gridright}{\value{@gridright} + 5}
   \node at (\the@gridright,\the@gridtop) {\href{anchor: \the@gridright,\the@gridtop}{\kern1sp}};  
+  \end{pgfonlayer}
 }
 
 %
@@ -638,10 +787,14 @@
   \let\halfcoursec=\@halfcoursec
   \let\reqhalfcourse=\@reqhalfcourse
   \let\reqhalfcoursec=\@reqhalfcoursec
+  \let\opthalfcourse=\@opthalfcourse
+  \let\opthalfcoursec=\@opthalfcoursec
   \let\fullcourse=\@fullcourse
   \let\fullcoursec=\@fullcoursec
   \let\reqfullcourse=\@reqfullcourse
   \let\reqfullcoursec=\@reqfullcoursec
+  \let\optfullcourse=\@optfullcourse
+  \let\optfullcoursec=\@optfullcoursec
   \let\mini=\@mini
   \let\text=\@text
   \let\prereq=\@prereq
-- 
cgit v1.2.3

