summaryrefslogtreecommitdiff
path: root/support/schemetex/st.tex
blob: 4dce7388439a6b96a4382faa1ee3cc82eb6ef1f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
\documentstyle[proc]{article}
% @(#)st.tex	1.3 88/06/30
\title{Scheme\TeX{}}
\author{John D. Ramsdell}
\date{
88/06/30
}

\begin{document}

\maketitle

Scheme\TeX{} 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\TeX{} 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\TeX{} style
command should include the \verb-astyped- style option, so that the
\verb-astyped- environment is available.  An example:
\begin{center}
\verb-\documentstyle[astyped]{article}-
\end{center}

Scheme\TeX{} 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\TeX{} code much as they are used for Lisp code and
\LaTeX{} code.

Some users prefer not modifying the \verb-LOAD- function in their Lisp
system.  To support those users, the rule that text lines must be
unmodified \LaTeX{} code has been relaxed.  Text lines that begin with
``;'' are copied without the initial ``;''.

\newpage{}
\section*{Usage under Unix}

The extension for Scheme\TeX{} files is ``\verb;.st;''.  For T, the
file \verb;st.t; contains two programs used to obtain code from an
``\verb;.st;'' file.  The T expression
\begin{center}
\verb;(LOAD-ST; {\it filespec environment\/}{\tt )}
\end{center}
loads a Scheme\TeX{} file by creating a T source file if no T source
file exists which is younger than the Scheme\TeX{} file.  The T source
file is then loaded using the usual \verb;LOAD; procedure.
\verb;COMPILE-ST; is like \verb;LOAD-ST; except it compiles the file
instead of loading it. 

A \LaTeX{} file is produced from a file with the ``\verb;.st;''
extension using the Unix shell command 
\begin{center}
{\tt st} {\it file-name}
\end{center}
It will produce a file with the ``\verb;.tex;'' extension.  The
obvious make file is in Figure~\ref{makefile}.
\begin{figure}
\begin{verbatim}
.SUFFIXES:      .dvi .tex .st

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

.st.tex:
        st $*

.tex.dvi:       
        latex $*
\end{verbatim}
\caption{A Scheme\TeX{} Makefile}\label{makefile}
\end{figure}
\end{document}