<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% -*- Mode: TeX; Syntax: Common-lisp; Package: LISTEX; -*-
%% macros for the LISTEX system by DCB

% setup
\catcode`\@=11

% fonts
\def\LTnormalfont {\rm}
\def\LTcommentfont {\it}
\def\LTpuncfont {\tt}
\def\LTcodefont {\rm}
\def\LTcodepuncfont {\tt}
\def\LTslantedcode {%
  \font\sltt=cmsltt10
  \def\LTcodefont{\sl}%
  \def\LTcodepuncfont{\sltt}}
\def\slantedcode{\LTslantedcode}
\def\LTboldcode {%
  \def\LTcodefont{\bf}%
  \def\LTcodepuncfont{\tt}}
\def\boldcode{\LTboldcode}
\def\LTtypewritercode {%
  \def\LTcodefont{\tt}}
\def\typewritercode{\LTtypewritercode}

% delimiters
\newdimen\LTparenkern   \LTparenkern=.1pt
\newdimen\LTcommentkern \LTcommentkern=1pt
\newdimen\LTspacewidth  \LTspacewidth=.45em
\def\LTop/{{\rm(\kern\LTparenkern}}
\def\LTcp/{\/{\rm\kern\LTparenkern)}}
\def\LTobrace/{{$\{$\kern\LTparenkern}}
\def\LTcbrace/{\/{\kern\LTparenkern$\}$}}
\def\LTquot/{\raise.3ex\hbox{\LTpuncfont\char`\"}}
\def\LTstar/{\lower.05ex\hbox{\LTpuncfont\char`\*}}
\def\LTchr {\LTpuncfont\char}
\def\LTsetpwidth {\setbox\z@=\hbox{\LTop/}\LTpwidth=\wd\z@}
\newdimen\LTpwidth      \LTsetpwidth

% indentations
\def\LTpi/{\kern\LTpwidth}              % increment for plus1
\def\LTpii/{\kern 2\LTspacewidth}       % increment for plus2
\def\LTpiv/{\kern 4\LTspacewidth}       % increment for plus4
\def\LTks #1{\kern #1\LTspacewidth}     % kern a number of space widths

% boxes
\newbox\LTbox
\newdimen\LTboxw
\def\LTsb {\setbox\LTbox=\hbox}         % start a box
\def\LTdb/{\box\LTbox}                  % dump out a box
\def\LTbb {\LTboxw=\wd\LTbox            % output a box and backspace over it
           \box\LTbox
           \kern-\LTboxw}

% markers
\def\LTsm #1{\xdef#1{\the\wd\LTbox}%    % set a mark register
             \box\LTbox}
\def\LTkr #1{\kern #1\relax}            % kern a register
\def\LTkm {\LTbb\LTkr}                  % kern to a marked position

% modules

% output modules in boxes?
\newif\ifLTboxmodules

% keep track of position in file: top, after module, before module
\newif\iffirstmodule \firstmoduletrue
\newif\ifmodule

% incrementally number modules
\newcount\modulecount

% normal modules
\def\LTbeginmodule/{%
  \iffirstmodule \firstmodulefalse
  \else          \LTfilbreak \bigskip \fi
  \advance\modulecount\@ne
  \LTmarkmodule
  \ifLTboxmodules \vbox\bgroup \else \begingroup \fi
  \LTmoduledefs
  \noindent {\bf \number\modulecount.}\enspace \ignorespaces}

\def\LTendmodule/{%
  \endgraf
  \ifLTboxmodules \egroup \else \endgroup \fi
  \moduletrue}

\def\LTmarkmodule {}

\def\LTmoduledefs {%
  \LTmodulehook
  \LTsetpwidth}

\def\LTmodulehook {}

% star modules
\def\LTbeginstarmodule #1{%
  \iffirstmodule \firstmodulefalse
  \else          \vfil \eject \fi
  \advance\modulecount\@ne
  \LTmarkstarmodule{#1}%
  \ifLTboxmodules \vbox\bgroup \else \begingroup \fi
  \LTmoduledefs
  \noindent {\bf \number\modulecount. \ignorespaces #1\par}
  \nobreak \smallskip \noindent \ignorespaces}

\def\LTmarkstarmodule {\message{*\number\modulecount}\mark}

% spacing and layout
\def\LTfilbreak {\vfil\penalty-200\vfilneg}
\def\LTfilnobreak {\vfil\penalty9999\vfilneg}
\parindent=2em
\interlinepenalty=10000                         % forbid breaks in paragraphs

% code in module text
\def\LTbcode/{\begingroup \let\LTpuncfont=\LTcodepuncfont
              \LTcodedefs \LTcodefont \LTsetpwidth}
\def\LTecode/{\/\endgroup}

% code
\def\LTbeginlisp/{%
  \iffirstmodule \beginmodule \endmodule \fi
  \ifmodule \modulefalse \LTfilnobreak \bigskip
  \else     \LTfilnobreak \medskip \fi
  \vbox\bgroup \LTcodedefs \LTnormalfont \LTsetpwidth}

\def\LTendlisp/{%
  \egroup}

\def\LTcodedefs {%
  \spaceskip=\LTspacewidth
  \xspaceskip=\LTspacewidth
  \LTcodehook}

\def\LTcodehook {}

% module text in code
\def\LTcommentdefs {\spaceskip=\z@ \xspaceskip=\z@ \LTcommentfont \LTsetpwidth}
\def\LTbcom/{\begingroup \LTcommentdefs {\rm;\kern\LTcommentkern}}
\def\LTecom/{\endgroup}

% miscellany
\ifx\lisp\undefined
  \def\lisp {Lisp}
  \let\LISP=\lisp
  \let\Lisp=\lisp
\fi
\def\listex {Lis\kern-.1667em\TeX}
\let\LISTEX=\listex
\let\Listex=\listex

\hsize=30pc
\vsize=50pc
\LTboxmodulesfalse

% cleanup
\catcode`\@=12
</pre></body></html>