bookmark

listings: Typeset source code listings


Description

The pack­age en­able the user to type­set pro­grams (pro­gram­ming code) within LaTeX. The source code is read di­rectly by TeX. 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). In­cludes sup­port for hy­per­ref. To use, sim­ply \usep­a­ck­age{list­ings}, iden­tify the lan­guage with \lst­set{lan­guage=Python}, then em­ploy the \be­gin{lstlist­ing} ... \end{lstlist­ing} en­vi­ron­ment or the \lstin­put­list­ing{file­name.py} com­mand. 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).

Preview

Tags

Users

  • @thorade

Comments and Reviews