Skip to main content
73 votes
Accepted

Minted Error "Undefined control sequence. \PYG" with TeXmaker

I had a similar issue in Linux and removing _minted* directory solved the problem. Another option could be to include the minted package with the option cache=false. You can do this by using \...
JacintoCC's user avatar
  • 846
17 votes
Accepted

How to install pygments on windows 7

As stated on its website, pygments is a tool written in Python. So you have to do the following: Download and install a Python 3.X version from https://www.python.org/downloads/. Make sure it's in ...
TeXnician's user avatar
  • 33.7k
15 votes
Accepted

Minted Color Themes Display Improper Colors

You have to set the background color yourself. This is not the default because it is really printer unfriendly. \documentclass[a4paper]{article} \usepackage{minted,xcolor} \usemintedstyle{monokai} \...
Henri Menke's user avatar
13 votes

Add keyword to language in minted

Since I only needed highlighting for one word and couldn't find any quick solution (and didn't want to rewrite the entire highlighting), I came up with this (ashamingly) dirty workaround: Firstly, ...
cabeer's user avatar
  • 131
9 votes
Accepted

Minted ` \begin{minted}{...}` KO but `\inputminted` OK

Update (27 November 2021): This issue is now fixed in fancyvrb 4.1. In version 4.0, fancyvrb changed the handling of the lastline option so that using lastline= hides all lines (nothing is displayed). ...
G. Poore's user avatar
  • 12.5k
8 votes
Accepted

Pygments/minted highlight environment name in bold

It seems minted relies exclusively on Pygments to process the input code. The documentation itself doesn't reference ways to alter the content of the output from minted directly. The remaining ...
SDF's user avatar
  • 955
8 votes

Minted ` \begin{minted}{...}` KO but `\inputminted` OK

