prerex (5) - Linux Manuals

prerex: a format for prerequisite-chart descriptions


prerex_format -- a format for prerequisite-chart descriptions


This manual describes the format of prerequisite-chart descriptions that can be processed by [pdf]latex (normally using a suitable prerex.sty(7) style file) and edited using the prerex(1) interactive editor (or by any conventional text editor).


A prerequisite chart consists of a number of course boxes, linked by arrows. Courses are either half or full, and may be required or optional (or neither). Each course box can contain a course code (upper left corner), a course title (lower half), and timetable information (upper right corner). An arrow can be either a prerequisite (solid), a corequisite (dotted), or recommended (dashed). When a conventional arrow would be inappropriate, a mini course just above a target box can be used.


The file should contain exactly one instance of a LaTeX environment

\begin{chart} instruction ... \end{chart}

with at most one instruction per line. Note that a program such as prerex(1) analyzes prerex-format files without using TeX; for example, macro definitions will be ignored and macro calls will not be expanded.

Instructions may be preceded by white space. Lines that start with % are treated as comments and ignored. The order of instructions is not significant except that the instruction for the source and target box o an arrow should precede the instruction for the arrow. The instruction formats are described in the following sections.


The instructions producing course boxes have the following forms:
\halfcourse x,y:{code}{title}{timetable}
\fullcourse x,y:{code}{title}{timetable}
\reqhalfcourse x,y:{code}{title}{timetable}
\reqfullcourse x,y:{code}{title}{timetable}
\opthalfcourse x,y:{code}{title}{timetable}
\optfullcourse x,y:{code}{title}{timetable}

where x,y are the coordinates of the centerpoint of the box, relative to the origin of the coordinate system at the lower-left corner of the diagram. The code, title, and timetable arguments are arbitrary (well-bracketed) text, possibly with LaTeX markup.

The following are similar but take an additional argument to specify the (non-default) background color of the course box:

\halfcoursec x,y:{code}{title}{timetable}{color}
\fullcoursec x,y:{code}{title}{timetable}{color}
\reqhalfcoursec x,y:{code}{title}{timetable}{color}
\reqfullcoursec x,y:{code}{title}{timetable}{color}
\opthalfcoursec x,y:{code}{title}{timetable}{color}
\optfullcoursec x,y:{code}{title}{timetable}{color}


A mini course is produced by an instruction of the form
\mini x,y:{code}
A text line is inserted into the chart by an instruction of the form
\text x,y:{line-of-text}
The maximum allowed length of a course-code may be smaller that the maximum allowed for a line of text.


Arrows between course boxes (or from a mini to a course box) are produced by instructions of the form
\prereq x0,y0,x1,y1:
\coreq x0,y0,x1,y1:
\recomm x0,y0,x1,y1:

These produce, respectively, solid, dotted, and dashed arrows from the course box (or mini) centered at coordinates x0,y0 to the course box centered at coordinates x1,y1.

In some implementations, certain arrows by default have a non-zero curvature. It is possible to override the default curvature for a particular arrow by using the instructions

\prereqc x0,y0,x1,y1;c:
\coreqc x0,y0,x1,y1;c:
\recommc x0,y0,x1,y1;c:

where c is an integer in the range -100:100 specifying the desired curvature; for example, c=0 will produce a straight arrow. To change the default curvature, the user program may redefine the \DefaultCurvature command.


The following instruction produces a coordinate grid, which is useful for editing a diagram:

This is normally placed before all the other instructions so that grid lines are in the background, covered by course boxes, minis, and arrows.


Course boxes may be linked to web addresses. The URL for course boxes may be set by the user by redefining the \CourseURL command; when called for a course box, it is supplied with three arguments, the x and y coordinates of the box, mini, or textline, and the code argument of the course box. For example,

is appropriate for courses at the School of Computing, Queen's University. The first two arguments can be used to display the coordinates of a box, mini, or textline in some PDF viewers while the mouse hovers over it when the source file is being edited.


R. D. Tennent (rdt [at]


prerex(1), prerex.sty(7).