In A Student’s Guide to Python for Physical Modeling , we used the Listings package for LaTeX to format our code samples. In this post, we describe how we used the package and provide our style files for others to use. Typesetting Computer Code The listings package makes it easy to format code for typesetting in LaTeX. It allows the author to adjust virtually every aspect of how code is displayed. We used the package to develop our own syntax highlighting scheme. All code is displayed in a monospace (typewriter) font. Built-in functions and reserved words are bold and green. Python exceptions are bold and red. Modules and functions from NumPy and PyPlot are bold and black. Modules and functions from other modules are bold and blue. Strings are red. Keyword arguments to functions are italic. Comments are blue italic. This scheme is similar to the one used in Spyder. It allows a reader to distinguish built-in functions and modules from variable names and user-defined functi...