It is a bug/a change in the newest fancyvrb. The following prints everything with the older version but suppress the line with the newest: \documentclass[12pt]{article} \usepackage{fancyvrb} \begin{...
Ulrike Fischer's user avatar
6 votes
Accepted

pythontex not rendering pygments output under beamerswitch

It turns out the problem comes from beamerswitch including beamer with the option ignorenonframetext. This breaks the pygments support which is included in an \AfterEndPreamble hook. A work around/...
Andrew Swann's user avatar
  • 96.3k
5 votes
Accepted

TexStudio doesn't find the package "Pygments" although it is installed

is ! Package minted Error: You must have 'pygmentize' installed to use this package. The first error message you get or before that do you get ! Package minted Error: You must invoke LaTeX with ...
David Carlisle's user avatar
5 votes
Accepted

Add keyword to language in minted

Regarding minted, the answer is: You have to write an extension to the JavaScript lexer of pygmentize or modify a copy of the lexer. See the answers to the question How to add custom C++ keywords to ...
gernot's user avatar
  • 50k
5 votes

Error with pygmentize when using minted package

So after some searching I found the answer here: https://github.com/gpoore/minted/issues/81#issuecomment-125685237 and the solution was: \usepackage[cache=false]{minted} If the errors continue one ...
kexxcream's user avatar
  • 2,845
4 votes

Package minted Error: Missing Pygments output

For me this was due to two seperate problems: I didn't have enough privileges to run pygmentize, and I specified an -aux-directory argument to pdflatex without telling minted to look for the output ...
Donald Duck's user avatar
4 votes
Accepted

shell escape is disabled

In the options for latex, the tex file goes last (AFAIK). So when specifying options for an editor know which will be the placeholder for the tex file, and make sure it comes last
daleif's user avatar
  • 55.2k
4 votes

Minted ` \begin{minted}{...}` KO but `\inputminted` OK

\documentclass[12pt]{article} \usepackage{fancyvrb} \makeatletter \def\KV@FV@lastline@default{% \let\FancyVerbStopNum\m@ne \let\FancyVerbStopString\relax} \fvset{lastline} \makeatother \usepackage{...
user187802's user avatar
  • 17.4k
3 votes
Accepted

How do I avoid \PYG{err} in minted with pygments when using unicode/UTF-8 input?

I see no other way than disabling \fcolorbox inside minted, see https://tex.stackexchange.com/a/343506/4427 \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{minted} \usepackage{...
egreg's user avatar
  • 1.1m
3 votes
Accepted

How to use minted code syntax highlighting on 2 columns document?

Using the breaklines option, either globally (\setminted{breaklines=true}) or on a per-environment basis (\begin{minted}[breaklines]{<language>}), will cause lines to be wrapped. If the line ...
G. Poore's user avatar
  • 12.5k
3 votes
Accepted

Error with minted and TeXMaker : You must have `pygmentize' installed to use this package

I uninstalled TexLive and installed an older version of MacTex (My OS isn't compatible with the latest version). I reinstalled TexMaker (maybe for nothing) and it works now. I've also changed the ...
lefaba's user avatar
  • 61
3 votes
Accepted

Package minted Error: You must have `pygmentize' installed to use this package, while Pygments is already installed?

Eureka (I wish this would have been easier, e.g. from this TeXShop page). Caveat: I tested this with a TeXShop 3.89 which is nowadays an old version. To let TeXShop use --shell-escape for only one ...
user691586's user avatar
  • 2,298
2 votes

minted with Texmaker on OS X

You could try to create a symlink as a workaround: cd /usr/local/bin sudo ln -s /Users/tmartin/anaconda/bin/pygmentize pygmentize Now you have a link pygmentize within /usr/local/bin that points to ~...
beatngu13's user avatar
  • 897
2 votes
Accepted

minted and different coloured pragmas

This should do what you want. Just replace what you currently have in the preamble. \makeatletter \minted@checkstyle{default} \let\originalpyg\PYGdefault \newcommand{\activespace}{\FV@Space} \...
G. Poore's user avatar
  • 12.5k
2 votes

TeX won't recognize Pygments for use in minted

This error is because minted runs pygments on the background, and to do that it requires that the compiler has access to the shell. The error message is quite clear: Package minted Error: You must ...
Phelype Oleinik's user avatar
2 votes

Minted package not working

I found the problem, pygmentize was not correctly added to the PATH.
Christian Lorenz's user avatar
2 votes
Accepted

Compilation fails using pygment/minted on texlive 2017

I can reproduce the error starting with TeXlive2016: From there on minted uses a command (\colorlet) that exists only in xcolor (and not in color), but doesn't load the package if it detects that ...
Ulrike Fischer's user avatar
2 votes
Accepted

Strange behaviour of tcolorbox using the minted library

Welcome to TeX.SE, and thanks for making your example both shorter and self-contained (you could still remove a few packages for the sake of the question here, but that is a good start). There are two ...
frougon's user avatar
  • 24.4k
2 votes
Accepted

Can't show source code by using pygment to highlight code

As explained in the package manual, the package generates a .snippets file and you must run the external program pygmentex on this file. The -shell-escape flag is not necessary for the LaTeX runs. ...
Marijn's user avatar
  • 38.8k
2 votes
Accepted

How to use escapeinside in a json file while using minted package

The minted documentation says "Note that escapeinside does not work within strings." (p. 20). Since "world" is a string you can't put any escaped code there. It does work outside of the string. ...
Marijn's user avatar
  • 38.8k
2 votes
Accepted

Custom Pygments styles in minted not taking effect

This was solved by deleting the _minted-a/ directory and recompiling. The root cause of the problem was an attempt to use a style with a numeric name prior to the MRE presented in the question. Due ...
Adam Williams's user avatar
2 votes
Accepted

How to include minus and hyphen sign in colored python code lisiting?

I think it is a font issue. When you use \DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{12}, the font does not come with a minus sign. I am not sure why you don't try something like \newcommand\pythonstyle{\...
Alan Xiang's user avatar
  • 5,247
2 votes

Package minted Error: You must have `pygmentize' installed to use this package, while Pygments is already installed?

The pygmentize issue can be addressed by installing pygments with pip2. sudo pip2 install pygments This method works on my cases.
Covey  Zhang's user avatar
2 votes

Weird coloring with @ symbol (LaTeX Minted for Python)

For information, the package piton (which is able to format Python listings) detects @ as an operator of Python. The package piton does not use any external program but requires LuaLaTeX. \...
F. Pantigny's user avatar
  • 43.2k

Only top scored, non community-wiki answers of a minimum length are eligible