I am using texmaker on a Mac and I tired to use the minted package with this code
\documentclass[12pt,A4]{article}
\usepackage{minted}
\begin{document}
\begin{minted}{python}
def __init__(self, x, y):
self.x=x
self.y=y
\end{minted}
\end{document}
but when compiling my code I get the following error:
! Package minted Error: You must have `pygmentize' installed to use this package
However I actually did install the package as described using
sudo easy_install Pygments
I even tried restarting. Still getting the same error.
I really don't see how to fix this error, can someone help me?
When creating the pdf as suggested by egreg the resulting pdf looks like this:
/Library/Frameworks/Python.framework/Versions/2.7/bin
/opt/local/bin
/opt/local/sbin
/opt/local/bin
/opt/local/sbin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/usr/texbin
/usr/X11/bin
Is there pygmentize?
/Library/Frameworks/Python.framework/Versions/2.7/bin/pygmentize
Judging from that there is Pygmentize on my mac?!
Best Answer
Write a file
path.tex
containing exactly this:and run from the Terminal the command
You'll see in the produced
path.pdf
file whatpdftex
sees asPATH
. If there's a path after "Is there pygmentize?" you'll be OK.Now it's only a question of telling Texmaker that you want to execute external programs such as
pygmentize
: go to the "Preferences" menu in Texmaker and choose the "Commands" tab. In line next to "PdfLaTeX" there should beChange it into
Beware that this opens some security issues, so remove
-shell-escape
when typesetting documents you get from non trusted sources.A safer way could be to define a "User command": go to the menu User > User Commands > Edit User Commands and in the upper space write something such as "pdftex-shell-escape"; in the lower space write the string above. You'll have a shortcut for using the shell escape only when you choose to, by pressing Alt+Shift+F1