| 1 |
.TH PREREX.STY 7 2014-04-11 "prerex.sty-6.6" "" |
| 2 |
.SH NAME |
| 3 |
prerex.sty \- a LaTeX document style for prerequisite charts |
| 4 |
.SH DESCRIPTION |
| 5 |
.B prerex.sty |
| 6 |
defines macros that |
| 7 |
.B [pdf]latex |
| 8 |
can use |
| 9 |
to draw charts consisting of labelled course boxes linked by arrows |
| 10 |
that represent pre- and co-requisite requirements. |
| 11 |
.P |
| 12 |
If the source file satisfies the constraints |
| 13 |
of the |
| 14 |
.BR prerex (5) |
| 15 |
format, a chart description may be edited using the |
| 16 |
.BR prerex (1) |
| 17 |
interactive editor (as well as any conventional text editor). |
| 18 |
.SH TERMINOLOGY |
| 19 |
A prerequisite chart consists of several |
| 20 |
.I course boxes, |
| 21 |
linked by |
| 22 |
.I arrows. |
| 23 |
Courses are either |
| 24 |
.I half |
| 25 |
or |
| 26 |
.I full, |
| 27 |
and may be |
| 28 |
.I required |
| 29 |
or |
| 30 |
.I optional |
| 31 |
(or neither). |
| 32 |
Each course box can contain a course |
| 33 |
.I code |
| 34 |
(upper left corner), |
| 35 |
a course |
| 36 |
.I title |
| 37 |
(lower half), |
| 38 |
and |
| 39 |
.I timetable |
| 40 |
information |
| 41 |
(upper right corner). |
| 42 |
An arrow can be either a |
| 43 |
.I prerequisite |
| 44 |
(solid), |
| 45 |
a |
| 46 |
.I corequisite |
| 47 |
(dotted), |
| 48 |
or |
| 49 |
.I recommended |
| 50 |
(dashed). |
| 51 |
When a conventional arrow would be inappropriate, it is possible to use |
| 52 |
a |
| 53 |
.I mini |
| 54 |
course "box" (consisting of just a course code) just above a target box. |
| 55 |
An arbitrary line of text may be placed anywhere on the chart. |
| 56 |
.SH COORDINATE SYSTEM |
| 57 |
A conventional two-dimensional |
| 58 |
Cartesian coordinate system is used to specify the locations of |
| 59 |
diagram elements. |
| 60 |
The |
| 61 |
origin (where |
| 62 |
.I x = 0 |
| 63 |
and |
| 64 |
.IR "y = 0" ) |
| 65 |
is at the lower-left corner of the diagram. |
| 66 |
The diagram height is configurable; the width is determined by |
| 67 |
the values of |
| 68 |
.I \etextwidth |
| 69 |
and |
| 70 |
an adjustable |
| 71 |
.I \eunit |
| 72 |
length, which defines the absolute value of a coordinate unit. |
| 73 |
It is possible to put a coordinate grid with labelled axes |
| 74 |
in the background of a chart. |
| 75 |
The coordinates of a |
| 76 |
.I box, |
| 77 |
.I mini, |
| 78 |
or |
| 79 |
.I text-line |
| 80 |
are those of its centre point. |
| 81 |
An |
| 82 |
.I arrow |
| 83 |
is described by the |
| 84 |
coordinates of the centre points of its source and target boxes/minis/text-lines. |
| 85 |
.SH USAGE |
| 86 |
The command |
| 87 |
.B \eusepackage{prerex} |
| 88 |
should appear in the document preamble. |
| 89 |
This will define a LaTeX environment |
| 90 |
.IP |
| 91 |
.BI \ebegin{chart} " ... " \eend{chart} |
| 92 |
.LP |
| 93 |
within which the following commands may be used |
| 94 |
to produce course boxes, minis, text-lines, and arrows. |
| 95 |
The order of commands is not significant except |
| 96 |
that the commands for the source and target boxes of an arrow should |
| 97 |
.I precede |
| 98 |
the command for the arrow. |
| 99 |
.SH COURSE BOXES |
| 100 |
The commands producing course boxes have the following forms: |
| 101 |
.IP |
| 102 |
.BI \ehalfcourse " x,y" :{ code }{ title }{ timetable } |
| 103 |
.IP |
| 104 |
.BI \efullcourse " x,y" :{ code }{ title }{ timetable } |
| 105 |
.IP |
| 106 |
.BI \ereqhalfcourse " x,y" :{ code }{ title }{ timetable } |
| 107 |
.IP |
| 108 |
.BI \ereqfullcourse " x,y" :{ code }{ title }{ timetable } |
| 109 |
.IP |
| 110 |
.BI \eopthalfcourse " x,y" :{ code }{ title }{ timetable } |
| 111 |
.IP |
| 112 |
.BI \eoptfullcourse " x,y" :{ code }{ title }{ timetable } |
| 113 |
.LP |
| 114 |
where |
| 115 |
.I x,y |
| 116 |
are the coordinates of the |
| 117 |
.I centerpoint |
| 118 |
of the box, relative to the origin |
| 119 |
of the coordinate system at the lower-left corner of the diagram. |
| 120 |
The |
| 121 |
.I code, |
| 122 |
.I title, |
| 123 |
and |
| 124 |
.I timetable |
| 125 |
arguments are arbitrary (well-bracketed) text, possibly with LaTeX markup. |
| 126 |
|
| 127 |
The following are similar but take an additional argument to specify the (non-default) |
| 128 |
background color of the course box: |
| 129 |
.IP |
| 130 |
.BI \ehalfcoursec " x,y" :{ code }{ title }{ timetable }{ color } |
| 131 |
.IP |
| 132 |
.BI \efullcoursec " x,y" :{ code }{ title }{ timetable }{ color } |
| 133 |
.IP |
| 134 |
.BI \ereqhalfcoursec " x,y" :{ code }{ title }{ timetable }{ color } |
| 135 |
.IP |
| 136 |
.BI \ereqfullcoursec " x,y" :{ code }{ title }{ timetable }{ color } |
| 137 |
.IP |
| 138 |
.BI \eopthalfcoursec " x,y" :{ code }{ title }{ timetable }{ color } |
| 139 |
.IP |
| 140 |
.BI \eoptfullcoursec " x,y" :{ code }{ title }{ timetable }{ color } |
| 141 |
.LP |
| 142 |
.SH MINI COURSE BOXES AND TEXT LINES |
| 143 |
A mini course "box" is produced by a command of the form |
| 144 |
.IP |
| 145 |
.BI \emini " x,y" :{ code } |
| 146 |
.LP |
| 147 |
The following instruction places a line of text centered at the coordinates: |
| 148 |
.IP |
| 149 |
.BI \etext " x,y" :{ text-line } |
| 150 |
.LP |
| 151 |
There are several differences between minis and text-lines. |
| 152 |
The maximum length allowed for a course-code may be less than that |
| 153 |
for a text-line. A sans-serif font and a reduced font size is used for a course-code. A course-code |
| 154 |
may be hyperlinked but a text-line is not (except when the coordinate grid is on). |
| 155 |
A |
| 156 |
.B \eparbox |
| 157 |
command |
| 158 |
may be used in the |
| 159 |
.I text-line |
| 160 |
argument if more than one line is desired. |
| 161 |
.SH ARROWS |
| 162 |
Arrows between course boxes (or from a mini or text-line to a course box) are produced |
| 163 |
by commands of the form |
| 164 |
.IP |
| 165 |
.BI \eprereq " x0,y0,x1,y1" : |
| 166 |
.IP |
| 167 |
.BI \ecoreq " x0,y0,x1,y1" : |
| 168 |
.IP |
| 169 |
.BI \erecomm " x0,y0,x1,y1" : |
| 170 |
.LP |
| 171 |
These produce, respectively, solid, dotted, and dashed arrows from |
| 172 |
the course box (or mini or text-line) centered at coordinates |
| 173 |
.I x0,y0 |
| 174 |
to the course box centered at coordinates |
| 175 |
.I x1,y1. |
| 176 |
.PP |
| 177 |
Arrows by default have a |
| 178 |
non-zero curvature (unless they are very short). It is possible to override the default curvature |
| 179 |
for a particular arrow by using |
| 180 |
the instructions |
| 181 |
.IP |
| 182 |
.BI \eprereqc " x0,y0,x1,y1;c" : |
| 183 |
.IP |
| 184 |
.BI \ecoreqc " x0,y0,x1,y1;c" : |
| 185 |
.IP |
| 186 |
.BI \erecommc " x0,y0,x1,y1;c" : |
| 187 |
.LP |
| 188 |
where |
| 189 |
.I c |
| 190 |
is an integer in the range 0-100 specifying the desired curvature; for example, |
| 191 |
.IR c= 0 |
| 192 |
will produce a |
| 193 |
.I straight |
| 194 |
arrow. Negative curvatures are also allowed. To change the default curvature, the user program may redefine the |
| 195 |
.B \eDefaultCurvature |
| 196 |
command. |
| 197 |
.SH WEB LINKS |
| 198 |
Course boxes (including minis) may be hyperlinked. |
| 199 |
The default URL for course boxes is |
| 200 |
.IR ./course-code .html |
| 201 |
where |
| 202 |
.I course-code |
| 203 |
is |
| 204 |
the |
| 205 |
.I code |
| 206 |
argument |
| 207 |
of the course box. The URL scheme may be changed by the user |
| 208 |
by re-defining the |
| 209 |
.B \eCourseURL |
| 210 |
command. |
| 211 |
.SH COORDINATE GRID |
| 212 |
The following command produces a coordinate grid, which is |
| 213 |
useful for editing a diagram: |
| 214 |
.IP |
| 215 |
.B \egrid |
| 216 |
.LP |
| 217 |
The grid lines will be covered by course boxes and arrows. |
| 218 |
The |
| 219 |
.B \egrid |
| 220 |
command |
| 221 |
also redefines the |
| 222 |
.B \eCourseURL |
| 223 |
command |
| 224 |
so that, |
| 225 |
if the mouse cursor is placed over a box or mini in (some) PDF viewers, |
| 226 |
the |
| 227 |
.I coordinates |
| 228 |
of the box, mini, or text-line will be displayed |
| 229 |
as follows: |
| 230 |
in the status bar in |
| 231 |
.BR xpdf |
| 232 |
and |
| 233 |
.BR gpdf , |
| 234 |
and in a "tooltip" in recent versions of |
| 235 |
.BR kpdf " (now re-named" |
| 236 |
.BR okular ), |
| 237 |
.BR evince , |
| 238 |
and |
| 239 |
the Adobe Reader. |
| 240 |
Similarly, the coordinates of the source and target boxes of arrows |
| 241 |
are displayed if the mouse hovers over the mid-point of an arrow, |
| 242 |
Such coordinate displays make it easier to edit chart descriptions. |
| 243 |
When the grid is on, the mid-point of every arrow is highlighted by a |
| 244 |
"bullet". |
| 245 |
.PP |
| 246 |
There is a GUI frontend |
| 247 |
.BR vprerex (1) |
| 248 |
to the |
| 249 |
.BR prerex (1) |
| 250 |
editor which incorporates a minimalistic prerex-enabled PDF viewer. |
| 251 |
.SH STAND-ALONE COMMANDS |
| 252 |
The following commands may be used outside a |
| 253 |
.B chart |
| 254 |
environment, such as in the explanatory notes for a chart: |
| 255 |
.IP |
| 256 |
.B \esolidarrow |
| 257 |
.IP |
| 258 |
.B \edottedarrow |
| 259 |
.IP |
| 260 |
.B \edashedarrow |
| 261 |
.IP |
| 262 |
.B \elightbox |
| 263 |
.IP |
| 264 |
.B \eboldbox |
| 265 |
.IP |
| 266 |
.B \edashedbox |
| 267 |
.LP |
| 268 |
.SH CONFIGURATION |
| 269 |
The following are defined by the style file but may be re-defined by the |
| 270 |
user: |
| 271 |
.IP |
| 272 |
.BI \enewcommand{\eDefaultCurvature}{ 20 } |
| 273 |
.LP |
| 274 |
where the argument should be in the range 0-100; 0 means no curvature. |
| 275 |
.IP |
| 276 |
.BI \enewcommand{\eCourseURL}[3]{ #3.html } |
| 277 |
.LP |
| 278 |
where the arguments supplied at the call are the |
| 279 |
.I x |
| 280 |
and |
| 281 |
.I y |
| 282 |
coordinates of the box or mini and the course code. |
| 283 |
.IP |
| 284 |
.BI \enewcommand{\ebackground}{ LightYellow } |
| 285 |
.LP |
| 286 |
where |
| 287 |
.I LightYellow |
| 288 |
is defined by |
| 289 |
.IP |
| 290 |
.BI \edefinecolor{LightYellow}{ rgb }{ "1.0, 1.0, 0.878431" } |
| 291 |
.IP |
| 292 |
.BI \esetlength{\eunit}{ 5.7816pt } |
| 293 |
.LP |
| 294 |
which defines the absolute size of a coordinate unit; this yields 10 pixels per |
| 295 |
coordinate unit if the chart is converted to an image at 125 dpi. |
| 296 |
.IP |
| 297 |
.BI \enewcommand{\edpi}{ 125 } |
| 298 |
.IP |
| 299 |
.BI \enewcommand{\ePixelsPerUnit}{ 10 } |
| 300 |
.LP |
| 301 |
.IP |
| 302 |
.BI \esetcounter{diagheight}{ 75 } |
| 303 |
.LP |
| 304 |
which is the |
| 305 |
.IR y -coordinate |
| 306 |
of the top of the diagram (reduced to 65 in landscape mode); |
| 307 |
the nominal diagram width is |
| 308 |
.IR \etextwidth " / " \eunit " + " 10. |
| 309 |
.P |
| 310 |
The following define the thicknesses of the three kinds of arrows, |
| 311 |
and the thickness of bold boxes: |
| 312 |
.IP |
| 313 |
.BI \enewcommand{\esolidwidth}{ 0.5pt } |
| 314 |
.IP |
| 315 |
.BI \enewcommand{\edottedwidth}{ 0.8pt } |
| 316 |
.IP |
| 317 |
.BI \enewcommand{\edashedwidth}{ 0.5pt } |
| 318 |
.IP |
| 319 |
.BI \enewcommand{\eboldwidth}{ 1.0pt } |
| 320 |
.LP |
| 321 |
.P |
| 322 |
The following command is used to change to a smaller size for course codes, |
| 323 |
timetable information, and mini-course codes: |
| 324 |
.IP |
| 325 |
.BI \enewcommand{\esmallersize}{\erelsize{-3}} |
| 326 |
.LP |
| 327 |
.P |
| 328 |
The following command defines the baseline adjustment for the stand-alone arrows and boxes; |
| 329 |
this parameter is font-dependent. |
| 330 |
.IP |
| 331 |
.BI \enewcommand{\ebaselineAdj}{ -0.5ex } |
| 332 |
.LP |
| 333 |
.SH DEPEDENCIES |
| 334 |
This implementation of |
| 335 |
.B prerex.sty |
| 336 |
uses |
| 337 |
.B pgf |
| 338 |
(version 3.0 or later) |
| 339 |
with add-on package |
| 340 |
.B tikz. |
| 341 |
The following additional packages are used: |
| 342 |
.B relsize, |
| 343 |
.B calc, |
| 344 |
.B multido, |
| 345 |
.B textcomp, |
| 346 |
.B xcolor, |
| 347 |
and |
| 348 |
.B hyperref. |
| 349 |
.I Either |
| 350 |
.BR pdflatex (1) |
| 351 |
.I or |
| 352 |
.BR latex (1) |
| 353 |
followed by |
| 354 |
.BR dvips (1) |
| 355 |
(and possibly |
| 356 |
.BR ps2pdf (1)) |
| 357 |
.I or |
| 358 |
.BR latex (1) |
| 359 |
followed by |
| 360 |
.BR dvipdfmx (1) |
| 361 |
may be used. |
| 362 |
.P |
| 363 |
To convert a PDF chart to SVG (Scaleable Vector Graphic) format, it is recommended to |
| 364 |
use |
| 365 |
.BR pdf2svg (1), |
| 366 |
obtainable from |
| 367 |
http://www.cityinthesky.co.uk/opensource/pdf2svg/. |
| 368 |
|
| 369 |
.SH IMPLEMENTATION DETAILS |
| 370 |
.P |
| 371 |
To improve the appearance, boxes are drawn with slightly rounded corners. The half-course |
| 372 |
boxes are assigned a minimum height to give a more uniform appearance to horizontal |
| 373 |
rows of such boxes. |
| 374 |
The mini and text boxes have white frames and their |
| 375 |
fill colour is white, which is assumed to be the background colour of the chart. |
| 376 |
A text box is not normally hyperlinked; however, if the coordinate grid is |
| 377 |
on, it is hyperlinked and its chart coordinates are encoded in the URI. |
| 378 |
.P |
| 379 |
Arrows with a small height and arrows whose |
| 380 |
source and target points have equal x or y coordinates are always draw straight |
| 381 |
(using a specialized and simpler macro) unless an explicit |
| 382 |
non-zero curvature argument is provided. |
| 383 |
If the coordinate grid is on, a hyperlink with the source and target coordinates is placed |
| 384 |
at the mid-point of the arrow. |
| 385 |
A wider background white edge is drawn below an arrow to |
| 386 |
improve the appearance |
| 387 |
of crossing arrows; the background also |
| 388 |
ensures visibility of the |
| 389 |
arrow when the coordinate grid is on. |
| 390 |
A thin white arrow (with a visible |
| 391 |
arrowhead) is drawn beneath the visible arrow to obtain a thin arrowhead. |
| 392 |
.P |
| 393 |
When the coordinate grid is drawn, the |
| 394 |
.B CourseURL |
| 395 |
command |
| 396 |
is re-defined to pass node coordinates in URIs. Also, |
| 397 |
two "anchor" hyperlinks are inserted at the southwest and northeast corners |
| 398 |
of the diagram to allow prerex-enabled |
| 399 |
PDF viewers to compute chart coordinates. |
| 400 |
.SH LICENSE |
| 401 |
.B prerex.sty |
| 402 |
and this document may be distributed and/or modified under the |
| 403 |
conditions of the LaTeX Project Public License. |
| 404 |
.SH AUTHOR |
| 405 |
R. D. Tennent ([email protected]) |
| 406 |
.SH SEE ALSO |
| 407 |
.BR dvipdfmx (1), |
| 408 |
.BR dvips (1), |
| 409 |
.BR evince (1), |
| 410 |
.BR gpdf (1), |
| 411 |
.BR kpdf (1), |
| 412 |
.BR latex (1), |
| 413 |
.BR okular (1), |
| 414 |
.BR pdf2svg (1), |
| 415 |
.BR pdflatex (1), |
| 416 |
.BR prerex (1), |
| 417 |
.BR prerex (5), |
| 418 |
.BR ps2pdf (1), |
| 419 |
.BR tikz (1), |
| 420 |
.BR pgf (1), |
| 421 |
.BR vprerex (1), |
| 422 |
and |
| 423 |
.BR xpdf (1). |