[comp.text] Pseudocode in LaTeX

erikt@zeus.umu.se (Erik Tarnvik) (06/16/89)

How do I typeset pseudocode in LaTeX? I want nicely indented code, with
some of the code in italics, bold etc. Is there some tool that I can use
(like vgrind)?

leichter@CS.YALE.EDU (Jerry Leichter) (06/22/89)

In article <874@umecs.cs.umu.se>, erikt@zeus.umu.se (Erik Tarnvik) writes...
>How do I typeset pseudocode in LaTeX? I want nicely indented code, with
>some of the code in italics, bold etc. Is there some tool that I can use
>(like vgrind)?

There is, in fact, a program called tgrind which is the exact analogue of
vgrind - it even uses the vgrindefs.src file to learn about language syntax -
but output TeX code.  It was written by Van Jacobson and Chris Torek.  I
picked up a copy from the LaTeX style file archives when they used to be at -
damn, I forget the name now, wherever they were before they moved to Clarkson
- but it's no longer there, and in fact I know of no other distribution site.

However, I have a version I hacked with, which is intended to be used mainly
with LaTeX rather than TeX.  (Actually, Nelson Beebe did a LaTeX style file to
go with the original version which I expanded on.)  I added the ability to
typeset code within the body of existing text, rather than just producing
stand-alone listings.  I have never had the chance to clean the whole thing
up or prepare full documentation, but you are welcome to a copy of what I
have.  You can get it by anonymous FTP from VENUS.YCC.YALE.EDU, file
tgrind.arc.  This is a DECUS C archive, a format that's easy to split up with
any editor.  Easier, though, is to pull off the source for archx.c - the first
thing in the file, it extends to the line that starts "-h- regexp.c" - and
use it to split out the rest.

Use this stuff as you see fit.  I'm interested in comments/bug reports, but
can offer NO support.  "You broke it, you bought it."

I CANNOT MAIL COPIES OF TGRIND!!!  Please don't ask.  If you can't use FTP,
please find someone who can.
							-- Jerry

clarke@hpdtl.HP.COM (Marc Clarke) (07/06/89)

Further, the Clarkson archive has a file "trgind.sty" which allows TeX files
from tgrind to be used in LaTeX.  You must trim of the first and last lines of
the tgrind-processed file.  The style file offers the ability to include a
tgrind file as a figure or as running text.  I use it extensively to include
snippets of source code in the middle of documents.