From: Tunc Simsek
Subject: Typesetting Common Lisp in Latex
Date: 
Message-ID: <394C1D25.3B732410@robotics.eecs.berkeley.edu>
Regards,

Does anyone have a simple Latex style file for typesetting Lisp.  
In particular,
the basic markup should be for:

1. displayed lisp code
2. in-line lisp code (e.g. refer to a lisp variable in a sentence)
3. typesetting of generic functions and methods

p.s. I particularily like the style of the AMOP (Kiczales et al.),
but can't get their style files to work on my tetex (linux) system.
Seems that they have used a header of the form:

\documentstyle{book}
\documentstyle{spec}

...

and tetex doesn't like that.  Unfortunately, including spec in other
ways doesn't work:

\documentclass[spec]{book}

or 

\documentstyle{book}

\include spec

or 

\documentclass{book}
\usepackage{spec}

Thanks,
Tunc

From: David Bakhash
Subject: Re: Typesetting Common Lisp in Latex
Date: 
Message-ID: <c29zoojhz6x.fsf@mint-square.mit.edu>
Tunc Simsek <······@robotics.eecs.berkeley.edu> writes:

> Does anyone have a simple Latex style file for typesetting Lisp.  
> In particular,
> the basic markup should be for:

I just format it in emacs and then use this:

\setstretch{1.0}
\begin{verbatim}

<code>

\setstretch{whatever_you_use}
\end{verbatim}

don't know if this helps.  I'm not a latex guru, but have managed to get 
reasonable Lisp in with `verbatim'.

dave
From: Kent M Pitman
Subject: Re: Typesetting Common Lisp in Latex
Date: 
Message-ID: <sfwu2eqe65w.fsf@world.std.com>
kp gores <·····@sip.medizin.uni-ulm.de> writes:

> 
> In article <···············@mint-square.mit.edu>, David Bakhash 
> <·····@alum.mit.edu> wrote:
> 
> > Tunc Simsek <······@robotics.eecs.berkeley.edu> writes:
> > 
> > > Does anyone have a simple Latex style file for typesetting Lisp.  
> ...
> > I just format it in emacs and then use this:
> > 
> > \setstretch{1.0}
> > \begin{verbatim}
> 
> AFAIK LaTeX gurus recommend listing.sty
> ciao
>   kp

Emacs TeX mode (which I consider I wrote the "definitive" version of in
Teco, years ago) used to have support for doing this right.  It's a pity
if it got lost when it was "ported" to gnu emacs.

Based on some technology I'd seen years earlier with a newspaper office
phototypesetter that did "indent under" by turning off the light while
drawing to photographic paper and then just printing the characters
without printing (analogous to raising the pen in LOGO and then letting the
turtle walking through a drawing), I created the notion of a "noflash" macro 
that output a box the width of a given set of characters but without showing
them.  Using this, you can take text like:

 (defun factorial (x)
   (cond ((zerop x)
          1)
         (t (* x
               (factorial (- x 1))))))

and translate it to something like:

 $$\vbox{\hbox{{\tt\noflash{}(defun factorial (x)}}
         \hbox{{\tt\noflash{  }(cond ((zerop x)}}
         \hbox{{\tt\noflash{(d(cond (}1}}
         \hbox{{\tt\noflash{(d(cond }(t (* x}}
         \hbox{{\tt\noflash((d(cond (t (* }(factorial (- x 1))))))}}}$$

The \noflash macro is named in honor of the phototypesetter and it was for
moving the cursor without drawing the indicated characters.

The choice of what characters not to flash can be computed
mechanically, of course, by looking vertically upward from each
leading whitespace character and grabbing the whitespace visibly above
it, so it's completely easy to recompute.

 (defun factorial (x)
 ||(cond ((zerop x)
 |||||||||1)
 ||||||||(t (* x
 ||||||||||||||(factorial (- x 1))))))
 vvvvvvvvvvvvvv
 (d(cond (t (*    <<-- These chars are above the leading whitespace
                       (Remember you have to keep a running buffer because
                        sometimes there is "backup" and you need different
                        characters to be inserted on any given line.)

I had a teco macro that would take you out of this ugly visual mode
into an editing mode on the table so it was easy to edit, and then
another that would take it back into this format.

The result is output that can be BOTH variable-width-font and indented
correctly for Lisp.  This technique was used successfully in my
Revised Maclisp Manual (circa 1981, if memory serves), in which I
wrote the spec in a high-level language that compiled to TeX at the
"assembly" level (where TeX surely belongs... as does Java, btw, IMO).

Note as an aside that embedded spaces, if you're using this style, work
best by converting them to fixed-width, so that

 (defun foo (x)
   (concatenate 'string x "  "))

still comes out looking like it's got two spaces in the embedded string,
even if the leading two spaces on the line have a different width (the
width of "(d".
From: Marco Antoniotti
Subject: Re: Typesetting Common Lisp in Latex
Date: 
Message-ID: <lwu2epq01c.fsf@parades.rm.cnr.it>
As a matter of fact you can get decent documentation using the 'alltt'
environment.  Alas, LaTeX2HTML does not understand it.

Cheers

-- 
Marco Antoniotti ===========================================
From: Tunc Simsek
Subject: Re: Typesetting Common Lisp in Latex
Date: 
Message-ID: <Pine.SOL.4.10.10006181905320.8040-100000@tudor.EECS.Berkeley.EDU>
Sorry, a correction:

\documentstyle[spec]{book}

works for the mop style files.

Tunc

On Sat, 17 Jun 2000, Tunc Simsek wrote:

> Regards,
> 
> Does anyone have a simple Latex style file for typesetting Lisp.  
> In particular,
> the basic markup should be for:
> 
> 1. displayed lisp code
> 2. in-line lisp code (e.g. refer to a lisp variable in a sentence)
> 3. typesetting of generic functions and methods
> 
> p.s. I particularily like the style of the AMOP (Kiczales et al.),
> but can't get their style files to work on my tetex (linux) system.
> Seems that they have used a header of the form:
> 
> \documentstyle{book}
> \documentstyle{spec}
> 
> ...
> 
> and tetex doesn't like that.  Unfortunately, including spec in other
> ways doesn't work:
> 
> \documentclass[spec]{book}
> 
> or 
> 
> \documentstyle{book}
> 
> \include spec
> 
> or 
> 
> \documentclass{book}
> \usepackage{spec}
> 
> Thanks,
> Tunc
> 
>