Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

{minted} is a package that facilitates expressive syntax highlighting in LaTeX using the powerful Pygments library. The package provides options to customize the highlighted source code output using {fancyvrb}. You'll need to install the Python package Pygments (e.g using pip install Pygments). If you want to run your file with pdflatex, then you need to do so with the -shell-escape flag, e.g. pdflatex -shell-escape myfile.tex

The minted package facilitates expressive syntax highlighting in LaTeX using the powerful Pygments library. This does mean that, unlike , minted requires the installation of additional software. This may seem like a disadvantage but it does mean that whilst basically only highlights strings, comments and keywords, minted and Pygments, on the other hand, can be completely customized to highlight any token kind the source language might support. This might include special formatting sequences inside strings, numbers, different kinds of identifiers and exotic constructs such as HTML tags.

The package provides options to customise the highlighted source code output using .

For minted to work properly you need to install Python and the Pygments package. With pip you would do pip install Pygments, on a Debian-based distro you could do sudo apt-get install python-pygments. Be sure to make Pygments available in your PATH.

Any document that uses minted has to be compiled with -shell-escape, e.g. pdflatex -shell-escape myfile.tex.

history | excerpt history