Path: utzoo!attcan!uunet!mcsun!ukc!strath-cs!cs.glasgow.ac.uk!johnsson From: johnsson@cs.glasgow.ac.uk (Dr. T. Johnsson) Newsgroups: comp.text.tex Subject: Recognizing keywords etc using TeX Message-ID: <5421@vanuata.cs.glasgow.ac.uk> Date: 7 Jun 90 08:29:55 GMT Organization: Computing Sci, Glasgow Univ, Scotland Lines: 26 How would one design macros or environments to prettyprint computer programs? The tricky bit (presumably!) would be to recognize keywords and other special symbols of a programming language, and output them in \bf or as math, instead of some default treatment. For instance, \beginpascal if iffy > 42 then msg("ugly!"); \endpascal would produce something like {\bf if} {\it iffy\/} $>$ 42 {\bf then} {\it msg\/}$($``{\tt ugly!}''$)$$;$ I would also like to be able to treat the character backslash as a symbol; for instance, \beginlambda \x.\y.(y (\z.z) x) \endlambda would produce something like $\lambda$x.$\lambda$y.$($y $($$\lambda$z.z$)$ x$)$ Thanks! Thomas Johnsson (cs.glasgow.ac.uk)