Debian Codegraph @

texmf-dist/doc/latex/prerex/prerex.tex

raw
1 \documentclass[11pt]{article}
2 \usepackage[osf]{mathpazo}
3 \usepackage[medium,semibold,scale=0.95]{cabin}
4 \usepackage{fullpage}
5 \usepackage{prerex}
6 \newcommand{\myurl}[1]{\textcolor{blue}{\underline{\textcolor{black}{\url{#1}}}}}
7 %\def\LaTeX{\mbox{LaTeX}}
8 \begin{document}
9
10 \title{\textsf{prerex.sty}: Prerequisite Charts in \LaTeX\\{\large Version 6.6}}
11 \author{R. D. Tennent\\\texttt{[email protected]}}
12 \date{\today}
13 \maketitle
14 \thispagestyle{empty}
15
16 \section{Description}
17 \texttt{prerex.sty}
18 defines macros that
19 \LaTeX\ processors
20 can use
21 to create charts consisting of labelled course boxes linked by arrows
22 that represent pre- and co-requisite requirements; see
23 the example chart in Figure~\ref{chart} on page~\pageref{chart}.
24 If the source file satisfies the constraints
25 of the
26 \textsf{prerex(5)}
27 format, a chart description may be edited using the
28 \textsf{prerex(1)}
29 interactive editor (as well as any conventional text editor).
30
31 \begin{figure}\small
32 \setcounter{diagheight}{40}
33 \begin{chart}\sf
34 \text 15,40:{\textsf{\textbf{\Large Computer Science}}}
35 \reqfullcourse 50,35:{1083}{Comput.\,Sci.\\Concepts}{TTh 10:00}
36 \reqhalfcourse 25,30:{1303}{Discrete\\Structures}{MWF 9:30}
37 \reqhalfcourse 30,20:{2813}{Computer\\Organiz.\,I}{MWF 8:30}
38 \prereq 50,35,30,20:
39 \prereq 25,30,30,20:
40 \reqhalfcourse 45,20:{2023}{Procedural\\Prog.\,Devel.}{MWF 2:30}
41 \prereq 50,35,45,20:
42 \reqhalfcourse 65,20:{2513}{Informat.\\Systems}{TTh 1:00}
43 \coreq 50,35,65,20:
44 \mini 10,16:{1083}
45 \reqhalfcourse 10,10:{2333}{Computab.\,\&\\Formal\,Lang.}{TTh 11:30}
46 \prereq 25,30,10,10:
47 \prereq 10,16,10,10:
48 \reqhalfcourse 45,10:{2013}{Software\\Engineer.\,I}{MWF 11:30}
49 \prereq 45,20,45,10:
50 \halfcourse 55,10:{2685}{\texttt{C++}\\Program.}{no}
51 \prereq 45,20,55,10:
52 \mini 21,6:{2013}
53 \reqhalfcourse 15,0:{3323}{Data\\Structures}{MWF 10:30}
54 \prereq 25,30,15,0:
55 \prereq 21,6,15,0:
56 \reqhalfcourse 25,0:{3813}{Comput.\\Organiz.\,II}{TTh 8:30}
57 \prereq 30,20,25,0:
58 \reqhalfcourse 35,0:{3413}{Operating\\Systems\,I}{MWF 9:30}
59 \prereq 30,20,35,0:
60 \recomm 45,10,35,0:
61 \halfcourse 45,0:{3013}{Software\\Engineer.\,II}{MWF 11:30}
62 \prereq 45,10,45,0:
63 \halfcourse 58,0:{3513}{Database\\Mngt.\,Sys.\,I}{MWF 8:30 pm}
64 \prereq 65,20,58,0:
65 \prereq 45,10,58,0:
66 \reqhalfcourse 70,0:{3503}{Sys.\,Anal.\\\&\,Design}{TTh 10:00}
67 \prereq 65,20,70,0:
68 \end{chart}
69
70 \paragraph{Notes}
71 \begin{itemize}
72 \item
73 A solid arrow \solidarrow\ indicates a required prerequisite,
74 a dotted arrow \dottedarrow\
75 indicates a corequisite (to be taken before or concurrently), and a
76 dashed arrow \dashedarrow\ indicates a recommended prerequisite.
77 Core courses are in \boldbox\ boxes;
78 other courses (i.e.,~options or prerequisites)
79 are in \lightbox\ boxes.
80 \item Timetable abbreviations: M, T, W, Th, F$=$Mon, Tue, Wed, Thur, Fri, resp.; no$=$not offered.
81 \item \dots
82 \end{itemize}
83 \caption{A Prerequisite Chart}
84 \label{chart}
85 \end{figure}
86 \section{Terminology}
87 A prerequisite chart consists of a number of
88 \emph{course boxes},
89 linked by
90 \emph{arrows}.
91 Courses are either
92 \emph{half}
93 or
94 \emph{full},
95 and may be
96 \emph{required} or \emph{optional} (or neither).
97 Each course box can contain a course
98 \emph{code}
99 (upper left corner),
100 a course
101 \emph{title}
102 (lower half),
103 and
104 \emph{timetable}
105 information
106 (upper right corner).
107 An arrow can be either a \emph{prerequisite} (solid),
108 a \emph{corequisite} (dotted),
109 or
110 \emph{recommended} (dashed).
111 When a conventional arrow would be inappropriate, it is possible to use
112 a
113 \emph{mini}
114 course ``box'' (consisting of just a course code) just above a target box.
115 Lines of text may be placed anywhere on the chart.
116 \section{Coordinate System}
117 A conventional two-dimensional
118 Cartesian coordinate system is used to specify the locations of
119 diagram elements.
120 The
121 origin (where
122 $x = 0$
123 and
124 $y = 0$)
125 is at the lower-left corner of the diagram.
126 The diagram height is configurable; the width is determined by
127 the values of
128 \verb|\textwidth|
129 and
130 an adjustable
131 \verb|\unit|
132 length, which defines the absolute value of a coordinate unit.
133 It is possible to put a coordinate grid with labelled axes
134 in the background of a chart.
135 The coordinates of a
136 \emph{box,}
137 \emph{mini,}
138 or
139 \emph{text}
140 are those of its centre point.
141 An
142 \emph{arrow}
143 is described by the
144 coordinates of the centre points of its source and target boxes/minis/texts.
145
146
147
148 \section{Usage}
149 The command
150 \verb|\usepackage{prerex}|
151 should appear in the document preamble.
152 This will define a \LaTeX\ environment
153 \begin{list}{}{}
154 \item \verb|\begin{chart}|\quad$\cdots$\quad \verb|\end{chart}|
155 \end{list}
156 within which the commands described in the following sub-sections may be used
157 to produce course boxes, minis, texts, and arrows.
158 The order of commands is not significant except
159 that the commands for the source and target boxes of an arrow should
160 precede
161 the command for the arrow, and the \verb|\grid| command, if present, should precede
162 other chart commands.
163
164 \subsection{Course Boxes}
165 The commands producing course boxes have the following forms:
166 \begin{list}{}{}
167 \item \verb|\halfcourse | $x,y$ \verb|:{| \emph{code} \verb|}{| \emph{title} \verb|}{| \emph{timetable} \verb|}|
168 \item \verb|\reqhalfcourse | $x,y$ \verb|:{| \emph{code} \verb|}{| \emph{title} \verb|}{| \emph{timetable} \verb|}|
169 \item \verb|\opthalfcourse | $x,y$ \verb|:{| \emph{code} \verb|}{| \emph{title} \verb|}{| \emph{timetable} \verb|}|
170 \item \verb|\fullcourse | $x,y$ \verb|:{| \emph{code} \verb|}{| \emph{title} \verb|}{| \emph{timetable} \verb|}|
171 \item \verb|\reqfullcourse | $x,y$ \verb|:{| \emph{code} \verb|}{| \emph{title} \verb|}{| \emph{timetable} \verb|}|
172 \item \verb|\optfullcourse | $x,y$ \verb|:{| \emph{code} \verb|}{| \emph{title} \verb|}{| \emph{timetable} \verb|}|
173 \end{list}
174 where
175 $x,y$
176 are the coordinates of the
177 centerpoint
178 of the box, relative to the origin
179 of the coordinate system at the lower-left corner of the diagram.
180 The
181 \emph{code},
182 \emph{title},
183 and
184 \emph{timetable}
185 arguments are arbitrary (well-bracketed) text, possibly with \LaTeX\ markup.
186
187 The following are similar but take an additional argument to specify
188 the (non-default) background color of the course box:
189 \begin{list}{}{}
190 \item \verb|\halfcoursec | $x,y$ \verb|:{| \emph{code} \verb|}{| \emph{title} \verb|}{| \emph{timetable} \verb|}| \verb|{| \emph{color} \verb|}|
191 \item \verb|\reqhalfcoursec | $x,y$ \verb|:{| \emph{code} \verb|}{| \emph{title} \verb|}{| \emph{timetable} \verb|}| \verb|{| \emph{color} \verb|}|
192 \item \verb|\opthalfcoursec | $x,y$ \verb|:{| \emph{code} \verb|}{| \emph{title} \verb|}{| \emph{timetable} \verb|}| \verb|{| \emph{color} \verb|}|
193 \item \verb|\fullcoursec | $x,y$ \verb|:{| \emph{code} \verb|}{| \emph{title} \verb|}{| \emph{timetable} \verb|}| \verb|{| \emph{color} \verb|}|
194 \item \verb|\reqfullcoursec | $x,y$ \verb|:{| \emph{code} \verb|}{| \emph{title} \verb|}{| \emph{timetable} \verb|}| \verb|{| \emph{color} \verb|}|
195 \item \verb|\optfullcoursec | $x,y$ \verb|:{| \emph{code} \verb|}{| \emph{title} \verb|}{| \emph{timetable} \verb|}| \verb|{| \emph{color} \verb|}|
196 \end{list}
197
198 \subsection{Mini Course Boxes and Texts}
199 A mini course ``box'' is produced by a command of the form
200 \begin{list}{}{}
201 \item \verb|\mini| $x,y$ \verb|:{| \emph{code} \verb|}|
202 \end{list}
203 A paragraph of text is produced by a command of the form
204 \begin{list}{}{}
205 \item \verb|\text| $x,y$ \verb|:{| \emph{text} \verb|}|
206 \end{list}
207 There are several differences between minis and texts.
208 The maximum length allowed for a course-code may be less than that
209 for texts. A sans-serif font and a reduced font size is
210 used for a course-code. A course-code
211 may be hyperlinked but a text is not (except when the coordinate grid is on).
212
213
214 \subsection{Arrows}
215 Arrows between course boxes (or minis or texts) are produced
216 by commands of the form
217 \begin{list}{}{}
218 \item \verb|\prereq| $ x_0,y_0,x_1,y_1$\verb|:|
219 \item \verb|\coreq| $ x_0,y_0,x_1,y_1$\verb|:|
220 \item \verb|\recomm| $ x_0,y_0,x_1,y_1$\verb|:|
221 \end{list}
222 These produce, respectively, solid, dotted, and dashed arrows from
223 the course box (or mini or text) centered at coordinates
224 $x_0,y_0$
225 to the entity centered at coordinates
226 $x_1,y_1$.
227
228 Arrows by default have a
229 non-zero curvature (unless they are very short). It is possible to override the default curvature
230 for a particular arrow by using
231 the instructions
232 \begin{list}{}{}
233 \item \verb|\prereqc| $ x_0,y_0,x_1,y_1;c$\verb|:|
234 \item \verb|\coreqc| $ x_0,y_0,x_1,y_1;c$\verb|:|
235 \item \verb|\recommc| $ x_0,y_0,x_1,y_1;c$\verb|:|
236 \end{list}
237 where
238 $c$
239 is an integer in the range $0$--$100$ specifying the desired curvature; for example,
240 $c= 0$
241 will produce a
242 straight
243 arrow. Negative curvatures are also allowed.
244 To change the default curvature for all arrows, the user program may redefine the
245 \verb|\DefaultCurvature|
246 command.
247 \subsection{Web Links}
248 \label{WebLinks}
249 Course boxes and minis may be hyperlinked.
250 The default URL for course boxes is
251 \emph{course-code}\verb|.html|
252 where
253 \emph{course-code}
254 is
255 the
256 \emph{code}
257 argument
258 of the course box. The URL scheme may be changed by the user
259 by re-defining the
260 \verb|\CourseURL|
261 command; see Section~\ref{Configuration}.
262 \subsection{Coordinate Grid}
263 The following command produces a coordinate grid with labelled axes, which is
264 useful while editing a diagram:
265 \begin{list}{}{}
266 \item \verb|\grid|
267 \end{list}
268 This is normally placed before all the other chart commands so that
269 grid lines are in the background, covered by course boxes, minis, texts, and arrows,
270 as in Figure~\ref{grid} on page~\pageref{grid}.
271
272 The \verb|\grid| command
273 also redefines the \verb|CourseURL| command
274 so that, in suitable PDF viewers,
275 if the mouse cursor is placed over a box, mini, or midpoint of an arrow,
276 the \emph{coordinates} of the box/mini/text(or the coordinates of the source \emph{and} target
277 of the arrow) will be displayed
278 either in the
279 status bar
280 or in a
281 ``tooltip.''
282 This coordinate display make it easier to edit chart descriptions.
283 When the grid is on, the mid-point of every arrow is highlighted by
284 a ``bullet''.
285
286 The
287 \texttt{prerex}
288 package at
289 \url{http://mirror.ctan.org/graphics/prerex/}
290 contains source code for a graphical frontend
291 \texttt{vprerex} to the \texttt{prerex}
292 editor. It incorporates a minimalistic prerex-enabled PDF viewer
293 which allows coordinates of course boxes,
294 arrows, and
295 background points to be captured in the X selection clipboard (for pasting into a
296 command being composed at the
297 \texttt{prerex}
298 prompt).
299
300
301 \begin{figure}\small
302 \setcounter{diagheight}{40}
303 \begin{chart}\sf
304 \grid
305 \text 15,40:{\textsf{\textbf{\Large Computer Science}}}
306 \reqfullcourse 50,35:{1083}{Comput.\,Sci.\\Concepts}{TTh 10:00}
307 \reqhalfcourse 25,30:{1303}{Discrete\\Structures}{MWF 9:30}
308 \reqhalfcourse 30,20:{2813}{Computer\\Organiz.\,I}{MWF 8:30}
309 \prereq 25,30,30,20:
310 \prereq 50,35,30,20:
311 \reqhalfcourse 45,20:{2023}{Procedural\\Prog.\,Devel.}{MWF 2:30}
312 \prereq 50,35,45,20:
313 \reqhalfcourse 65,20:{2513}{Informat.\\Systems}{TTh 1:00}
314 \coreq 50,35,65,20:
315 \mini 10,16:{1083}
316 \reqhalfcourse 10,10:{2333}{Computab.\,\&\\Formal\,Lang.}{TTh 11:30}
317 \prereq 10,16,10,10:
318 \prereq 25,30,10,10:
319 \reqhalfcourse 45,10:{2013}{Software\\Engineer.\,I}{MWF 11:30}
320 \prereq 45,20,45,10:
321 \halfcourse 55,10:{2685}{\texttt{C++}\\Program.}{no}
322 \prereq 45,20,55,10:
323 \mini 21,6:{2013}
324 \reqhalfcourse 15,0:{3323}{Data\\Structures}{MWF 10:30}
325 \prereq 21,6,15,0:
326 \prereq 25,30,15,0:
327 \reqhalfcourse 25,0:{3813}{Comput.\\Organiz.\,II}{TTh 8:30}
328 \prereq 30,20,25,0:
329 \reqhalfcourse 35,0:{3413}{Operating\\Systems\,I}{MWF 9:30}
330 \recomm 45,10,35,0:
331 \prereq 30,20,35,0:
332 \halfcourse 45,0:{3013}{Software\\Engineer.\,II}{MWF 11:30}
333 \prereq 45,10,45,0:
334 \halfcourse 58,0:{3513}{Database\\Mngt.\,Sys.\,I}{MWF 8:30 pm}
335 \prereq 45,10,58,0:
336 \prereq 65,20,58,0:
337 \reqhalfcourse 70,0:{3503}{Sys.\,Anal.\\\&\,Design}{TTh 10:00}
338 \prereq 65,20,70,0:
339 \end{chart}
340 \vspace*{2ex}
341 \caption{A Prerequisite Chart with a Coordinate Grid}
342 \label{grid}
343 \end{figure}
344 \subsection{Stand-Alone Commands}
345 The following commands may be used outside a
346 \verb|chart|
347 environment, such as in the explanatory notes for a chart:
348 \begin{center}
349 \begin{tabular}{lc}
350 \verb|\solidarrow| & \solidarrow\\
351 \verb|\dottedarrow| & \dottedarrow \\
352 \verb|\dashedarrow| & \dashedarrow \\
353 \verb|\lightbox| & \sf\small\lightbox \\
354 \verb|\boldbox| & \sf\small\boldbox \\
355 \verb|\dottedbox| & \sf\small\dottedbox \\
356 \end{tabular}
357 \end{center}
358
359 \section{Dependencies}
360 \sloppypar
361 This implementation of
362 \verb|prerex.sty|
363 uses
364 \verb|pgf|
365 (version~3.0.0 or later)
366 with add-on package
367 \verb|tikz|.
368 The following additional packages are used:
369 \verb|multido|,
370 \verb|relsize|,
371 \verb|calc|,
372 \verb|textcomp|,
373 \verb|xcolor|,
374 and
375 \verb|hyperref|.
376 \emph{Either} \verb\pdflatex\
377 \emph{or}
378 \verb\xelatex\
379 \emph{or}
380 \verb\latex\, followed by \verb\dvips\ and, possibly, \verb\ps2pdf\
381 \emph{or}
382 \verb\latex\ (with suitable driver options), followed by either \verb\dvipdfmx\
383 or \verb\dvisvgm\ may be used.
384
385 \pagebreak
386
387
388 \section{Installation}
389
390 \begin{enumerate}
391 \item install the most recent version of
392 \verb\pgf\ from \url{http://sourceforge.net/projects/pgf/}.
393 \item copy \verb|prerex.sty| to \emph{your-texmf-tree}\verb|/tex/latex/misc|
394 \item copy \verb|doc/prerex.{tex,pdf}| to \emph{your-texmf-tree}\verb|/doc/latex/misc|
395 \item if necessary, refresh the \TeX\ database (e.g., \verb|texhash|)
396 \item on a \textsc{Unix}-like system, copy \verb|doc/prerex.5| and \verb|doc/prerex.sty.7| to sub-directories of a \verb|man| directory on your
397 \verb|MANPATH|
398 \end{enumerate}
399
400 \section{Configuration}
401 \label{Configuration}
402 The following are defined by the style file but may be re-defined by the
403 user:
404 \begin{list}{}{}
405 \item \verb|\newcommand{\DefaultCurvature}{20}|
406 \end{list}
407 where the argument should be in the range $0$--$100$; $0$ means no curvature.
408 \begin{list}{}{}
409 \item \verb|\newcommand{\CourseURL}[3]{./#3.html}|
410 \end{list}
411 where the arguments supplied at the call are the $x$ and $y$ coordinates
412 of the box or mini and the course code.
413 \begin{list}{}{}
414 \item \verb|\newcommand{\background}{yellow!15}|
415 \end{list}
416 which specifies the default background color of course boxes.
417 \begin{list}{}{}
418 \item \verb|\setlength{\unit}{5.7816pt}|
419 \end{list}
420 which defines the absolute size of a coordinate unit;
421 this yields 10 pixels per
422 coordinate unit if the chart is converted to an image at 125 dpi.
423 \begin{list}{}{}
424 \item \verb|\newcommand{\dpi}{125}|
425 \item \verb|\newcommand{\PixelsPerUnit}{10}|
426 \end{list}
427 \begin{list}{}{}
428 \item \verb|\setcounter{diagheight}{75}|
429 \end{list}
430 which is the
431 $y$-coordinate
432 of the top of the diagram (reduced to $65$ in landscape mode);
433 the nominal diagram width is
434 \verb|\textwidth|~$\div$~\verb|\unit|~$+ 10$.
435
436
437 The following define the thicknesses of the three kinds of arrows,
438 and the thickness of bold boxes:
439 \begin{list}{}{}
440 \item
441 \verb|\newcommand{\solidwidth}{0.5pt}|
442 \item
443 \verb|\newcommand{\dottedwidth}{0.8pt}|
444 \item
445 \verb|\newcommand{\dashedwidth}{0.5pt}|
446 \item
447 \verb|\newcommand{\boldwidth}{1.0pt}|
448 \end{list}
449
450 The following command is used to change to a smaller size for course codes,
451 timetable information, and mini-course codes:
452 \begin{list}{}{}
453 \item
454 \verb|\newcommand{\smallersize}{\relsize{-3}}|
455 \end{list}
456
457 The following command defines the baseline adjustment for the stand-alone arrows and boxes;
458 this parameter is font-dependent.
459 \begin{list}{}{}
460 \item
461 \verb|\newcommand{\baselineAdj}{-0.5ex}|
462 \end{list}
463
464 \section{Conversion to Scalable Vector Graphic Format}
465
466 Scalable Vector Graphics (SVG) is an emerging standard for high-quality graphics. It is supported
467 by all modern browsers natively, making it ideal for posting charts on the web.
468 An SVG image is comparable in quality
469 to a chart in PDF and, when compressed, is comparable in size.
470 The \texttt{dvisvgm}\footnote{%
471 \myurl{http://dvisvgm.sourceforge.net/}; also available from CTAN and in TeXLive.}
472 program may be used to produce a (compressed) SVG image directly from \verb\latex\ output,
473 provided suitable class options are used.
474
475 Another approach is to use \texttt{pdf2svg}\footnote{%
476 \myurl{http://www.cityinthesky.co.uk/opensource/pdf2svg/}},
477 a small program that uses \texttt{poppler} and \texttt{cairo} libraries
478 to convert a PDF page to a scalable vector-graphic image.
479
480 Unfortunately, many web \emph{servers} are not properly configured for \texttt{svgz}
481 (or even \texttt{svg}) content.
482 If you encounter this problem, try renaming the file to have extension
483 \verb\.svg.gz\; otherwise, check out the information appropriate to your server software below:
484 \begin{itemize}{\setlength{\topsep}{0pt}\setlength{\itemsep}{0pt}\setlength{\parsep}{0pt}}
485 \item apache\footnote{%
486 \myurl{https://htaccess.wordpress.com/2008/07/16/sending-correct-content-type-headers-with-htaccess/}}
487
488 \item Microsoft Internet Information Services (IIS)\footnote{%
489 \myurl{http://forums.iis.net/t/1175276.aspx}}
490
491 \item nginx\footnote{%
492 \myurl{http://trac.nginx.org/nginx/ticket/372}}
493
494 \item thttpd\footnote{%
495 \myurl{https://lists.w3.org/Archives/Public/www-svg/2014Mar/0092.html}}
496
497 \item lighttpd\footnote{%
498 \myurl{http://redmine.lighttpd.net/issues/2579}}
499
500 \item cherokee\footnote{%
501 \myurl{https://github.com/cherokee/webserver/issues/101}}
502
503 \item hiawatha\footnote{%
504 \myurl{https://www.hiawatha-webserver.org/forum/topic/1628}}
505
506 \end{itemize}
507
508 \pagebreak
509
510 \section{Implementation Details}
511
512 \subsection{Boxes}
513
514 To improve the appearance, boxes are drawn with slightly rounded corners. The half-course
515 boxes are assigned a minimum height to give a more uniform appearance to horizontal
516 rows of such boxes.
517 The mini and text boxes have white frames and their
518 fill colour is white, which is assumed to be the background colour of the chart.
519 A text box is not normally hyperlinked; however, if the coordinate grid is
520 on, it is hyperlinked and its chart coordinates are encoded in the URI.
521
522 \subsection{Arrows}
523 Arrows with a small height and arrows whose
524 source and target points have equal x or y coordinates are always drawn straight
525 (using a specialized and simpler macro) unless an explicit
526 non-zero curvature argument is provided.
527
528 If the coordinate grid is on, a hyperlink with the source and target coordinates is placed
529 at the mid-point of the arrow.
530
531 A wider background white edge is drawn below an arrow to
532 improve the appearance
533 of crossing arrows; the background also
534 ensures visibility of the
535 arrow when the coordinate grid is on.
536
537 \subsection{Coordinate Grid and Associated Changes}
538 When the coordinate grid is drawn, the \texttt{CourseURL} command
539 is re-defined to pass node coordinates in URIs. Also,
540 two ``anchor'' hyperlinks are inserted at the southwest and northeast corners
541 of the diagram to allow prerex-enabled
542 PDF viewers to compute chart coordinates.
543
544 \section{License}
545 \verb|prerex.sty|, \verb|prerex.sty.7|, \verb|README.prerex| and this document may be distributed and/or modified under the
546 conditions of the \LaTeX\ Project Public License.
547 \end{document}