listings – Typeset source code listings using LaTeX
The package enables the user to typeset programs (programming code) within LaTeX; the source code is read directly by TeX—no front-end processor is needed. Keywords, comments and strings can be typeset using different styles (default is bold for keywords, italic for comments and no special style for strings). Support for hyperref is provided.
To use, \usepackage{listings}, identify the language of the object to typeset, using a construct like: \lstset{language=Python}, then use environment lstlisting for inline code. External files may be formatted using \lstinputlisting to process a given file in the form appropriate for the current language. Short (in-line) listings are also available, using either \lstinline|...| or |...| (after defining the | token with the \lstMakeShortInline command).
| Sources | /macros/latex/contrib/listings |
| Documentation | |
| Version | 1.6 |
| License | The LaTeX Project Public License 1.3 |
| Copyright | 2006,2007,2013 Brooks Moses, Jobst Hoffmann |
| Maintainer | Brooks Moses (inactive) Carsten Heinz (inactive) Jobst Hoffmann |
| Contained in | TeX Live as listings |
| MiKTeX as listings | |
| Topics |
computer code listing highlight syntax of computer code, etc. |
| See also |
listing |
Download the contents of this package in one zip archive (1.4M).
Announcements
- 2015-06-05 CTAN update: listings
- 2014-09-07 CTAN update: listings
- 2014-03-07 CTAN update: listings
Suggestions
Maybe you are interested in the following packages as well.
Community Comments