[Tex/LaTex] Minted not working

mintedpdftex

I'm trying to use the minted package on Windows 8. I installed python and Pygment, added C:\Python34 and C:\Python34\Scripts on my path.

When I try to compile the following latex code:

\documentclass[12pt,a4paper]{report}
\usepackage[pdftex]{graphicx} %for embedding images
\usepackage[francais]{babel}
\usepackage{eurosym}
\usepackage{pdftexcmds}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage[normalem]{ulem}
\usepackage{url} %for proper url entries
\usepackage{minted}

\begin{document}

\input{./a.tex}
\input{./b.tex}
…
\input{./h.tex}

One of the files of the input command contains this minted code:

\begin{minted}{csharp}

string test;

\end{minted}

I got the following errors, which don't make any sense to me:

\openout3 = `report.pyg'.
runsystem(pygmentize -l csharp -f latex -F tokenmerge -P style=default -P comma
ndprefix=PYGdefault -o "_minted-report/B3A3E546A80461696602265F0BBFCFE46439C04D
9C5223188E498C03CB02681D.pygtex" "report.pyg" )...executed.
(./_minted-report/B3A3E546A80461696602265F0BBFCFE46439C04D9C5223188E498C03CB026
81D.pygtex
! Undefined control sequence.
<argument> \PYGdefault
{k+kt}{string} \PYGdefault {n}{test}\PYGdefault {p}{;}
l.2 ...ring} \PYGdefault{n}{test}\PYGdefault{p}{;}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \PYGdefault {k+kt}{string} \PYGdefault
{n}{test}\PYGdefault {p}{;}
l.2 ...ring} \PYGdefault{n}{test}\PYGdefault{p}{;}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> ...g} \PYGdefault {n}{test}\PYGdefault
{p}{;}
l.2 ...ring} \PYGdefault{n}{test}\PYGdefault{p}{;}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

Best Answer

I can conform this issue now. On my local machine it was impossible to reproduce this error, but on another machine I succeeded.

I have tried it like the following.

  1. Installed python2.7 and pygmentize
  2. Did not add path and compiled (_minted-exampleb was created as subdirectory automatically) but I failed with the above message.
  3. Installed python3.4 and pygmentize
  4. Added correct path to windowsenvironment and tried to compile but I also failed.
  5. Deleted all temporary files and compiled once more. SUCCESSS. (pdf compiles correctly) (including _minted-%filname%)

It seems to me, that there are some old files or pathsettings which maybe don't access the same version of python and old files are still at the examplefolder.

I am working on windows 7, maybe this issue is OS independent, then you should try go remove all old python2.7 installations and remove all old temporary files of your examplefolder.

I am not sure but I think its worth to give it a try.