Comparison as of March 2013 (see updates below)
I'm somewhat familiar with all the common packages that use Pygments. As part of writing my
pythontex package, I researched what had been done previously.
texments is pretty basic. It doesn't provide access to much of Pygments or
minted provides much more complete access to Pygments and
fancyvrb, and adds additional functionality like background colors.
verbments is more recent than
minted, which probably explains why it is apparently less popular. The
verbments documentation says that "the
minted package cannot split the highlighted source code over pages." Technically,
minted can do that fine--the problem is with the
listing float that
minted provides. (Edit: There are also page break issues when a background color is used, but those can be overcome by not using the package's
bgcolor option and using
mdframed or a similar package instead.) The
verbments solution is to allow listing numbering and captions--but without providing a real float (which would have to solve the page break problem).
verbments also provides individual highlighting styles (you can use different Pygments styles for each environment) and a few additional options that
pygmentex is yet another Pygments package (2012-02-12). It includes custom patches for Pygments to allow escaping to LaTeX anywhere. That is nice, but may also make maintenance difficult as Pygments continues to develop. (That feature has been requested in Pygments since early 2010, and is still open.)
pygmentex provides an inline command. And it caches output.
And finally, there's my
pythontex package. (First release 2012/04/27, but in development for the previous year.) Its main purpose is to allow Python code to be included in a LaTeX document, with a means to execute the code and bring back the output. Adding Pygments highlighting was actually something of an afterthought.
pythontex provides most of
minted's functionality, except for a few things like background colors (since these can be so easily added with packages like
mdframed). It caches all highlighted content, using the mechanism I'd already created for caching the output of executed code. It also provides an inline command, allows automatic line number continuation between environments of the same language, and allows
fancyvrb settings on a per-language basis. Unicode is supported with the pdfTeX engine.
So this leaves us with many options for Pygments highlighting. Caching is really important for performance, but the downside is that both my approach and the
pygmentex approach require compiling (which saves code to an auxiliary file), running a Python script (which uses Pygments to do the highlighting, then saves the output), and compiling a second time (which brings back the highlighted output). One of the really nice things about the
\write18 approach used by the other packages is that the highlighting is always up-to-date and only requires a single compile. It probably wouldn't be hard to cache and keep everything up-to-date using LuaTeX. Otherwise, I would think about
\pdfmdfivesum (possibly with temp files), except that I don't believe XeTeX has an equivalent. There may not be a good cross-engine alternative to the three-step process.
pythontex is under active development and should continue to provide Pygments highlighting for the foreseable future. While the focus is access to Python, I'm in the midst of a major refactoring that should allow the package to be extended for arbitrary languages, with only a few dozen lines of code needed per extension. The disadvantage of all this is that
pythontex isn't quite as nimble as a highlighting-only package.
Edit: After corresponding with Konrad Rudolph, I have decided to maintain
minted. Development will be at https://github.com/gpoore/minted.
Update from July 2016
As of mid-2016,
minted will typically be the best option, unless you need specific features in
pythontex or one of the other packages.
verbments are unchanged, at least on CTAN.
pygmentex has been updated as of May 2015; based on the commit history, there don't appear to have been any major changes.
Since taking over
minted development, I have added several major features.
minted performs all highlighting in a single compile, caching highlighted code for future runs. The cache is automatically cleaned as long as the
.aux file isn't deleted. The cache can be "frozen" for use in situations in which
-shell-escape isn't available (many
minted-related things shouldn't be edited in such a situation, since it isn't possible to update the cache).
A command for inline code,
Unicode support with pdfTeX.
Arbitrary escapes to LaTeX using the
escapeinside option from Pygments 2.0+ (but note that this can be fragile depending on how Pygments tokenizes).
Automatic line breaking at spaces, between all characters, before or after user-specified characters, between space-separated tokens, or between all tokens.
bgcolor compatible with page breaks.
I have recently separated most of the line-breaking code, and some additional extensions to
fancyvrb, into a new package called
fvextra. The next versions of
pythontex will both require
fvextra; these versions will be on CTAN before the end of July 2016. This will leave
pythontex with mostly identical features, although
minted will still have the advantage of
bgcolor, token-based line breaking, and a few Pygments options in the immediate future.
pythontex may still have a speed advantage in some cases, mostly when a lot of highlighted code is modified between compiles, but that should typically be minimal.