[Tex/LaTex] minted vs. listings: pros and cons

comparisonlistingsminted

While I'm switching from minted to listings, I would like to ask you
for this comparison.

The following is what it comes to my mind till now:

Eventually, which are the pros and cons of these two packages?

Best Answer

This is really further commentary on samcarter's answer.

minted uses an external library to do the highlighting, listings does everything in TeX. Almost all the pros and cons are attributable to this difference alone.

  • minted is more fiddly to set up (you need pygments and python to be installed and for tex to find them)

  • minted needs (at some point in the processing) -shell-escape to allow access to the shell. Note that recent versions do not require shell access in final versions of the document, so you can submit to journals etc a source that does not require -shell-escape but uses the previously generated files from an earlier cached run.

  • the pygmentize parsing library is far more extensive and expressive than the simple keyword detection in listings so the language specific support is much greater in minted.

  • pygmentize is used by many other systems and produces output in forms other than Tex (notably HTML/CSS). For example it is used by the trac svn/wiki system and so code can be typeset with minted using the same highlighting rules as used on the other systems.

  • as most of the real work in minted is in pygmentize (python) it is somewhat less easy to customize just from TeX, but on the other hand if you do customize the pygments lexer for a specific language it is usable in contexts other than TeX.