Syntax Highlighting in LaTeX with the listings Package

Author
writeLaTeX
View Count
60618
License
Other (as stated in the work)
Abstract

This example shows how to set the options for automatic syntax highlighting for code in LaTeX with the listings package (which provides the lstlisting environment). The listings package supports many languages, including Java, C, C++, MATLAB/Octave and Python, and you can set the language option globally with \lstset or for each listing, when you have listings in multiple languages.

Syntax Highlighting in LaTeX with the listings Package