14

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.
8
  • 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, 2015 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, 2015 at 15:36
  • I get no error if I replace one of the \input{./a.tex} with the minted environment.
    – egreg
    Apr 6, 2015 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, 2015 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 :( Apr 25, 2015 at 14:06

2 Answers 2

28
+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.

5
  • 17
    Deleting temporary files indeed solved the problem. Thanks!
    – AlexG
    Apr 28, 2015 at 10:28
  • 11
    In my case, deleting the folder _minted-maindocument helped to solve the issue.
    – koppor
    Oct 4, 2015 at 10:46
  • 1
    Cleaning up the temporary files on OSX did not resolve the issue for me. Sep 13, 2016 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) Nov 14, 2016 at 21:13
  • 3
    Deleting the minted-... folder fixed the issue for me too! Nov 13, 2017 at 10:27
2

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.

1
  • 1
    Hm, it did solve my issue as well
    – Post Self
    May 23, 2019 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.