Menu
CTAN
Comprehensive TeX Archive Network
Cover Upload Browse Search

listings – Typeset source code listings using LaTeX

The pack­age en­ables the user to type­set pro­grams (pro­gram­ming code) within LaTeX; the source code is read di­rectly by TeX—no front-end pro­ces­sor is needed. Key­words, com­ments and strings can be type­set us­ing dif­fer­ent styles (de­fault is bold for key­words, italic for com­ments and no spe­cial style for strings). Sup­port for hy­per­ref is pro­vided.

To use, \usep­a­ck­age{list­ings}, iden­tify the lan­guage of the ob­ject to type­set, us­ing a con­struct like: \lst­set{lan­guage=Python}, then use en­vi­ron­ment lstlist­ing for in­line code. Ex­ter­nal files may be for­mat­ted us­ing \lstin­put­list­ing to pro­cess a given file in the form ap­pro­pri­ate for the cur­rent lan­guage. Short (in-line) list­ings are also avail­able, us­ing ei­ther \lstin­line|...| or |...| (af­ter defin­ing the | to­ken with the \lstMakeShortIn­line com­mand).

Sources/macros/latex/contrib/listings
Doc­u­men­ta­tion
Ver­sion1.5c
Li­censeThe LaTeX Project Public Li­cense
Copy­right2006,2007,2013 Brooks Moses, Jobst Hoff­mann
Main­tainerBrooks Moses (in­ac­tive)
Carsten Heinz (in­ac­tive)
Jobst Hoff­mann
Con­tained inTeXlive as list­ings
MikTeX as list­ings
Topics com­puter code list­ing
high­light syn­tax of com­puter code, etc.
See also listing

Down­load the con­tents of this pack­age in one zip archive (1.4M).

Guest Book Sitemap Contact