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
19 votes

Pygmentize not working properly with minted package in TexShop on OS X

I had the same problem and it took me a while until I realized it was TeXShop causing all the trouble. Like you already mentioned, you need a reference to pygmentize within /Library/TeX/texbin, but it'...
beatngu13's user avatar
  • 867
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.4k
14 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
12 votes

Using minted package on Ubuntu: .w18 file not found error

It seems that I am facing exactly the same problem. It does not make any sense for me. However, it only worked for me when I removed the spaces from the name of tex file. The original name had some ...
DanielTheRocketMan's user avatar
12 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
  • 121
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.3k
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
  • 94.9k
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
  • 48.7k
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,775
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
  • 53k
4 votes
Accepted

How to invoke minted with python3

I figured out that in my particular case TeXShop was causing the error. One must create a symlink within /Library/TeX/texbin to pygmentize (see this answer). Afterwards you can also omit to reset \...
beatngu13's user avatar
  • 867
4 votes

How to invoke minted with python3

minted invokes the pygmentize script, which provides a command-line interface to Pygments. If minted can't find pygmentize, then the command-line scripts for Python 3 aren't available, and you ...
G. Poore's user avatar
  • 12.3k
4 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
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
  • 16.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

Cannot get 'pygmentize' to work correctly on mac

Recently I had the same problem. The issue was that TeXworks has different PATH environment from your terminal. My solution was to create a symbolic link to pygmentize from /Library/Frameworks/Python....
zitryss's user avatar
  • 41
3 votes

Python error while generating code snippets with minted and Pygments in Anki

I believe that the problem is that pygmentize which is called by the minted package is a python script. When called from inside Anki.app, pygmentize uses the python environment inside of Anki, which ...
Stephan Kadauke's user avatar
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.3k
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
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.3k
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
  • 867
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

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

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
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
  • 24k

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