Learning LaTeX and the "listings" PackagePosted: January 27, 2006
I recently decided to start doing my homework in LaTeX, for a couple of reasons. Perhaps foremost among these LaTeX is a useful thing to know, being (according to the website) “the de facto standard for the communication and publication of scientific documents”, and I had no prior experience using it. Another is that it has built-in support for typesetting mathematical equations, which is extremely useful to someone who is taking a class in advanced algorithms. (Just try getting your word processor to represent something like xlogba).
At any rate, one of the best things about LaTeX is its extensibility, which is acchieved through the use of packages. One useful package that I found in the course of doing my homework is the listings package. This packages is intended to allow typesetting of source code – as opposed to the \verbatim/\verb! method – including highlighting of keywords and other special formatting for various source constructs (e.g., italicized comments). It even allows you to specify the programming language that you will be using and, if there is no support for one’s language of choice, it is possible to create one’s own typesetting definition for that language.
Anyone interested in a simple way to typeset source code should check it out [PDF]!