| 1 |
%% This is file 'prerex.sty' |
| 2 |
%% |
| 3 |
%% Copyright (C) 2006-19 R. D. Tennent, [email protected] |
| 4 |
%% |
| 5 |
%% This work may be distributed and/or modified under the |
| 6 |
%% conditions of the LaTeX Project Public License, either version 1.3 |
| 7 |
%% of this license or (at your option) any later version. |
| 8 |
%% The latest version of this license is in |
| 9 |
%% http://www.latex-project.org/lppl.txt |
| 10 |
%% and version 1.3 or later is part of all distributions of LaTeX |
| 11 |
%% version 2003/12/01 or later. |
| 12 |
%% |
| 13 |
%% This work has the LPPL maintenance status "author-maintained". |
| 14 |
%% |
| 15 |
\NeedsTeXFormat{LaTeX2e}[1995/12/01] |
| 16 |
\ProvidesPackage{prerex}[2019/11/15 v6.8.0 LaTeX style for prerequisite charts, pgf version] |
| 17 |
% |
| 18 |
% Changelog is at the end of the file. |
| 19 |
% |
| 20 |
% Instructions supported inside \begin{chart} ... \end{chart}: |
| 21 |
% |
| 22 |
% \[req|opt]{half|full}course[c] x,y: {course code}{course title}{timetable code}[{color}] |
| 23 |
% |
| 24 |
% \mini x,y: {course code} |
| 25 |
% |
| 26 |
% solid arrow: \prereq x0,y0,x1,y1: \prereqc x0,y0,x1,y1;curvature: |
| 27 |
% dotted arrow: \coreq x0,y0,x1,y1: \coreqc x0,y0,x1,y1;curvature: |
| 28 |
% dashed arrow: \recomm x0,y0,x1,y1: \recommc x0,y0,x1,y1;curvature: |
| 29 |
% |
| 30 |
% \text x,y: {lines of text} |
| 31 |
% |
| 32 |
% \grid coordinate grid background |
| 33 |
% |
| 34 |
% Stand-alone instructions (for explanatory notes): |
| 35 |
% |
| 36 |
% \solidarrow in-line solid arrow |
| 37 |
% \dottedarrow in-line dotted arrow |
| 38 |
% \dashedarrow in-line dashed arrow |
| 39 |
% |
| 40 |
% \lightbox in-line light course box |
| 41 |
% \boldbox in-line bold course box |
| 42 |
% \dottedbox in-line dotted course box |
| 43 |
% |
| 44 |
% The nominal diagram width is (\textwidth divided by \unit) + 10 |
| 45 |
% |
| 46 |
|
| 47 |
\newlength{\unit} |
| 48 |
\setlength{\unit}{5.7816pt} % 10 pixels per unit at 125dpi; 1pt = (1/72.27) in. |
| 49 |
\newcommand{\PixelsPerUnit}{10} |
| 50 |
\newcommand{\dpi}{125} |
| 51 |
|
| 52 |
\RequirePackage{relsize} |
| 53 |
\RequirePackage{calc} |
| 54 |
\RequirePackage{pgf}[2013/12/18] |
| 55 |
\RequirePackage{tikz}\usetikzlibrary{arrows.meta} |
| 56 |
\RequirePackage{textcomp} |
| 57 |
\PassOptionsToPackage{urlcolor=black,colorlinks,raiselinks}{hyperref} |
| 58 |
\RequirePackage{hyperref} |
| 59 |
|
| 60 |
\RequirePackage{xcolor} |
| 61 |
\definecolor{light}{gray}{0.5} |
| 62 |
\definecolor{somewhatlight}{gray}{0.7} |
| 63 |
\definecolor{verylight}{gray}{0.85} |
| 64 |
\definecolor{white}{rgb}{1.0,1.0,1.0} % not transparent, hides grid |
| 65 |
|
| 66 |
\newcommand{\DefaultCurvature}{20} |
| 67 |
% where the argument should be in the range -100:100; 0 means no curvature. |
| 68 |
|
| 69 |
\newcommand{\CourseURL}[3]{#3.html} |
| 70 |
% where the arguments supplied at the call are the x and y coordinates |
| 71 |
% and the course code. |
| 72 |
|
| 73 |
\newcommand{\background}{yellow!15} |
| 74 |
|
| 75 |
\newcommand{\solidwidth}{0.5pt} |
| 76 |
\newcommand{\boldwidth}{1.0pt} |
| 77 |
\newcommand{\dottedwidth}{0.8pt} |
| 78 |
\newcommand{\dashedwidth}{0.5pt} |
| 79 |
\newcommand{\smallersize}{\relsize{-3}} |
| 80 |
\newcommand{\baselineAdj}{-0.5ex} |
| 81 |
|
| 82 |
\newcounter{@myangle} |
| 83 |
\newcounter{@inangle} |
| 84 |
\newcounter{@dx} |
| 85 |
\newcounter{@dy} |
| 86 |
|
| 87 |
\newif\ifgridon |
| 88 |
\gridonfalse |
| 89 |
\newcounter{@gridwidth} |
| 90 |
\newcounter{@gridright} |
| 91 |
\newcounter{@gridheight} |
| 92 |
\newcounter{@gridtop} |
| 93 |
|
| 94 |
\newcounter{@diagwidth} |
| 95 |
\newcounter{diagheight} |
| 96 |
|
| 97 |
\setcounter{diagheight}{75} |
| 98 |
\ifdim\paperwidth>\paperheight |
| 99 |
\setcounter{diagheight}{65} |
| 100 |
\fi |
| 101 |
|
| 102 |
\def\@unitmult{\unit * 5} % used for the grid and as the minimum height of half-course boxes |
| 103 |
|
| 104 |
\pgfsetlayers{} |
| 105 |
|
| 106 |
\def\solidarrow{% |
| 107 |
\tikz[x=\unit,y=\unit,baseline=\baselineAdj] |
| 108 |
\draw[-{Latex[length=4pt]},line width =\solidwidth] (0,0) -- (4,0); |
| 109 |
} |
| 110 |
|
| 111 |
\def\dottedarrow{% |
| 112 |
\tikz[x=\unit,y=\unit,baseline=\baselineAdj] |
| 113 |
\draw[-{Latex[length=4pt]},loosely dotted,line width=\dottedwidth] (0,0) -- (4,0); |
| 114 |
} |
| 115 |
|
| 116 |
\def\dashedarrow{% |
| 117 |
\tikz[x=\unit,y=\unit,baseline=\baselineAdj] |
| 118 |
\draw[-{Latex[length=4pt]},dashed,line width=\dashedwidth] (0,0) -- (4,0); |
| 119 |
} |
| 120 |
|
| 121 |
\def\lightbox{% |
| 122 |
\tikz[thin,baseline=\baselineAdj]\node[draw,rounded corners=2pt,inner xsep=1.8pt] |
| 123 |
{\rule[-2pt]{0pt}{4pt}light}; |
| 124 |
} |
| 125 |
|
| 126 |
\def\boldbox{% |
| 127 |
\tikz[baseline=\baselineAdj]\node[draw,line width=\boldwidth,rounded corners=2pt,inner xsep=1.8pt] |
| 128 |
{\rule[-2pt]{0pt}{4pt}\bfseries bold}; |
| 129 |
} |
| 130 |
|
| 131 |
|
| 132 |
\def\dottedbox{% |
| 133 |
\tikz[baseline=\baselineAdj]\node[draw,dotted,line width=\boldwidth,rounded corners=2pt,inner xsep=1.8pt] |
| 134 |
{\rule[-2pt]{0pt}{4pt}dotted}; |
| 135 |
} |
| 136 |
|
| 137 |
\pgfdeclarelayer{arrows} |
| 138 |
\pgfdeclarelayer{courses} |
| 139 |
\pgfdeclarelayer{grid} |
| 140 |
\pgfsetlayers{grid,arrows,courses,main} |
| 141 |
|
| 142 |
\def\@halfcourse#1,#2:#3#4#5{% |
| 143 |
\begin{pgfonlayer}{courses}% |
| 144 |
\node[draw,thin,fill=\background,minimum height=\@unitmult](x#1y#2) at (#1,#2)% |
| 145 |
{ |
| 146 |
\renewcommand{\arraystretch}{0.8}% |
| 147 |
\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}% |
| 148 |
{\smallersize#3}% |
| 149 |
\,\hfill\,% |
| 150 |
{\smallersize\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}% |
| 151 |
\\ #4% |
| 152 |
\end{tabular}}% |
| 153 |
};% |
| 154 |
\end{pgfonlayer}% |
| 155 |
} |
| 156 |
|
| 157 |
\def\@halfcoursec#1,#2:#3#4#5#6{% |
| 158 |
\begin{pgfonlayer}{courses}% |
| 159 |
\node[draw,thin,fill=#6,minimum height=\@unitmult](x#1y#2) at (#1,#2)% |
| 160 |
{ |
| 161 |
\renewcommand{\arraystretch}{0.8}% |
| 162 |
\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}% |
| 163 |
{\smallersize\selectfont{#3}}% |
| 164 |
\,\hfill\,% |
| 165 |
{\smallersize{\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}}% |
| 166 |
\\ #4% |
| 167 |
\end{tabular}}% |
| 168 |
};% |
| 169 |
\end{pgfonlayer}% |
| 170 |
} |
| 171 |
|
| 172 |
\def\@reqhalfcourse#1,#2:#3#4#5{% |
| 173 |
\begin{pgfonlayer}{courses}% |
| 174 |
\node[draw,line width=\boldwidth,fill=\background,minimum height=\@unitmult](x#1y#2) at (#1,#2)% |
| 175 |
{ |
| 176 |
\renewcommand{\arraystretch}{0.8}% |
| 177 |
\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}% |
| 178 |
{\smallersize\bfseries#3}% |
| 179 |
\,\hfill\,% |
| 180 |
{\smallersize\bfseries\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}% |
| 181 |
\\ #4% |
| 182 |
\end{tabular}% |
| 183 |
}};% |
| 184 |
\end{pgfonlayer}% |
| 185 |
} |
| 186 |
|
| 187 |
\def\@reqhalfcoursec#1,#2:#3#4#5#6{% |
| 188 |
\begin{pgfonlayer}{courses}% |
| 189 |
\node[draw,line width=\boldwidth,fill=#6,minimum height=\@unitmult](x#1y#2) at (#1,#2)% |
| 190 |
{ |
| 191 |
\renewcommand{\arraystretch}{0.8}% |
| 192 |
\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}% |
| 193 |
{\smallersize\bfseries#3}% |
| 194 |
\,\hfill\,% |
| 195 |
{\smallersize\bfseries\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}% |
| 196 |
\\ #4% |
| 197 |
\end{tabular}% |
| 198 |
}};% |
| 199 |
\end{pgfonlayer}% |
| 200 |
} |
| 201 |
|
| 202 |
|
| 203 |
\def\@opthalfcourse#1,#2:#3#4#5{% |
| 204 |
\begin{pgfonlayer}{courses}% |
| 205 |
\node[draw,dotted,line width=\boldwidth,fill=\background,minimum height=\@unitmult](x#1y#2) at (#1,#2)% |
| 206 |
{ |
| 207 |
\renewcommand{\arraystretch}{0.8}% |
| 208 |
\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}% |
| 209 |
{\smallersize#3}% |
| 210 |
\,\hfill\,% |
| 211 |
{\smallersize\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}% |
| 212 |
\\ #4% |
| 213 |
\end{tabular}}% |
| 214 |
};% |
| 215 |
\end{pgfonlayer}% |
| 216 |
} |
| 217 |
|
| 218 |
\def\@opthalfcoursec#1,#2:#3#4#5#6{% |
| 219 |
\begin{pgfonlayer}{courses}% |
| 220 |
\node[draw,dotted,line width=\boldwidth,fill=#6,minimum height=\@unitmult](x#1y#2) at (#1,#2)% |
| 221 |
{ |
| 222 |
\renewcommand{\arraystretch}{0.8}% |
| 223 |
\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}% |
| 224 |
{\smallersize#3}% |
| 225 |
\,\hfill\,% |
| 226 |
{\smallersize\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}% |
| 227 |
\\ #4% |
| 228 |
\end{tabular}}% |
| 229 |
};% |
| 230 |
\end{pgfonlayer}% |
| 231 |
} |
| 232 |
|
| 233 |
\def\@fullcourse#1,#2:#3#4#5{% |
| 234 |
\begin{pgfonlayer}{courses}% |
| 235 |
\node[draw,thin,fill=\background](x#1y#2) at (#1,#2)% |
| 236 |
{ |
| 237 |
\renewcommand{\arraystretch}{1.7}% |
| 238 |
\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}% |
| 239 |
{\smallersize#3}% |
| 240 |
\,\hfill\,% |
| 241 |
{\smallersize\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}% |
| 242 |
\\ #4% |
| 243 |
\end{tabular}}% |
| 244 |
};% |
| 245 |
\end{pgfonlayer}% |
| 246 |
} |
| 247 |
|
| 248 |
\def\@fullcoursec#1,#2:#3#4#5#6{% |
| 249 |
\begin{pgfonlayer}{courses}% |
| 250 |
\node[draw,thin,fill=#6](x#1y#2) at (#1,#2)% |
| 251 |
{ |
| 252 |
\renewcommand{\arraystretch}{1.7}% |
| 253 |
\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}% |
| 254 |
{\smallersize#3}% |
| 255 |
\,\hfill\,% |
| 256 |
{\smallersize\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}% |
| 257 |
\\ #4% |
| 258 |
\end{tabular}}% |
| 259 |
};% |
| 260 |
\end{pgfonlayer}% |
| 261 |
} |
| 262 |
|
| 263 |
\def\@reqfullcourse#1,#2:#3#4#5{% |
| 264 |
\begin{pgfonlayer}{courses}% |
| 265 |
\node[draw,line width=\boldwidth,fill=\background](x#1y#2) at (#1,#2)% |
| 266 |
{ |
| 267 |
\renewcommand{\arraystretch}{1.7}% |
| 268 |
\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}% |
| 269 |
{\smallersize\bfseries#3}% |
| 270 |
\,\hfill\,% |
| 271 |
{\smallersize\bfseries\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}% |
| 272 |
\\ #4% |
| 273 |
\end{tabular}}% |
| 274 |
};% |
| 275 |
\end{pgfonlayer}% |
| 276 |
} |
| 277 |
|
| 278 |
\def\@reqfullcoursec#1,#2:#3#4#5#6{% |
| 279 |
\begin{pgfonlayer}{courses}% |
| 280 |
\node[draw,line width=\boldwidth,fill=#6](x#1y#2) at (#1,#2)% |
| 281 |
{ |
| 282 |
\renewcommand{\arraystretch}{1.7}% |
| 283 |
\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}% |
| 284 |
{\smallersize\bfseries#3}% |
| 285 |
\,\hfill\,% |
| 286 |
{\smallersize\bfseries\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}% |
| 287 |
\\ #4% |
| 288 |
\end{tabular}}% |
| 289 |
};% |
| 290 |
\end{pgfonlayer}% |
| 291 |
} |
| 292 |
|
| 293 |
\def\@fullcoursec#1,#2:#3#4#5#6{% |
| 294 |
\begin{pgfonlayer}{courses}% |
| 295 |
\node[draw,thin,fill=#6](x#1y#2) at (#1,#2)% |
| 296 |
{ |
| 297 |
\renewcommand{\arraystretch}{1.7}% |
| 298 |
\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}% |
| 299 |
{\smallersize#3}% |
| 300 |
\,\hfill\,% |
| 301 |
{\smallersize\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}% |
| 302 |
\\ #4% |
| 303 |
\end{tabular}}% |
| 304 |
};% |
| 305 |
\end{pgfonlayer}% |
| 306 |
} |
| 307 |
|
| 308 |
\def\@optfullcourse#1,#2:#3#4#5{% |
| 309 |
\begin{pgfonlayer}{courses}% |
| 310 |
\node[draw,dotted,line width=\boldwidth,fill=\background](x#1y#2) at (#1,#2)% |
| 311 |
{ |
| 312 |
\renewcommand{\arraystretch}{1.7}% |
| 313 |
\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}% |
| 314 |
{\smallersize#3}% |
| 315 |
\,\hfill\,% |
| 316 |
{\smallersize\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}% |
| 317 |
\\ #4% |
| 318 |
\end{tabular}}% |
| 319 |
};% |
| 320 |
\end{pgfonlayer}% |
| 321 |
} |
| 322 |
|
| 323 |
|
| 324 |
\def\@optfullcoursec#1,#2:#3#4#5#6{% |
| 325 |
\begin{pgfonlayer}{courses}% |
| 326 |
\node[draw,dotted,line width=\boldwidth,fill=#6](x#1y#2) at (#1,#2)% |
| 327 |
{ |
| 328 |
\renewcommand{\arraystretch}{1.7}% |
| 329 |
\href{\CourseURL{#1}{#2}{#3}}{\begin{tabular}{@{\hspace{1pt}}c@{\hspace{1pt}}}% |
| 330 |
{\smallersize#3}% |
| 331 |
\,\hfill\,% |
| 332 |
{\smallersize\renewcommand{\arraystretch}{0.5}\begin{tabular}[t]{@{}r@{}}#5\end{tabular}}% |
| 333 |
\\ #4% |
| 334 |
\end{tabular}}% |
| 335 |
};% |
| 336 |
\end{pgfonlayer}% |
| 337 |
} |
| 338 |
|
| 339 |
\def\@mini#1,#2:#3{% |
| 340 |
\begin{pgfonlayer}{courses}% |
| 341 |
\ifgridon |
| 342 |
\node[fill=white,draw=white](x#1y#2) at (#1,#2)% |
| 343 |
{ |
| 344 |
\href{\CourseURL{#1}{#2}{#3}}{% |
| 345 |
{\smallersize\mdseries#3}}};% |
| 346 |
\else |
| 347 |
\node[fill=none,draw=none](x#1y#2) at (#1,#2)% |
| 348 |
{ |
| 349 |
\href{\CourseURL{#1}{#2}{#3}}{% |
| 350 |
{\smallersize\mdseries#3}}};% |
| 351 |
\fi |
| 352 |
\end{pgfonlayer}% |
| 353 |
} |
| 354 |
|
| 355 |
\def\@text#1,#2:#3{% |
| 356 |
% include coordinates if grid on, but don't hyperlink if grid off |
| 357 |
\begin{pgfonlayer}{courses}% |
| 358 |
\ifgridon |
| 359 |
\node[fill=white,draw=white](x#1y#2) at (#1,#2)% |
| 360 |
{\href{coord: #1,#2}{\sffamily\mdseries\renewcommand{\arraystretch}{0.5}\begin{tabular}[b]{@{}c@{}}#3\\[-0.4ex]\end{tabular}}};% |
| 361 |
\else |
| 362 |
\node[fill=none,draw=none](x#1y#2) at (#1,#2){\sffamily\mdseries\renewcommand{\arraystretch}{0.5}\begin{tabular}[b]{@{}c@{}}#3\\[-0.4ex]\end{tabular}};% |
| 363 |
\fi |
| 364 |
\end{pgfonlayer}% |
| 365 |
} |
| 366 |
|
| 367 |
\def\@prereq#1,#2,#3,#4:{% |
| 368 |
\setcounter{@dy}{#2-#4} |
| 369 |
\ifnum\the@dy<10 |
| 370 |
\@straight#1,#2,#3,#4: |
| 371 |
\else\ifnum#1=#3 |
| 372 |
\@straight#1,#2,#3,#4: |
| 373 |
\else\ifnum#2=#4 |
| 374 |
\@straight#1,#2,#3,#4: |
| 375 |
\else |
| 376 |
\@prereqc#1,#2,#3,#4;\DefaultCurvature: |
| 377 |
\fi\fi\fi |
| 378 |
} |
| 379 |
|
| 380 |
\def\@prereqc#1,#2,#3,#4;#5:{% |
| 381 |
\ifnum#5=0 |
| 382 |
\@straight#1,#2,#3,#4: |
| 383 |
\else |
| 384 |
\@curved#1,#2,#3,#4;#5: |
| 385 |
\fi |
| 386 |
} |
| 387 |
|
| 388 |
\def\@recomm#1,#2,#3,#4:{% |
| 389 |
\setcounter{@dy}{#2-#4} |
| 390 |
\ifnum\the@dy<10 |
| 391 |
\@straightDashed#1,#2,#3,#4: |
| 392 |
\else\ifnum#1=#3 |
| 393 |
\@straightDashed#1,#2,#3,#4: |
| 394 |
\else\ifnum#2=#4 |
| 395 |
\@straightDashed#1,#2,#3,#4: |
| 396 |
\else |
| 397 |
\@recommc#1,#2,#3,#4;\DefaultCurvature: |
| 398 |
\fi\fi\fi |
| 399 |
} |
| 400 |
|
| 401 |
\def\@recommc#1,#2,#3,#4;#5:{% |
| 402 |
\ifnum#5=0 |
| 403 |
\@straightDashed#1,#2,#3,#4: |
| 404 |
\else |
| 405 |
\@curvedDashed#1,#2,#3,#4;#5: |
| 406 |
\fi |
| 407 |
} |
| 408 |
|
| 409 |
\def\@coreq#1,#2,#3,#4:{% |
| 410 |
\setcounter{@dy}{#2-#4} |
| 411 |
\ifnum\the@dy<10 |
| 412 |
\@straightDotted#1,#2,#3,#4: |
| 413 |
\else\ifnum#1=#3 |
| 414 |
\@straightDotted#1,#2,#3,#4: |
| 415 |
\else\ifnum#2=#4 |
| 416 |
\@straightDotted#1,#2,#3,#4: |
| 417 |
\else |
| 418 |
\@coreqc#1,#2,#3,#4;\DefaultCurvature: |
| 419 |
\fi\fi\fi |
| 420 |
} |
| 421 |
|
| 422 |
\def\@coreqc#1,#2,#3,#4;#5:{% |
| 423 |
\ifnum#5=0 |
| 424 |
\@straightDotted#1,#2,#3,#4: |
| 425 |
\else |
| 426 |
\@curvedDotted#1,#2,#3,#4;#5: |
| 427 |
\fi |
| 428 |
} |
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
\def\@straight#1,#2,#3,#4:{% |
| 433 |
\begin{pgfonlayer}{arrows} |
| 434 |
\draw[draw=white,line width=1.5pt](x#1y#2) -- (x#3y#4) ; |
| 435 |
\ifgridon |
| 436 |
\draw[->,line width=\solidwidth](x#1y#2) -- node[anchor=mid] {\href{coord: #1,#2,#3,#4}{\textbullet}} (x#3y#4); |
| 437 |
\else |
| 438 |
\draw[->,line width=\solidwidth](x#1y#2) -- (x#3y#4) ; |
| 439 |
\fi |
| 440 |
\end{pgfonlayer} |
| 441 |
} |
| 442 |
|
| 443 |
|
| 444 |
\def\@curved#1,#2,#3,#4;#5:{ |
| 445 |
\ifnum#4<#2 |
| 446 |
\setcounter{@dy}{#2-#4} |
| 447 |
\ifnum#3<#1 |
| 448 |
\setcounter{@dx}{#1-#3} |
| 449 |
\setcounter{@myangle}{-#5 * \the@dx * \the@dy * 2} |
| 450 |
\else |
| 451 |
\setcounter{@dx}{#3-#1} |
| 452 |
\setcounter{@myangle}{#5 * \the@dx * \the@dy * 2} |
| 453 |
\fi |
| 454 |
\else |
| 455 |
\setcounter{@dy}{#4-#2} |
| 456 |
\ifnum#3<#1 |
| 457 |
\setcounter{@dx}{#1-#3} |
| 458 |
\setcounter{@myangle}{-#5 * \the@dx * \the@dy * 2} |
| 459 |
\else |
| 460 |
\setcounter{@dx}{#3-#1} |
| 461 |
\setcounter{@myangle}{#5 * \the@dx * \the@dy * 2} |
| 462 |
\fi |
| 463 |
\fi |
| 464 |
\setcounter{@myangle}{\the@myangle / ((\the@dx + \the@dy) * (\the@dx + \the@dy))} |
| 465 |
\setcounter{@inangle}{180 - \the@myangle} |
| 466 |
\begin{pgfonlayer}{arrows} |
| 467 |
\draw[draw=white,line width=1.5pt](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] (x#3y#4) ; |
| 468 |
\ifgridon |
| 469 |
\draw[->,line width=\solidwidth](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] node[anchor=mid] {\href{coord: #1,#2,#3,#4}{\textbullet}} (x#3y#4) ; |
| 470 |
\else |
| 471 |
\draw[->,line width=\solidwidth](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] (x#3y#4) ; |
| 472 |
\fi |
| 473 |
\end{pgfonlayer} |
| 474 |
} |
| 475 |
|
| 476 |
\def\@straightDashed#1,#2,#3,#4:{% |
| 477 |
\begin{pgfonlayer}{arrows} |
| 478 |
\draw[draw=white,line width=1.5pt] (x#1y#2) -- (x#3y#4); |
| 479 |
\ifgridon |
| 480 |
\draw[->,dashed,line width=\dashedwidth] (x#1y#2) -- node[anchor=mid] {\href{coord: #1,#2,#3,#4}{\textbullet}} (x#3y#4) ; |
| 481 |
\else |
| 482 |
\draw[->,dashed,line width=\dashedwidth] (x#1y#2) -- (x#3y#4); |
| 483 |
\fi |
| 484 |
\end{pgfonlayer} |
| 485 |
} |
| 486 |
|
| 487 |
\def\@curvedDashed#1,#2,#3,#4;#5:{ |
| 488 |
\ifnum#4<#2 |
| 489 |
\setcounter{@dy}{#2-#4} |
| 490 |
\ifnum#3<#1 |
| 491 |
\setcounter{@dx}{#1-#3} |
| 492 |
\setcounter{@myangle}{-#5 * \the@dx * \the@dy * 2} |
| 493 |
\else |
| 494 |
\setcounter{@dx}{#3-#1} |
| 495 |
\setcounter{@myangle}{#5 * \the@dx * \the@dy * 2} |
| 496 |
\fi |
| 497 |
\else |
| 498 |
\setcounter{@dy}{#4-#2} |
| 499 |
\ifnum#3<#1 |
| 500 |
\setcounter{@dx}{#1-#3} |
| 501 |
\setcounter{@myangle}{-#5 * \the@dx * \the@dy * 2} |
| 502 |
\else |
| 503 |
\setcounter{@dx}{#3-#1} |
| 504 |
\setcounter{@myangle}{#5 * \the@dx * \the@dy * 2} |
| 505 |
\fi |
| 506 |
\fi |
| 507 |
\setcounter{@myangle}{\the@myangle / ((\the@dx + \the@dy) * (\the@dx + \the@dy))} |
| 508 |
\setcounter{@inangle}{180 - \the@myangle} |
| 509 |
\begin{pgfonlayer}{arrows} |
| 510 |
\draw[draw=white,line width=1.5pt](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] (x#3y#4) ; |
| 511 |
\ifgridon |
| 512 |
\draw[->,dashed,line width=\dashedwidth](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] node[anchor=mid] {\href{coord: #1,#2,#3,#4}{\textbullet}} (x#3y#4); |
| 513 |
\else |
| 514 |
\draw[->,dashed,line width=\dashedwidth](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] (x#3y#4); |
| 515 |
\fi |
| 516 |
\end{pgfonlayer} |
| 517 |
} |
| 518 |
|
| 519 |
\def\@straightDotted#1,#2,#3,#4:{% |
| 520 |
\begin{pgfonlayer}{arrows} |
| 521 |
\draw[draw=white,line width=1.5pt] (x#1y#2) -- (x#3y#4); |
| 522 |
\ifgridon |
| 523 |
\draw[->,loosely dotted,line width=\dottedwidth] (x#1y#2) -- node[anchor=mid] {\href{coord: #1,#2,#3,#4}{\textbullet}} (x#3y#4) ; |
| 524 |
\else |
| 525 |
\draw[->,loosely dotted,line width=\dottedwidth] (x#1y#2) -- (x#3y#4); |
| 526 |
\fi |
| 527 |
\end{pgfonlayer} |
| 528 |
} |
| 529 |
|
| 530 |
\def\@curvedDotted#1,#2,#3,#4;#5:{ |
| 531 |
\ifnum#4<#2 |
| 532 |
\setcounter{@dy}{#2-#4} |
| 533 |
\ifnum#3<#1 |
| 534 |
\setcounter{@dx}{#1-#3} |
| 535 |
\setcounter{@myangle}{-#5 * \the@dx * \the@dy * 2} |
| 536 |
\else |
| 537 |
\setcounter{@dx}{#3-#1} |
| 538 |
\setcounter{@myangle}{#5 * \the@dx * \the@dy * 2} |
| 539 |
\fi |
| 540 |
\else |
| 541 |
\setcounter{@dy}{#4-#2} |
| 542 |
\ifnum#3<#1 |
| 543 |
\setcounter{@dx}{#1-#3} |
| 544 |
\setcounter{@myangle}{-#5 * \the@dx * \the@dy * 2} |
| 545 |
\else |
| 546 |
\setcounter{@dx}{#3-#1} |
| 547 |
\setcounter{@myangle}{#5 * \the@dx * \the@dy * 2} |
| 548 |
\fi |
| 549 |
\fi |
| 550 |
\setcounter{@myangle}{\the@myangle / ((\the@dx + \the@dy) * (\the@dx + \the@dy))} |
| 551 |
\setcounter{@inangle}{180 - \the@myangle} |
| 552 |
\begin{pgfonlayer}{arrows} |
| 553 |
\draw[draw=white,line width=1.5pt](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] (x#3y#4) ; |
| 554 |
\ifgridon |
| 555 |
\draw[->,loosely dotted,line width=\dottedwidth](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] node[anchor=mid] {\href{coord: #1,#2,#3,#4}{\textbullet}} (x#3y#4) ; |
| 556 |
\else |
| 557 |
\draw[->,loosely dotted,line width=\dottedwidth](x#1y#2) to[out=\the@myangle,in=\the@inangle,relative] (x#3y#4) ; |
| 558 |
\fi |
| 559 |
\end{pgfonlayer} |
| 560 |
} |
| 561 |
|
| 562 |
|
| 563 |
\def\@grid{ |
| 564 |
\gridontrue |
| 565 |
\renewcommand{\CourseURL}[3]{coord: ##1,##2} % "coord:" makes it look like a URI |
| 566 |
|
| 567 |
\begin{pgfonlayer}{grid} |
| 568 |
\draw[line width=0.3pt,draw=verylight] (0,0) grid [step=1] (\value{@gridright},\value{@gridtop}); |
| 569 |
\draw[line width=0.4pt,draw=somewhatlight] (0,0) grid [step=5] (\value{@gridright},\value{@gridtop}); |
| 570 |
|
| 571 |
\foreach \i in {0,10,...,\value{@gridright}} |
| 572 |
\node at (\i,-4){\small \i}; |
| 573 |
|
| 574 |
\foreach \i in {0,10,...,\value{@gridtop}} |
| 575 |
\node at (-5,\i){\small \i}; |
| 576 |
|
| 577 |
\foreach \i in {0,10,...,\value{@gridright}} |
| 578 |
\node at (\i,\value{@gridtop}+4){\small \i}; |
| 579 |
|
| 580 |
\foreach \i in {0,10,...,\value{@gridtop}} |
| 581 |
\node at (\value{@gridright}+5,\i){\small \i}; |
| 582 |
|
| 583 |
% anchors are to allow computation of coordinates from mouse clicks in kpdf/okular: |
| 584 |
% latex/dvips requires non-null href box |
| 585 |
\node at (-5,-4) {\href{anchor: -5,-4}{\kern1sp}}; |
| 586 |
\setcounter{@gridtop}{\value{@gridtop} + 4} |
| 587 |
\setcounter{@gridright}{\value{@gridright} + 5} |
| 588 |
\node at (\the@gridright,\the@gridtop) {\href{anchor: \the@gridright,\the@gridtop}{\kern1sp}}; |
| 589 |
\end{pgfonlayer} |
| 590 |
} |
| 591 |
|
| 592 |
% |
| 593 |
% |
| 594 |
% \begin{chart} ... \end{chart} |
| 595 |
% |
| 596 |
% |
| 597 |
|
| 598 |
\newenvironment{chart} |
| 599 |
{ \setcounter{@diagwidth}{10 + 1 * \ratio{\textwidth}{\unit}} |
| 600 |
|
| 601 |
\let\halfcourse=\@halfcourse |
| 602 |
\let\halfcoursec=\@halfcoursec |
| 603 |
\let\reqhalfcourse=\@reqhalfcourse |
| 604 |
\let\reqhalfcoursec=\@reqhalfcoursec |
| 605 |
\let\opthalfcourse=\@opthalfcourse |
| 606 |
\let\opthalfcoursec=\@opthalfcoursec |
| 607 |
\let\fullcourse=\@fullcourse |
| 608 |
\let\fullcoursec=\@fullcoursec |
| 609 |
\let\reqfullcourse=\@reqfullcourse |
| 610 |
\let\reqfullcoursec=\@reqfullcoursec |
| 611 |
\let\optfullcourse=\@optfullcourse |
| 612 |
\let\optfullcoursec=\@optfullcoursec |
| 613 |
\let\mini=\@mini |
| 614 |
\let\text=\@text |
| 615 |
\let\prereq=\@prereq |
| 616 |
\let\prereqc=\@prereqc |
| 617 |
\let\coreq=\@coreq |
| 618 |
\let\coreqc=\@coreqc |
| 619 |
\let\recomm=\@recomm |
| 620 |
\let\recommc=\@recommc |
| 621 |
\let\grid=\@grid |
| 622 |
\begin{tikzpicture}[x=\unit,y=\unit,>={Latex[length=4pt,fill=black]}] |
| 623 |
\tikzstyle{every rectangle node}=[inner xsep=1.8pt,rounded corners=2pt,inner ysep=0.5pt] |
| 624 |
\setcounter{@gridwidth}{(\the@diagwidth-5) / 10} |
| 625 |
\setcounter{@gridright}{10 * \value{@gridwidth}} |
| 626 |
\setcounter{@gridheight}{\thediagheight / 10} |
| 627 |
\setcounter{@gridtop}{10 * \value{@gridheight} } |
| 628 |
\useasboundingbox (0,-2) rectangle (\value{@gridright},\value{@gridtop}); |
| 629 |
} |
| 630 |
{ |
| 631 |
\end{tikzpicture} |
| 632 |
} |
| 633 |
% |
| 634 |
% Changelog: |
| 635 |
% |
| 636 |
% Vesrsion 6.8.0 |
| 637 |
% |
| 638 |
% allow for negative curvatures |
| 639 |
% |
| 640 |
% Versin 6.7.0 |
| 641 |
% |
| 642 |
% allow for curved upward arrows |
| 643 |
% |
| 644 |
% Version 6.6.0 |
| 645 |
% |
| 646 |
% remove code to generate \jobname.map and \jobname.sh files |
| 647 |
% |
| 648 |
% Version 6.5.1 |
| 649 |
% |
| 650 |
% undid generation of \jobname.dat file: SVG images (with clickable links) |
| 651 |
% can be generated by latest versions of pdf2svg (0.2.3) or dvisvgm (1.5.3) |
| 652 |
% |
| 653 |
% Version 6.5.0 |
| 654 |
% |
| 655 |
% pdflatex processing now generates an auxiliary file \jobname.dat of link data |
| 656 |
% for use with a SVG image |
| 657 |
% |
| 658 |
% Version 6.4.1 |
| 659 |
% |
| 660 |
% Set length=4pt for arrow tips in tikzpicture options. |
| 661 |
% Remove dependence on the ifthen package. |
| 662 |
% Generate map and cropping script only for pdf output. |
| 663 |
% |
| 664 |
% Version 6.4.0 |
| 665 |
% |
| 666 |
% Revise arrows for tikz version 3.0.0 |
| 667 |
% |
| 668 |
% Version 6.3.6 |
| 669 |
% |
| 670 |
% Allow line breaks in \text boxes. |
| 671 |
% |
| 672 |
% Version 6.3.5 |
| 673 |
% |
| 674 |
% Fix font usage to work with mweights.sty. |
| 675 |
% |
| 676 |
% Version 6.3.4 |
| 677 |
% |
| 678 |
% Timetable and course code in bold for required boxes. |
| 679 |
% |
| 680 |
% Version 6.3.3 |
| 681 |
% |
| 682 |
% Remove background colour from standalone boxes. |
| 683 |
% \smallersize increased to \relsize{-2}. |
| 684 |
% |
| 685 |
% Version 6.3.2 |
| 686 |
% |
| 687 |
% Use pgf layers to keep grid below arrows below boxes (thanks to Ryan Kavanagh). |
| 688 |
% Add struts to stand-alone \...box commands. |
| 689 |
% |
| 690 |
% Version 6.3 |
| 691 |
% |
| 692 |
% Allow "opt" course boxes (with dotted outlines). |
| 693 |
% |
| 694 |
% Version 6.2 |
| 695 |
% |
| 696 |
% Allow for multi-line "timetable" arguments by using nested tabular environments. |
| 697 |
% |
| 698 |
% Version 6.1.0 |
| 699 |
% |
| 700 |
% Added commands to specify background color of non-mini course boxes. |
| 701 |
% |
| 702 |
% Version 6.0.6 |
| 703 |
% |
| 704 |
% Provide \textbullet at mid-point of edges when grid is on. |
| 705 |
% |
| 706 |
% Version 6.0.5 |
| 707 |
% |
| 708 |
% Changed TARGET attribute in AREA outputs to "new". |
| 709 |
% New configuration command \baselineAdj. |
| 710 |
% |
| 711 |
% Version 6.0.4 |
| 712 |
% |
| 713 |
% Added missing initializations of @dy to curved... macros. |
| 714 |
% |
| 715 |
% Version 6.0.3 |
| 716 |
% |
| 717 |
% Added required ALT tag to AREA outputs. |
| 718 |
% |
| 719 |
% Version 6.0 |
| 720 |
% Version 5.7 |
| 721 |
% |
| 722 |
% added implementation details to documentation |
| 723 |
% generated script now only crops the chart image |
| 724 |
% |
| 725 |
% Version 5.6 |
| 726 |
% Version 5.5 |
| 727 |
% |
| 728 |
% version increased to keep pace with previewer/vprerex |
| 729 |
% |
| 730 |
% Version 5.4 |
| 731 |
% |
| 732 |
% code clean-up |
| 733 |
% |
| 734 |
% Version 5.3 |
| 735 |
% |
| 736 |
% produces an image-generating script in \jobname.sh |
| 737 |
% |
| 738 |
% Version 5.2 |
| 739 |
% |
| 740 |
% use \grid and \foreach (tikz) instead of \multido |
| 741 |
% half-course boxes now have a minimum height (5 units) to improve uniformity |
| 742 |
% |
| 743 |
% Version 5.1 |
| 744 |
% |
| 745 |
% generates image-map data in \jobname_n.html for nth chart when n>1 |
| 746 |
% |
| 747 |
% Version 5.0 |
| 748 |
% |
| 749 |
% also generates \jobname.html with image-map data for all node URLs |
| 750 |
% new configuration commands \dpi and \PixelsPerUnit |
| 751 |
% default \unit length adjusted to give 10 pixels per coordinate unit at 125 dpi |
| 752 |
% |
| 753 |
% Version 4.4 |
| 754 |
% |
| 755 |
% increase ysep parameter to 1.8pt to separate course-code or text and arrow tails for minis |
| 756 |
% and text boxes |
| 757 |
% |
| 758 |
% Version 4.3 |
| 759 |
% |
| 760 |
% introduce \smallersize configuration command |
| 761 |
% |
| 762 |
% Version 4.2 |
| 763 |
% |
| 764 |
% using tinting with xcolor package to ease background-color changes |
| 765 |
% |
| 766 |
% Version 4.1 |
| 767 |
% |
| 768 |
% Version 4.0 |
| 769 |
% |
| 770 |
% Implement the \text command to place a line of text (centered at the coordinates) in a chart |
| 771 |
% |
| 772 |
% Version 3.8.1: |
| 773 |
% |
| 774 |
% adjust arraystretch factors to work with long-ascender fonts such as Futura |
| 775 |
% adjust inner sep parameters to work with oblique/italic fonts |
| 776 |
% remove workaround for pgf-1.10 bug described at |
| 777 |
% http://sourceforge.net/forum/forum.php?thread_id=1621660&forum_id=477363 |
| 778 |
% require version 1.18 (or later) of pgf |
| 779 |
% |
| 780 |
% Version 3.8: |
| 781 |
% |
| 782 |
% require version 1.10 (or later) of pgf |
| 783 |
% |
| 784 |
% Version 3.7: |
| 785 |
% |
| 786 |
% anchor nodes must be non-null for latex/dvips |
| 787 |
% |
| 788 |
% Version 3.6: |
| 789 |
% |
| 790 |
% first pgf-based version |
| 791 |
% |
| 792 |
% Version 3.5: |
| 793 |
% Version 3.4: |
| 794 |
% |
| 795 |
% introduce arrow borders to improve the appearance of crossing arrows |
| 796 |
% change default widths to artifacts created when arrow borders |
| 797 |
% occlude box boundaries |
| 798 |
% |
| 799 |
% Version 3.3: |
| 800 |
% |
| 801 |
% arrows (as well as course boxes and minis) are hyperlinked with coordinate URIs |
| 802 |
% |
| 803 |
% Version 3.2: |
| 804 |
% |
| 805 |
% Version 3.1: |
| 806 |
% |
| 807 |
% Version 3.0: |
| 808 |
% |
| 809 |
% "anchor" hyperlinks are added to coordinate grid to allow computation of |
| 810 |
% chart coordinates at mouse clicks |
| 811 |
% |
| 812 |
% Version 2.0: |
| 813 |
% |
| 814 |
% CourseURL now takes 3 arguments |
| 815 |
% box/mini coordinates displayed in (some) PDF viewers when grid on |
| 816 |
% |
| 817 |
% Version 1.0.2: |
| 818 |
% |
| 819 |
% using \relsize{-3} rather than \scriptsize |
| 820 |
% using \textsf in \lightbox and \boldbox |
| 821 |
% |
| 822 |
% Version 1.0.1: |
| 823 |
% |
| 824 |
% using \RequirePackage rather than \usepackage (suggested by Herbert Voss) |
| 825 |
% |
| 826 |
|