Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!uunet!mcsun!ukc!icdoc!sot-ecs!spqr From: spqr@ecs.soton.ac.uk (Sebastian Rahtz) Newsgroups: comp.text Subject: Re: Typesetting programming languages in LaTeX Message-ID: Date: 21 Feb 90 01:45:48 GMT References: <4285@jhunix.HCF.JHU.EDU> Sender: spqr@ecs.soton.ac.uk Followup-To: comp.text Organization: Southampton University Computer Science Lines: 34 In-reply-to: barrett@jhunix.HCF.JHU.EDU's message of 20 Feb 90 02:03:14 GMT >>>>> On 20 Feb 90 02:03:14 GMT, barrett@jhunix.HCF.JHU.EDU (Dan Barrett) said: > For the computer programming courses I teach, I make a lot of > handouts that contain code in C, Pascal, LISP, etc. I would like to > have a nice way to typeset these languages in LaTeX. > The major problems are: > o Not interpreting symbols of the language as LaTeX symbols; > o Handling TAB's. > For the time being, I use the "verbatim" environment. However, it doesn't > understand TAB characters; I have to substitute 8 space characters for > my TAB's (and this isn't always correct). well, a few random points strike me: a) there is often a `detabbing' program on Unix systems which resolves TAB characters into appropriate places b) where do you stand on code being in typewriter font? if you are not wedded to that, have you tried the `trgind' system of prettifying code? c) if you don't need / { and } in your code (!), you could use the `alltt' environment d) note sure what you mean by > o Not interpreting symbols of the language as LaTeX symbols; if you can do what you want with a verbatim environment which permits an escape character to get TeX symbols, then I can supply one there are many other thoughts, of course. but mainly dependent on the answer to b) above -- Sebastian Rahtz S.Rahtz@uk.ac.soton.ecs (JANET) Computer Science S.Rahtz@ecs.soton.ac.uk (Bitnet) Southampton S09 5NH, UK S.Rahtz@sot-ecs.uucp (uucp)