gpoore/minted

Can not compile via latexmk in Windows

Closed this issue · 5 comments

I'm using Tex Live 2024. This is my .latexmkrc file:

@default_files=('main.tex');
$lualatex='lualatex -shell-escape %O %S';
$jobname='result';
$pdf_mode=4;
$bibtex_use=2;

And I made sure that I already installed pygments[windows-terminal]

When I run latexmk, I will receive this error message:

(e:/texlive/texmf-dist/tex/latex/import/import.sty))
\minted@apppathifexists =

! Package minted Error: You must have `pygmentize' installed to use this package.

See the minted package documentation for explanation.
Type  H <return>  for immediate help.
 ...

l.4 \begin{document}

?

But I will not receive this message when I use lualatex --shell-escape main.tex. What should I do?

It looks like latexmk can't find pygmentize. Are you running latexmk on the command line, or via an editor? My guess is that however it is running, it has a different PATH or environment that doesn't include pygmentize.

Are you running latexmk on the command line, or via an editor?

I ran both of these commands in Powershell instead of the IDE. I have not encountered this problem before (i.e. using Tex Live 2023 and earlier versions).

That is strange. Have you tried using cmd.exe instead of Powershell? Are you using the very latest latexmk? There was a release of latexmk recently that caused errors for me, but it was quickly followed by a new release that fixed whatever the issue was.

This still does not work in cmd (and gives the same error message). I have made sure that both PowerShell and latexmk are up to date.

Your .latexmkrc works fine for me under Windows with PowerShell and TeX Live 2024.

I think there must be some sort of configuration issue. You can add code like system('pygmentize -V'); to your .latexmkrc to see whether latexmk can find Pygments, and possibly use similar commands to try to determine what the difference is between PATH in latexmk versus PowerShell.