1

I followed the instruction to install pygmentize in order to use syntax highlight in Latex environment, however TexMaker always produces an error says pygmentize is not found. I then tested to run the .cmd file itself using command prompt and the system says:

C:\Python27\Scripts>pygmentize.cmd
C:\Python27\python.exe: can't open file 'C:\Python27\Scripts\pygmentize': [Errno
 2] No such file or directory

I added path variable for both directories: C:\Python27 and C:\Python27\Scripts. Within C:\Python27\Scripts, there are two files:

  1. pygmentize.exe
  2. pygmentize.cmd

Where the content of pygmentize.cmd is as follows:

@echo off
set PYTHONPATH=C:\Python27
%PYTHONPATH%\python.exe %PYTHONPATH%\Scripts\pygmentize %*

The original instruction doesn't contain a \ after %PYTHONPATH%, I added because the I realize the error message is kinda odd when it says C:\Python27Scripts\python.exe. So my question is, why doesn't the Tex system recognize the executable pygmentize? Following an instruction from a SO from https://tex.stackexchange.com/questions/23458/how-to-install-syntax-highlight-package-minted-on-windows-7, I added a line:

\newcommand\TestAppExists[3]{#2}

in my .tex file and it worked only under Ubuntu. So what's the purpose of the .cmd file in this case?

Community
  • 1
  • 1
roxrook
  • 13,511
  • 40
  • 107
  • 156

1 Answers1

1

cmd.exe will prefer .exe to .cmd when choosing which pygmentize to execute, all else begin equal. python.exe will perform no magic at all and will not know what to make of C:\Python27\Scripts\pygmentize unless a file with that exact name exists.

sorpigal
  • 25,504
  • 8
  • 57
  • 75
  • Thanks again. So how could I make the Tex system understand that it should use `pygmentize.exe`? – roxrook Jul 20 '11 at 19:31
  • @Chan: When you configure it and specify the path to the executable include the `.exe` – sorpigal Jul 20 '11 at 21:32
  • @Chan: Do you know what this is supposed to be doing? I don't. I suspect that the example Windows Command script is broken: The file passed to `python.exe` should be a python script, I would think. – sorpigal Jul 20 '11 at 21:41
  • I really don't know, but I got it fixed by re-installing the package. My guess was that the cmd file give an instructions to Windows to find the `pygmentize.exe`. Once again, thanks a lot. – roxrook Jul 22 '11 at 16:57