source code

Powered by Drupal

BASH Script to generate PDF of Source Code with Syntax Highlighting using LaTeX

Submitted by Sam Hobbs on

Sometimes when I'm learning I like to print source code on paper because I find it easier to read, and nicer to annotate. I had a rummage online to see if anyone had come up with a nice way to generate PDFs of source code, and improved what I found into this useful BASH script. The script searches for source code in the current directory and its subdirectories, and uses the typesetting software LaTeX to create a PDF of the contents with syntax highlighting.