\documentclass[11pt]{article}
\usepackage[textwidth=6.5in,textheight=8.5in]{geometry}
\usepackage[medium,semibold]{cabin}
\listfiles
\usepackage{prerex}

\renewcommand{\textfraction}{0.0}
\renewcommand{\topfraction}{1.00}
\renewcommand{\bottomfraction}{1.00}

\usepackage[osf]{mathpazo}

\definecolor{light}{gray}{0.5}
\definecolor{bg}{rgb}{0.99,0.96,0.90}

\usepackage{graphicx}

\def\LaTeX{\mbox{LaTeX}}
\def\TeX{TeX}
\def\MikTeX{\mbox{MikTeX}}


\newcommand{\myurl}[1]{\textcolor{blue}{\underline{\textcolor{black}{\url{#1}}}}}
\newcommand{\myhref}[2]{\href{#1}{\textcolor{blue}{\underline{\textcolor{black}{#2}}}}}

\title{Prerex-Formatted Prerequisite Charts\\[1ex]\Large An Introduction} 
\date{\today}
\author{Bob Tennent\\School of Computing, Queen's University\\\texttt{rdt@cs.queensu.ca}}

\begin{document}
\sloppy
\maketitle
\thispagestyle{empty}

\tableofcontents


\section{Introduction}
This document is intended to help a user who might want to create or edit prerex-formatted
prerequisite charts, but is finding the installation and usage instructions in the \textsc{readme}
and manual pages to be incomprehensible.

\section{Frequently Asked Questions}


\subsection{Prerequisite Charts}

\subsubsection*{What is a prerequisite chart?}

A prerequisite chart gives an attractive graphical presentation of courses in a
program (or set of related programs), organized by terms or years, linked
by pre- and co-requisite arrows, and, when possible, supplemented by
timetable information; Figure~\ref{chart}
on page~\pageref{chart}
is a small example.

\input{introchart1}

\subsubsection*{Who would use a prerequisite chart?}

Prerequisite charts are useful to students selecting courses and planning their
programs, and to faculty and staff advising students and managing
curriculum development.

\subsubsection*{The information is in calendars and on-line; why is a prerequisite chart needed?}

Conventional sources of course, program and timetable information are
rarely in a user-friendly format. Faculty and staff advisors, being already
fairly familiar with their courses and programs, often do not appreciate
how inconvenient it is for students to access all the information they need
to make course choices.

For example, program requirements are typically specified as lists of
course codes for required and optional courses; one must look elsewhere to
find the titles of the courses, the relations between them, their
prerequisites, and the timetabling information.

As another example, a course description in a calendar typically specifies
what the prerequisite courses are, but hardly ever specifies which course
or courses the course is prerequisite to. This information may be very
important to a student, but to discover it, he or she must search through
all the subsequent course descriptions in the calendar. With a prerequisite
chart, it is evident at a glance.

As a third example, consider a student who wants to know whether they can
defer a course till the following year without risk of timetable conflicts.
With conventional sources of information, such a question can be answered
only by doing an exhaustive search through both timetable and calendar for
a possible conflict. A prerequisite chart incorporating timetable data provides
the necessary information in a compact and usable form, and the question
can be answered immediately.


\subsubsection*{If prerequisite charts are so great, why doesn't every university department have them?}
Few academic departments have the resources to produce prerequisite charts. If
one searches on the web for "prerequisite chart" or "prerequisite diagram," 
virtually all of the matches are from departments that one would
expect to have expertise in technical drawings.
Here are some of these:
\begin{itemize}
\item Queen's University, Electrical and Computer Engineering\footnote{%
\myurl{http://www.ece.queensu.ca/Current-Students/Undergraduate/files/Queens_ECE_prerequisite_graph_2011.pdf}}
\item University of Waterloo, Computer Science\footnote{%
\myurl{http://www.cs.uwaterloo.ca/current/courses/charts/majorPrereq.shtml}}
\item Georgia Tech, Electrical Engineering\footnote{%
\myurl{http://www.ece.gatech.edu/academics/undergrad/ee_prereq.html}}
\item Georgia State University, Computer Science\footnote{%
\myurl{http://www.cs.gsu.edu/sites/default/files/prereq.pdf}}
%\item Iowa State University, Civil, Construction, \& Environmental Engineering\footnote{%
%\myurl{http://www.ccee.iastate.edu/fileadmin/www.ccee.iastate.edu/academics/mechanical-prereq-0507.pdf}}
\item Kansas State University, Mathematics\footnote{%
\myurl{http://www.math.ksu.edu/courses/catalog/prereqcht.pdf}}
%\item Carleton University, Engineering Physics\footnote{%
%\myurl{http://www1.carleton.ca/engineering-design/ccms/wp-content/ccms-files/Engineering-Physics_Aug_19_11.pdf}}
\item Penn State, Computer Science\footnote{%
\myurl{http://cs.hbg.psu.edu/cs/csprereq.html}}
\end{itemize}

\subsection{Prerex-Formatted  Prerequisite Charts}

\subsubsection*{What file formats are used for prerex-formatted charts?}

The charts themselves are best distributed in the Portable Document
Format (PDF) defined by Adobe; PDFs are readable on any platform and in
most browsers using freely-available software (such as the Adobe Reader),
printable on any high-resolution printer, relatively compact, and scalable
to accommodate paper size, display resolution, or user preference.


Prerex-formatted charts are produced by software that processes simple and convenient
text-based descriptions.  These descriptions can be edited in any
text editor or in the \texttt{prerex} interactive editor discussed in Section~\ref{editor}.
The format of chart descriptions is documented
in Section~\ref{source}.

Charts can be converted to Scalable Vector Graphic (SVG)
format for posting on the web. 
SVG images can be rendered directly by all modern web browsers and
are comparable to PDF in quality.  Wnen compressed (\verb\.svgz\), the
size is also comparable to PDF.  
It is fairly easy to
convert charts to SVG images.

\subsubsection*{What software is needed to produce prerex-formatted prerequisite charts?}

To process the description of a prerex-formatted chart, the following software is
essential:
\begin{itemize}
\item an up-to-date standard-conforming implementation of \LaTeX, a powerful
document processing system based on \TeX, a professional-quality typesetting
engine; see Section~\ref{installing}.
\item a few additional \LaTeX\ packages, such as \texttt{pgf}, that may not be included in a minimal \LaTeX\ installation; see Section~\ref{additional};
\item a file \texttt{prerex.sty} of specialized \LaTeX\ definitions,
which is included in the prerex package
available at any repository
of
the Comprehensive TeX Archive Network (CTAN)\footnote{%
\myurl{http://www.ctan.org/}}
and in many \TeX\ distributions.
\end{itemize}
The following additional software is optional but recommended:
\begin{itemize}
\item a PDF viewer that 
\begin{itemize}
\item can be configured to ``watch'' the PDF file so that it re-loads
automatically when this is updated, and 
\item shows hyperlinks
in a ``tooltip'' when the mouse hovers over it, which is a convenient way to get
the coordinates of course boxes and arrows while editing the description;
\end{itemize}
see Section~\ref{PDF}.
\item suitable fonts; see Section~\ref{fonts}.
\item the \texttt{prerex} interactive editor for prerex-formatted charts;
see Section~\ref{editor}.
\item an integrated \LaTeX\ development environment; see Section~\ref{IDE}.
\end{itemize}

\subsubsection*{Why couldn't I use a program like Visio\textsuperscript{\textregistered}\ or CorelDRAW\textsuperscript{\textregistered}\ to produce a prerequisite chart?}
You could, if you have such a program available, are very skilled in its
use, and won't be embarrassed
distributing a chart that looks amateurish. Look carefully at a prerex-formatted 
chart and notice the following properties:
\begin{itemize}
\item Each course box is sized to just enclose the text within it, with
    uniform standard margins.
\item Each arrow between courses is oriented from box centre to box centre,
    rather than from/to standard "connection points" on the box edges.
\item The arrows are "clipped" by the course boxes, but the arrow heads abut
    the target box exactly.
\end{itemize}
These desirable properties are not easily achieved using conventional
``do-it-yourself'' drawing software, no matter how ``user-friendly'' it
purports to be.
The prerex system provides complete flexibility as well as professional
quality:
\begin{itemize}
\item Text within a course box may be partitioned into regions with varying
    characteristics. For example, the course code and the timetable
    information on the first line of course boxes are in a smaller font
    than the course name. The latter is centered and the former are left-
    and right-justified, respectively. Arbitrary \LaTeX\ formatting can be used
    for the text.
\item Any available Type 1 (Postscript) or TrueType format fonts may be used.
    The professional-quality
    typesetting engine takes advantage of kerns and ligatures in the fonts.
\item Line thickness for boxes may be varied; in the example diagram, heavier
    boxes (and bold-face text) are used to indicate that a course is
    "required" in the program, rather than an option.
\item Different styles of connectors can be used, for example to distinguish
    prerequisites, co-requisites, and recommended prerequisites.
\item Various sizes or shapes of course boxes may be used, for example to
    distinguish between half and full courses.
\item Graphic images such as logos can be imported.
\item Colours and hyperlinks to on-line course descriptions or calendars are
    possible.
\end{itemize}
\subsubsection*{Wouldn't a commercial drafting service be able to produce a professional-looking prerequisite chart?}

Possibly, but you will almost certainly have to do the global lay-out
yourself. A more serious long-term problem is that it is unlikely you will
be able to maintain the chart yourself using freely available software. You
will be "locked-in" to use the drafting service for every future
modification of the chart.

If you want the quality and maintainability of a prerex-formatted chart but
don't think you can produce it yourself, you can outsource the production;
check out the following:
\myurl{http://www.prerex.com}.

\subsubsection*{How can a prerex-formatted chart be edited?}
University programs and timetables
change frequently: courses are added or dropped,
pre- or co-requisites or timetabling of courses change, and so on. 
Use of a separate text-based description file and intelligent processing
software make it easy to modify a prerex-formatted chart. If the text within a course
box is changed, the size of the box, the length of connectors to and from
that box, and the location of arrowheads into the box are all adjusted
automatically by the processing software. If a course box must be moved, it
is straightforward to edit the relevant instructions for arrows into or
from the box because the coordinates specified for an arrow are those of
the box centres, rather than those of the edges or corners of the boxes.
Small changes can be made with any text editor. 

For creating a prerex-formatted chart or for 
making substantial changes to an existing chart, the \texttt{prerex} interactive chart editor 
and the graphical ``wrapper'' \texttt{vprerex} are available; 
see Section~\ref{editor}.
Editing a text file in either of these ways is far easier and
faster than trying to fiddle with an image using a mouse.


\section{Viewing and Printing a Prerequisite Chart}
\label{PDF}

A prerequisite chart in Portable Document Format (PDF) can be ``opened'' for
viewing or printing in any PDF viewer.  The most
popular of these is the 
Adobe Reader.\footnote{\myurl{http://www.adobe.com/prodindex/acrobat/readstep2.html}}
However, the Adobe Reader is quite slow to load and somewhat inconvenient to use
if one wants to re-load the document after changing it (normally one must first close the document and
then re-open it). 

There are faster and more convenient alternatives to the Adobe Reader. One 
that is
available for Windows, Macs, and Linux systems is a 
ghostscript-based viewer called 
GSview.\footnote{%
\myurl{http://www.cs.wisc.edu/~ghost/}}
For Windows or Linux: download and install the most recent version of 
ghostscript for your platform,\footnote{%
\myurl{http://www.cs.wisc.edu/~ghost/doc/AFPL/index.htm}}
and then install the most recent version of 
GSview for your platform.\footnote{%
\myurl{http://www.cs.wisc.edu/~ghost/gsview/index.htm}}
For Macs: just get
MacGSView.\footnote{%
\myurl{http://www.cs.wisc.edu/~ghost/macos/index.htm}}

For Linux systems, other ghostscript-based viewers such as 
\texttt{gv}\footnote{%
\myurl{http://wino.physik.uni-mainz.de/~plass/gv/}}
are available.  Also, 
\texttt{xpdf}\footnote{%
\myurl{http://www.foolabs.com/xpdf/home.html}}
is suitable for any X-window based systems, such as any version of Linux.
If Gnome or KDE libraries are installed, variants \texttt{gpdf}, \texttt{kghostview}, \texttt{evince}, and \texttt{kpdf} (now renamed \texttt{okular}) of these programs are available.
You may print a prerequisite chart from within any of these viewing applications.  

If you are \emph{editing} a prerequisite chart (using either a text editor on the
chart description or
the \texttt{prerex} editor), you will want to use a PDF viewer that
not only can be configured to ``watch'' the PDF file (so that it re-loads
automatically when this is updated), but also 
shows hyperlinks
in a ``tooltip'' when the mouse hovers over it; this is a convenient way to get
the coordinates of course boxes and arrows while editing the description.
Recent versions of some of these viewing programs have the latter capability.
The \texttt{vprerex} ``wrapper'' for the \texttt{prerex} editor includes
a built-in \texttt{prerex}-enabled PDF viewer that makes it extremely easy to
transfer coordinates from the chart to the editor.


\section{Installing a Basic \LaTeX\ System}
\label{installing}

To ``process''  a chart description, you will need to install an application
called \LaTeX, together with several auxiliary applications to convert the
output into PDF or other formats.


\LaTeX\ is a powerful document processor based on a professional-quality typesetting program called \TeX.  The following web sites 
will point you to as much information as you might want on \LaTeX\ and \TeX:
\begin{itemize}
\item \LaTeX\ Project home page\footnote{\myurl{http://www.latex-project.org}}
\item \TeX\ Users Group home page\footnote{\myurl{http://www.tug.org/}}  
\item \TeX\ FAQ\footnote{\myurl{http://www.tex.ac.uk/cgi-bin/texfaq2html}}
\end{itemize}

If you use Windows,  
we suggest you install the ``basic'' version of 
MiKTeX.\footnote{%
\myurl{http://www.miktex.org/setup.html}}
If you use Mac~OS~X, go to
the \emph{\TeX\ on Mac OS~X} site.\footnote{%
\myurl{http://www.rna.nl/tex.html}}
\textsc{Unix} and Linux users should install at least the ``basic'' scheme of TeXLive.\footnote{%
\myurl{http://www.tug.org/texlive/}}

The resulting installation will allow you to process simple \texttt{.tex} files. 
However, you won't be able
to process the description of a prerex-formatted prerequisite chart until 
some necessary additional software is installed.

\section{Additional \LaTeX\  Software}
\label{additional}

To process descriptions of prerex-formatted charts,  some additional packages
are needed. 
The file \texttt{prerex.sty} from the \texttt{prerex} package is essential;
it should be stored
in the same folder as the \texttt{.tex} file to be processed
(or in 
a \verb|texmf| tree so the \LaTeX\ system can find it).
Other add-ons that may be necessary are as follows: 
\texttt{pgf}, 
\texttt{tikz}, 
\texttt{multido}, 
\texttt{hyperref},
\texttt{textcomp}, and
\texttt{xcolor}.
If you are using \MikTeX\ or TeXLive, these packages can be installed using their 
package managers.
All of the packages are also available
for download from any CTAN\footnote{%
\myurl{http://www.ctan.org/}} repository.

You are now ready to process the description for a chart.  
Get a command-line
prompt, move to the folder with the chart description and issue the following 
instruction:
\begin{verbatim}
  pdflatex chart
\end{verbatim}
This operation will overwrite 
any existing \verb|chart.pdf|, so you should first re-name
that file if you want to preserve it.

\section{Installing a \LaTeX\  Development Environment}
\label{IDE}
Most beginning
users will prefer
to use a graphical ``development environment'' which supports editing, processing and
previewing of documents, rather than the command-line interface.  There are \emph{many} such applications;
one called \TeX Works is supported in both MiK\TeX\ and \TeX Live.

\section{Fonts}
\label{fonts}

Look carefully at the samples in Figure~\ref{samples} on page~\pageref{samples}.
\begin{figure}
\Huge
\begin{list}{}{}\item
\begin{tabular}{l}
{\fontfamily{ptm}\selectfont Times}\\
{\fontfamily{pplj}\selectfont Palatino}\\
{\fontfamily{cmss}\selectfont Computer Modern Sans}\\
{\fontfamily{phv}\selectfont Helvetica} \\
{\fontfamily{fos}\selectfont Open Sans} \\
{\fontfamily{Cabin-TLF}\selectfont Cabin}\\
{\fontfamily{QuattrocentoSans-TLF}\selectfont Quattrocento Sans}\\
{\fontfamily{LinuxBiolinumT-TLF}\selectfont Linux Biolinum}\\
{\fontfamily{uop}\selectfont Optima} 
\end{tabular}
\end{list}
\caption{Typeface Samples}
\label{samples}
\end{figure}
Times and Palatino are \emph{serifed} typefaces;  the serifs are the small projections
at the baselines, and sometimes at the tops, of characters.
Serifs improve the readability of \emph{long} texts. 
The others
are \emph{sans serif} typefaces; this class of typefaces is more
appropriate for use in prerequisite charts where \emph{legibility} of fairly small and short textual fragments is of primary importance.  

There are several \emph{sans serif} options available for \LaTeX.
Computer Modern Sans is the default \emph{sans serif} font,
and Helvetica should also be available in every \LaTeX\ installation.
To get Helvetica (scaled down 20\%), use
\begin{verbatim}
  \usepackage[scaled=0.8]{helvet}
\end{verbatim}

The Open Sans family\footnote{%
\myurl{http://www.google.com/webfonts/specimen/Open+Sans}}
of  fonts, designed by Steve Matteson of
Ascender, is supported for use in \LaTeX\ by the \texttt{opensans} package,
available from CTAN\footnote{%
\myurl{http://www.ctan.org/pkg/opensans}}
and in most distributions. 
The Cabin\footnote{%
\myurl{http://www.google.com/webfonts/specimen/Cabin}}
and Quattrocento Sans\footnote{%
\myurl{http://www.google.com/webfonts/specimen/Quattrocento+Sans}
}
families of fonts, designed by Pablo Impallari, are supported for use
in \LaTeX\ by the \texttt{cabin} and \texttt{quattrocento} packages.
The chart in Figure~\ref{chart} on page~\pageref{chart} uses Cabin.
The Linux Biolinum fonts are the sans-serif
companions to the Linux Libertine family\footnote{%
\myurl{http://www.linuxlibertine.org/index.php?id=1&L=1}},
designed by Philipp H. Poll, and are supported for use in \LaTeX\ by the
\texttt{libertine} package. 

Four URW-Classico fonts, a fairly good clone of Hermann Zapf's Optima,  are available in a package
of 79~fonts in Type~1 format that may be legally downloaded for non-commercial use 
from 
Artifex\footnote{%
\myurl{http://www.artifex.com/downloads/}}.
The four Classico font files, renamed for use in \LaTeX, with the necessary support files and installation instructions are available 
from CTAN\footnote{%
\myurl{http://www.ctan.org/pkg/classico}}.
Note that the font files cannot be distributed commercially without a commercial license; please read the license in the archive
before re-distributing them. This restriction does not prevent you from distributing documents 
that \emph{use} the fonts.


\section{Conversion to Scalable Vector Graphics (SVG) Format}

One approach is to use \texttt{dvisvgm}\footnote{%
\myurl{http://dvisvgm.sourceforge.net/}}
to convert the output
of \texttt{latex} processing directly into a (compressed) SVG image.
Versions
since 1.3 generate links in the image from \texttt{hyperref} links in the source file.
Use \texttt{dvisvgm} as a global class option and
\texttt{hypertex} as a package option to \texttt{hyperref} 
to ensure that the appropriate drivers are used by \texttt{latex},
and invoke \texttt{dvisvgm} as follows:
\begin{list}{}{}\item
 \verb\dvisvgm -n -b dvi -L none  ... \.   
\end{list}
Add the \verb\ -z \ option to obtain a compressed image and use the \verb\ -Z scale-factor \
option to scale the image height and width.
If
\texttt{dvisvgm} reports that it can't find Ghostscript,
see the \texttt{dvisvgm} documentation for configuration options.

On Unix-like platforms such as Linux, a small program called \verb\pdf2svg\ is
available\footnote{%
\myurl{http://www.cityinthesky.co.uk/opensource/pdf2svg/}}; it uses standard
libraries (\verb\poppler\ and \verb\cairo\) to implement 
the conversion. 


The \texttt{inkview} application in the open-source \texttt{inkscape}\footnote{%
\myurl{http://www.inkscape.org/en/}}
package 
is a convenient SVG image viewer.


\section{Terminology and Coordinate System}
Before we discuss the \texttt{prerex} editor and the format 
of ``source files'' (i.e.,~chart descriptions), we shall summarize the necessary terminology and coordinate
conventions.

A prerequisite chart consists of a number of 
\emph{course boxes},
linked by 
\emph{arrows}.
Courses are either
\emph{half}
or
\emph{full},
and may be
\emph{required}.
Each course box can contain a course
\emph{code}
(upper left corner),
a course 
\emph{title}
(lower half),
and
\emph{timetable}
information
(upper right corner).
An arrow can be either a \emph{prerequisite} (solid),
a \emph{co-requisite} (dotted),
or 
\emph{recommended} (dashed).
When a conventional arrow would be inappropriate, it is possible to use
a
\emph{mini} 
course ``box'' (consisting of just a course code) just above a target box.
A line (or paragraph) of text may be placed anywhere on the chart.

A conventional two-dimensional
Cartesian coordinate system is used to specify the locations of
diagram elements.
The
origin (where
$x = 0$
and
$y = 0$)
is at the lower-left corner of the diagram. 

The diagram height is configurable; the width is determined by
the values of the \LaTeX\ length
\verb|\textwidth|
and
an adjustable
\verb|\unit|
length, which defines the absolute value of a coordinate unit.
It is possible to put a coordinate grid with labelled axes
in the background of a chart.

The coordinates of a
\emph{box,}
\emph{mini},
or
\emph{text}
are those of its centre point.  
An
\emph{arrow} 
is described by the
coordinates of the centre points of its source and target boxes/minis/texts. 

\section{Chart Editing}
\label{editor}
The source code of \texttt{prerex}, an interactive (command-line) prerequisite-chart editor,  is available at
CTAN repositories.\footnote{\myurl{http://mirror.ctan.org/graphics/prerex/}} 
It should build on any \textsc{Unix}-like system with
suitable tools and libraries installed; for example, it can be compiled
on GNU/Linux, Solaris, the Cygwin\footnote{\myurl{http://www.cygwin.com/}}
platform on Windows, 
and the Fink\footnote{\myurl{http://fink.sourceforge.net/}} platform
on OS~X.

The editor supports add, remove, cut-and-paste, and edit operations
on course boxes, minis, texts, and arrows, and shifts of specified diagram elements or an entire diagram.  
A summary of all
commands supported by \texttt{prerex} is given in Table~\ref{help}.
%on page~\pageref{help}.
Note that if a course box/mini/text is ``cut''
and then ``pasted'' elsewhere, the target or source coordinates of arrows into or out of the source and target are
adjusted accordingly, and similarly if nodes are shifted or raised. To allow permutations of two or more
chart elements, the
editor maintains a ``stack'' of elements that have been cut but not yet pasted.
The notation
$x_0,y_0:x_1,y_1$ 
denotes all the nodes (course boxes, minis, texts) in the rectangle whose northwest and southeast corners are at
coordinates
$x_0,y_0$ and $x_1,y_1$, respectively.
\begin{table}
\begin{center}\small
\begin{tabular}{|l|l|}
\hline
     \multicolumn{1}{|c|}{\textbf{Command}} &     \multicolumn{1}{|c|}{\textbf{Effect}} \\
\hline\hline

\verb\file>  box    x,y         \ & [create and] edit course box at $x,y$\\
\verb\file>  mini   x,y         \ & [create and] edit mini course at $x,y$\\
\verb\file>  text   x,y         \ & [create and] edit text centered at $x,y$\\
\verb\file>  arrow  x0,y0,x1,y1\ & [create and] edit arrow from $x0,y0$ to $x1,y1$\\
\verb\file>  cut    x,y ... \ & (temporarily) remove box, mini, or text at $x,y$\\
\verb\file>  paste  x,y         \ &  re-insert removed box, mini, or text at $x,y$\\
\verb\file>  xchange x0,y0 x1,y1  \ &       exchange elements at $x0,y0$ and $x1,y1$\\
\verb\file>  delete [x,y | x0,y0,x1,y1 | x0,y0:x1,y1] ...\ & remove specified elements/arrows\\
\verb\file>  shift [-]x x0,y0[:x1,y1] ...\ & move [specified] elements $x$ units right [left]\\
\verb\file>  raise [-]y x0,y0[:x1,y1] ...\ & move [specified] elements $y$ units up [down]\\
\verb\file>  undo                 \ & undo the effect of the previous editing command\\
\verb\file>  write | !          \ & save to \verb\file\ and process (with \verb\pdflatex)\\\
\verb\file>  quit | exit | x | ^D\& turn off grid, save to \verb\file\, process, and exit\\
\verb\file>  !cmd               \ & execute shell command \verb\cmd\, then reload\\
\verb\file>  Backup             \ & copy \verb\file\ to \verb\.file\\\
\verb\file>  Restore            \ & restore from \verb\.file\\\
\verb\file>  grid   [y/n]       \ &  turn on/off coordinate grid background\\
\verb\file>  help | ?           \ &  print this summary\\
\hline
\end{tabular}
\end{center}
\caption{\texttt{prerex} Command Summary (since version 6.4)}
\label{help}
\end{table}

The effects of
editing operations may be observed in a PDF 
viewer. See the manual page \texttt{prerex(1)} for
more information.  The \texttt{prerex} package at CTAN
also has the source files for
\texttt{vprerex} (visual \texttt{prerex}), a graphical ``wrapper'' for \texttt{prerex} 
which incorporates a \texttt{prerex}-enabled PDF viewer.


For initial creation of a prerex-formatted chart
or making
substantial changes to the boxes and arrows of an existing prerex-formatted chart, it is more convenient
to use one of these programs than to edit the source file directly; however,
the chart editor has no access to other elements of a source file, such as
preamble declarations, headings, notes, logos, and so on.  A conventional text editor or
\LaTeX\ development environment should be used for these.

\section{Source Files}
\label{source}

\subsection{Overall Structure}

A \texttt{.tex} file is essentially text with interspersed
\LaTeX\ commands, much as a web-page description has text with Hypertext
Mark-up Language (HTML) tags interspersed.
Commands for \LaTeX\ can be recognized by the initial backslash character~``\verb|\|''.  

The first several lines make up the ``preamble''
of the source file for a chart:
\begin{verbatim}
    \documentclass{article}
    \usepackage{prerex}
       :
\end{verbatim}
This describes the kind of document to be processed (\texttt{article}, as opposed to
\texttt{book} or \texttt{report}) and
indicates a file of definitions to be used (\texttt{prerex.sty}).
The remaining lines of the preamble
specify such things as the page layout and the fonts to be used.

The structure
\begin{verbatim}
    \begin{document}
      :
    \end{document}
\end{verbatim}
contains the content of the document.
Typically, the first element of the content is a heading, contained
within a
formatting structure of the form
\begin{verbatim}
    \begin{center}
       :
    \end{center}
\end{verbatim}
which specifies that each line of the material contained should be centered on the page.
The double-backslash command \verb|\\| indicates
a line break.

After the heading comes the description of the chart itself:
\begin{verbatim}
    \begin{chart}
      :
    \end{chart}
\end{verbatim}
Finally, there
will typically be some notes to explain the abbreviations and conventions
used in the chart.  

\subsection{Chart Instructions}


Table~\ref{instructions} 
on page~\pageref{instructions}  
summarizes the formats of 
the instructions defined by \texttt{prerex.sty}. 
\begin{table}
\begin{center}
\renewcommand{\arraystretch}{1.3333}
\begin{tabular}{|l|}
\hline
\multicolumn{1}{|c|}{\textbf{Course Boxes and Text-Lines}} \\
\hline
\verb|\halfcourse |$x,y$:\verb|{|\emph{course code}\verb|}{|\emph{course title}\verb|}{|\emph{timetable code}\verb|}|  \\
\verb|\fullcourse |$x,y$:\verb|{|\emph{course code}\verb|}{|\emph{course title}\verb|}{|\emph{timetable code}\verb|}|  \\
\verb|\reqhalfcourse |$x,y$:\verb|{|\emph{course code}\verb|}{|\emph{course title}\verb|}{|\emph{timetable code}\verb|}| \\
\verb|\opthalfcourse |$x,y$:\verb|{|\emph{course code}\verb|}{|\emph{course title}\verb|}{|\emph{timetable code}\verb|}| \\
\verb|\reqfullcourse |$x,y$:\verb|{|\emph{course code}\verb|}{|\emph{course title}\verb|}{|\emph{timetable code}\verb|}| \\
\verb|\optfullcourse |$x,y$:\verb|{|\emph{course code}\verb|}{|\emph{course title}\verb|}{|\emph{timetable code}\verb|}| \\
\verb|\halfcoursec | $x,y$ \verb|:{| \emph{course code} \verb|}{| \emph{course title} \verb|}{| \emph{timetable code} \verb|}| \verb|{| \emph{color} \verb|}| \\
\verb|\reqhalfcoursec | $x,y$ \verb|:{| \emph{course code} \verb|}{| \emph{course title} \verb|}{| \emph{timetable code} \verb|}| \verb|{| \emph{color} \verb|}| \\
\verb|\opthalfcoursec | $x,y$ \verb|:{| \emph{course code} \verb|}{| \emph{course title} \verb|}{| \emph{timetable code} \verb|}| \verb|{| \emph{color} \verb|}| \\
\verb|\fullcoursec | $x,y$ \verb|:{| \emph{course code} \verb|}{| \emph{course title} \verb|}{| \emph{timetable code} \verb|}| \verb|{| \emph{color} \verb|}| \\
\verb|\reqfullcoursec | $x,y$ \verb|:{| \emph{course code} \verb|}{| \emph{course title} \verb|}{| \emph{timetable code} \verb|}| \verb|{| \emph{color} \verb|}| \\
\verb|\optfullcoursec | $x,y$ \verb|:{| \emph{course code} \verb|}{| \emph{course title} \verb|}{| \emph{timetable code} \verb|}| \verb|{| \emph{color} \verb|}| \\
\verb|\mini |$x,y:$\verb|{|\emph{course code}\verb|}| \\
\verb|\text |$x,y:$\verb|{|\emph{line of text}\verb|}| \\
\hline
\multicolumn{1}{|c|}{\textbf{Arrows}} \\
\hline
\verb|\prereq |$x_0, y_0, x_1, y_1$: \hfil 
\verb|\prereqc |$x_0, y_0, x_1, y_1$; \emph{c}: \\ 
\verb|\coreq |$x_0, y_0, x_1, y_1$: \hfil
\verb|\coreqc |$x_0, y_0, x_1, y_1$; \emph{c}: \\
\verb|\recomm |$x_0, y_0, x_1, y_1$: \hfil
\verb|\recommc |$x_0, y_0, x_1, y_1$; \emph{c}: \\
\hline
\multicolumn{1}{|c|}{\textbf{Coordinate Grid}} \\
\hline
\verb|\grid| \\
\hline
\multicolumn{1}{|c|}{\textbf{In-Line Instructions}} \\
\hline
\verb|\solidarrow| \\
\verb|\dottedarrow| \\
\verb|\dashedarrow| \\
\verb|\lightbox| \\
\verb|\boldbox| \\
\verb|\dottedbox| \\
\hline
\end{tabular}
\renewcommand{\arraystretch}{1.0}
\end{center}
\caption{Instructions for \texttt{prerex}-Formatted Prerequisite Charts}
\label{instructions}
\end{table}

The \verb\grid\ command creates
a light gray ``coordinate grid'' in the background of the chart.
Figure~\ref{grid} 
on page~\pageref{grid}
shows the example chart of Figure~\ref{chart} with the coordinate
grid enabled.
\input{introchart2}
Note that the ``origin'' of the coordinate system (the point
with $x$-coordinate $0$ and $y$-coordinate $0$) is at the lower-left corner of the chart. 

The arrows produced by \verb\prereq\, \verb\coreq\, and \verb\recomm\ instructions 
by default are slightly curved (except very short ones).  It is possible to increase
or decrease the degree of curvature of a particular arrow by using instructions
\verb\prereqc\, \verb\coreqc\, or \verb\recommc\; the additional argument
specifies the degree of curvature: $0$ means no curvature, i.e.,~straight,
and to increase the curvature, use a larger number (up to $100$).
To change the default curvature for \emph{all} arrows,
see Section~\ref{config} on page~\pageref{config} below.
 

The ``in-line'' instructions create small examples of course boxes and arrows for use
in explanatory notes outside of the \verb\chart\ environment:
\begin{list}{}{}\item
\renewcommand{\arraystretch}{1.25}
\begin{tabular}{lc}
\verb|\solidarrow| & \solidarrow \\
\verb|\dottedarrow| & \dottedarrow \\
\verb|\dashedarrow| & \dashedarrow \\
\verb|\lightbox| & \sf\small\lightbox \\
\verb|\boldbox| & \sf\small\boldbox \\
\verb|\dottedbox| & \sf\small\dottedbox
\end{tabular}
\renewcommand{\arraystretch}{1.0}
\end{list}


See the manual pages 
\texttt{prerex(5)} and \texttt{prerex.sty(7)} and the documentation for
\texttt{prerex.sty} for more information.

\subsection{\LaTeX\ Input Conventions}

The following are some of the input conventions for \LaTeX\ that you might want to know
about while editing
the source file for a prerex-formatted prerequisite chart.
\begin{itemize}
\item The characters \verb|# $ % &  _ { } ~ ^ \ | are interpreted in special
ways by \LaTeX; to produce any of the first seven  of these characters, you will have
to ``escape'' them with a backslash, as in, for example, \verb|\&|.
The \verb|\\| combination produces a line break; to produce a backslash, use \verb|\backslash|. The remaining two special characters, \verb|~|
and \verb|^|, may also be escaped with a backslash but produce accents;
for example, \verb|\^{u}| produces~\^{u}. 

\item To produce a space where \LaTeX\ would normally not do so, use \verb|\ |.
For example, \LaTeX\ normally interprets a period immediately after a word as the end of
a sentence and leaves a larger-than-usual space; to prevent the larger-than-usual space after an abbreviation
that finishes with a period, use \verb|\ | instead of a space, as in
\verb|Diff.\ Equations|.

\item An unescaped \verb\%\ character signals the beginning of a comment; any characters following the
\verb\%\ to the end of that line are ignored by \LaTeX.

\item To prevent a line break between two words, use a \verb\~\
instead of a space between them, as in \verb\MATH~223\.

\item To leave a smaller-than-usual space between two words,
use \verb|\,| instead of a space between them, as in \verb|MATH\,223|. 

\item To prevent hyphenation of some word, use the word as the argument to
an \verb|\mbox| command, as in \verb|\mbox{Robert}|.


\end{itemize}

\subsection{Configuration}
\label{config}

The following \LaTeX\ definitions are made in
\verb|prerex.sty| but may be re-defined by the
user in the chart source file:
\begin{list}{}{}
\item \verb|\newcommand{\DefaultCurvature}{20}|
\end{list}
where the argument should be in the range $0$--$100$; $0$ means no curvature.
\begin{list}{}{}
\item \verb|\newcommand{\CourseURL}[3]{#3.html}|
\end{list}
where the arguments supplied at the call are the $x$ and $y$ coordinates of
the box or mini, and the course code.
\begin{list}{}{}
\item \verb|\newcommand{\background}{yellow!15}|
\end{list}
which defines the default background color for course nodes.
\begin{list}{}{}
\item \verb|\setlength{\unit}{5.7816pt}|
\end{list}
which defines the absolute size of a coordinate unit;
this results in exactly 10 pixels per
coordinate unit if the chart is converted to an image at 125 dpi.
\begin{list}{}{}
\item \verb|\newcommand{\dpi}{125}| 
\item \verb|\newcommand{\PixelsPerUnit}{10}| 
\end{list}
These three commands have to re-defined together if the image-map data are to be correct.
\begin{list}{}{}
\item \verb|\setcounter{diagheight}{75}|
\end{list}
which is the 
$y$-coordinate
of the top of the diagram (reduced to $65$ in landscape mode);
the nominal diagram width is 
\verb|\textwidth|~$\div$~\verb|\unit|~$+ 10$.

The following define the thicknesses of the three kinds of arrows
and the thickness of bold boxes:
\begin{list}{}{}
\item
\verb|\newcommand{\solidwidth}{0.5pt}|
\item
\verb|\newcommand{\dottedwidth}{0.8pt}|
\item
\verb|\newcommand{\dashedwidth}{0.8pt}|
\item
\verb|\newcommand{\boldwidth}{1.0pt}|
\end{list}


The following command is used to change to a smaller size for course codes,
timetable information, and mini-course codes:
\begin{list}{}{}
\item
\verb|\newcommand{\smallersize}{\relsize{-3}}|
\end{list}

The following command defines the baseline adjustment for the stand-alone arrows and boxes;
this parameter is font-dependent.
\begin{list}{}{}
\item
\verb|\newcommand{\baselineAdj}{-0.5ex}|
\end{list}

\newpage



\section*{Bibliography}
\addcontentsline{toc}{section}{Bibliography}
\label{bibliography}

The following \nocite{Kopka,Lamport,Mittelbach} are three recommended books on \LaTeX\@.
Many other books and tutorial materials are available; check out the web sites referenced
in Section~\ref{installing}. 
\renewcommand{\refname}{}
\vspace*{-6ex}
\bibliography{manual}
\bibliographystyle{plain}



\end{document}
