\documentstyle[proc]{article}
% $Header: sweb.tex,v 1.1 90/07/12 11:38:57 ramsdell Exp $
\title{Scheme\WEB{}}
\author{John D. Ramsdell}
\date{\verb$Date: 90/07/12 11:38:57 $}

\newcommand{\WEB}{{\tt WEB}}

\begin{document}

\maketitle

Scheme\WEB{} provides simple support for literate programming in any
dialect of Lisp.  Originally created for use with Scheme, it defines a
new source file format which may be used to produce \LaTeX{} input or
Lisp code.

Scheme\WEB{} source lines are divided into text and code.  Lines of code
start with a line beginning with ``('', and continue until the line
containing the matching ``)''.  The remaining lines are text lines,
and they are treated as comments.

When producing a \LaTeX{} document, both the text lines and the code
lines are copied into the document source file, but the code lines are
surrounded by a pair of formatting commands (\verb-\begin{astyped}-
and \verb-\end{astyped}-).  This \LaTeX{} environment formats the code
as written, in typewriter font.  A Lisp comment within a code line is
formatted in an \verb-\mbox- in Roman font.  A Scheme\WEB{} style
command should include the \verb-astyped- style option, so that the
\verb-astyped- environment is available.  An example:
\begin{quote}
\verb-\documentstyle[astyped]{article}-
\end{quote}

Scheme\WEB{} was designed under the constraint that code lines must be
unmodified Lisp code, and text lines must be unmodified \LaTeX{} code.
Text editors with support for Lisp and \LaTeX{}, such as Emacs, may be
used for Scheme\WEB{} code much as they are used for Lisp code and
\LaTeX{} code.

For those who prefer not to modify the reader used by their Lisp
system's loader and compiler, the rule that text lines must be
unmodified \LaTeX{} code has been relaxed.  Text lines that begin with
``;'' are copied without the initial ``;''.

\section*{Usage in Scheme}
The file \verb;sweb.scm; contains programs used to obtain code or
\LaTeX{} from a Scheme\WEB{} source file.  The Scheme expression
\begin{quote}\tt
(TANGLE "{\it Scheme\WEB{} file}" "{\it Scheme file}")
\end{quote}
creates Scheme source from a Scheme\WEB{} file, and the expression
\begin{quote}\tt
(WEAVE "{\it Scheme\WEB{} file}" "{\it \LaTeX{} file}")
\end{quote}
creates \LaTeX{} source.

The file \verb-reader.sw- contains a Scheme\WEB{} reader in R$^4$R Scheme.
Use that reader with your Scheme system's loader and compiler to
avoid running \verb-TANGLE- and creating a temporary file.

\begin{figure}
\begin{verbatim}
.SUFFIXES:      .dvi .tex .scm .sw

.sw.dvi:
        make $*.tex && make $*.dvi

.sw.tex:
        sweave $*.sw $*.tex

.tex.dvi:       
        latex $*

.sw.scm:
        stangle $*.sw $*.scm
\end{verbatim}
\caption{A Scheme\WEB{} Makefile}\label{makefile}
\end{figure}

\section*{Usage in a Unix shell}
Files are produced from Scheme\WEB{} source
using the Unix shell commands
\begin{quote}\tt
sweave [{\it Scheme\WEB{} file}] [{\it \LaTeX{} file}] \\
stangle [{\it Scheme\WEB{} file}] [{\it Scheme file}]
\end{quote}
The obvious make file is in Figure~\ref{makefile}.
It uses the convention that the extension for Scheme\WEB{} 
files is ``\verb;.sw;.'' 

\end{document}
