0

In issue with minted and LuaLaTeX there is a discussion in the comments underneath the question and an answer confirming the issue. Since I can confirm the issue as well and have additional information to share, it seems better to continue the question than to extend the comments or provide a non-answer.

I used another MWE but one comparable to mbert's in the original question on two machines:

  1. Desktop CPU i9 32GB RAM Windows 11 V22H2 TeXStudio 4.4.1 MikTeX 2.9 updated Python 3.11 Pygments 2.14
  2. Laptop CPU AMD Athlon II 8GB RAM Xubuntu 22.04 TeXStudio 4.0.1 MikTeX 2.9 updated Python 3.11 Pygments 2.14

MWE used on both machines:

\documentclass{article}

\usepackage{minted}

\begin{document}

\begin{minted}{c}
    int main() {
        printf("hello, world");
        return 0;
    }
\end{minted}

\end{document}

I obtained the following results:

  1. Compiling with PDFLatex gave the desired result. The code in the minted environment was set properly. The additional directory created by minted contained two files: one with a long string name and one called default.pygstyleof about 7kB.
  2. Compiling with XeXeTeX provided an output in which all spaces and tabs were shown as ^^I and the colouring of the code was absent. The ^^I is defined in the fancyvrb package. This occurred on both machines.
  3. Compiling with LuaLaTeX was successful on the laptop (Xubuntu), but not on the desktop (Windows). The directory was created by minted under Windows, but contained only the file default.pygstyle of 0kB. An empty one thus.
  4. Compiling with PDFLaTeX followed by compiling with LuaLaTeX still gave the !Package minted Error: You must have pygmentize installed to use this package error, but did give a correct output. That second compiling used the directory created by the first one.

The difference in the logfile between the Xubuntu version and the Windows version is in:

runsystem(for ^%i in (pygmentize.exe pygmentize.bat pygmentize.cmd) do set > min
ted_test.aex <nul: /p x=^%~$PATH:i>> minted_test.aex)...failed

runsystem(del minted_test.aex)...executed

Under Windows the result of the shell escape comes back as failed, whereas under Xubuntu the result is executed. Both machines use the same shellesc:

Package: shellesc 2019/11/08 v1.0c unified shell escape interface for LaTeX
Package shellesc Info: Unrestricted shell escape enabled on input line 75.

To me it seems that there some kind of obscure issue in -shell-escape when using shellesc in LuaLaTeX on a Windows machine.

Hopefully someone more knowledgeable about the inner workings of shellesc on Windows command line can shed some light on this issue.

Note: Of course I can compile my .tex files on my laptop and drink a cup of coffee or more, but it would be nice to see the issue on my desktop solved.

Additional information Following instructions in the comments of the original question I found the following issue in the path statement when compiling using LuaLaTeX under Windows:

When I use the line \ShellEscape{path > path.txt} in PDFLaTeX I get a complete path statement in path.txt - as it should be. However when I use LuaLaTeX path.txt contains only one line: PATH=C:\Open Source\MikTeX\miktex\bin\x64\ which obviously isn't correct. So LuaLaTeX somehow purges the correct Windows path statement and replaces it with the MikTeX location.

\documentclass[11pt]{article}

\usepackage{shellesc}

\begin{document} \ShellEscape{path > path.txt} \end{document}

The MikTeX documentation on LuaLaTeX contains the following lines in the Options section:

When the LuaTeX executable starts, it looks for the --lua commandline option. If there is no --lua option, the commandline is interpreted in a similar fashion as in traditional pdfTeX. But if the option is present, LuaTeX will enter an alternative mode of commandline parsing in comparison to the standard MiKTeX programs. The presence of --lua makes most of other options unreliable, because the Lua initialization file can disable path searching and/or hook functions into various callbacks.

In my TeXStudio setup, there is no switch --lua present in the LuaLaTeX command. It just reads:

lualatex.exe -synctex=1 -interaction=nonstopmode --shell-escape %.tex

alchemist
  • 1,761
  • well I have no problems on my windows with miktex. On my system the test reports a failure too, imho correctly as I have only pygmentize.exe and the other two call should fail. Is something unusual with your pathes? Do you have non-ascii or spaces or something similar in them? – Ulrike Fischer Jan 28 '23 at 16:32
  • @UlrikeFischer you mentioned in the other question that you don't have problems. I followed the instructions given in the minted manual and on the website of python to install both python and pygments. There are spaces in both path environments, but no non-ascii characters. As PDFLatex compiling is successful, I wouldn't think those spaces should be a problem. – alchemist Jan 28 '23 at 17:56
  • BTW: can you elaborate on only pigmentize.exe and the remark the other two call should fail? If that is a difference between your Windows setup and mine, we might be on the track of something. – alchemist Jan 28 '23 at 17:58
  • the for loop tests pygmentize.exe, pygmentize.bat and pygmentize.bat. I have only the first. – Ulrike Fischer Jan 29 '23 at 10:41
  • @UlrikeFischer I have two .sty files in the minted map called minted.sty (48kB) and minted1.sty (10kB). Both files contain a section that starts with \newcommand\TestAppExists[1] followed by \ifwindows (line 180 resp. 65). In that section there is a \ShellEscape{ .... } that calls on testing #1.exe #1.bat #1.com. In the following else section \ShellEscape{ .... } only contains a call to #1 . Guess that section is used on Apple and Linux installations. – alchemist Jan 29 '23 at 12:32
  • sure, shell-escape and pygmentize detection is different on windows and linux. But your minted detects both correctly on windows, and it also creates the folder, it is the next step that fails. So you should better look what is going on with the commands on line 512 and following of minted.sty. – Ulrike Fischer Jan 29 '23 at 13:32
  • @UlrikeFischer please check the updated information. Somehow the path statement in your installation seems to remain intact, whereas mine (and that of several others) is changed. Why and how that occurs is a complete mystery to me. – alchemist Mar 03 '23 at 15:15
  • I have not found a solution, but I have the same problem and wanted to note that the problem has also been discussed here: https://tex.stackexchange.com/questions/673564/shellescape-fails-in-certain-cases-with-lualatex – Noiralef Oct 27 '23 at 08:55

0 Answers0