12

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.
  • 2
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – egreg Apr 6 '15 at 11:10
  • i edited my question. I really need an answer, or at least an alternative to code formatting in latex. – qleguennec Apr 6 '15 at 15:36
  • I get no error if I replace one of the \input{./a.tex} with the minted environment. – egreg Apr 6 '15 at 15:51
  • 4
    As egreg asked, please turn your code into a minimal working example (MWE); it's the surest way to a solution. – jub0bs Apr 24 '15 at 8:42
  • 1
    To that end, you might find the filecontents environment helpful. I can't reproduce this error, either. If we can't reproduce the error, we can't help :( – Sean Allred Apr 25 '15 at 14:06
27
+50

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.

  • 16
    Deleting temporary files indeed solved the problem. Thanks! – AlexG Apr 28 '15 at 10:28
  • 11
    In my case, deleting the folder _minted-maindocument helped to solve the issue. – koppor Oct 4 '15 at 10:46
  • 1
    Cleaning up the temporary files on OSX did not resolve the issue for me. – Maximilian Kohl Sep 13 '16 at 7:29
  • For me this also didn't solve the issue... I'm working on WIndows 10 with MikTex and TexMaker: My question: [here](tex.stackexchange.com/questions/339154/latex-minted-not-working-with-miktex-texmaker-under-windows-10) – FranzHuber23 Nov 14 '16 at 21:13
  • 3
    Deleting the minted-... folder fixed the issue for me too! – Kevin Van Ryckegem Nov 13 '17 at 10:27
1

I also got error messages when including minted. I tried many different things, but what finally solved my problem was including minted (\usepackage{minted}) as first package.

  • Hm, it did solve my issue as well – Post Self May 23 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.