0

I'm new to LaTeX and I want to use it for my homeworks.

Before asking help here, I opened a issue on minted's github, and the guy suggested to go here. So here is my problem :

I'm trying to use tcolorbox with minted,

Here is a test code :

\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{minted}

\begin{document} \begin{tcblisting}{minted language=java, listing only} String s = "abc"; \end{tcblisting} \end{document}

It don't want to compile it, because it doesn't find Python. I have a full portable installation of MiKTeX, VS Code (LaTeX Workshop) and of Python 3.8

By the way, I tried minted without tcolorbox and it worked perfectly.

Test code :

\documentclass{article}
\usepackage{minted}

\begin{document} \begin{minted}{java} String s = "abc"; \end{minted} \end{document}

Here is compilation's log of tcolorbox + minted tex file : test.log

And compilation's log of minted tex file : test_2.log

  • Did you compile your document with -shell-escape flag enabled? https://tex.stackexchange.com/questions/99475/how-to-invoke-latex-with-the-shell-escape-flag-in-texstudio-former-texmakerx/99476 – Alan Xiang Dec 22 '20 at 01:06
  • Yes, I compiled with -shell-escape flag and I tried --enable-write18 too – Danks Meme Dec 22 '20 at 06:42
  • tcolorbox activates the autogobble option, and you seem to have problems with the python code this calls. What happens in the example without tcolorbox if you add the option \begin{minted}[autogobble]{java}? – Ulrike Fischer Dec 22 '20 at 10:00
  • 1
    I added \begin{minted}[autogobble]{java} and checked the output and I found the same error on my problem : r:\LaTeX\Cours\test>set /p x= 0<nul: 1>>test.aex (R:\LaTeX\MiKTeX\texmfs\install\tex/latex/l3backend\l3backend-xetex.def) (test.aux) (R:\LaTeX\MiKTeX\texmfs\install\tex/latex/base\ts1cmr.fd) (_minted-test/default-pyg-prefix.pygstyle) (_minted-test/default.pygstyle)Python est introuvable. Ex�cutez sans argument pour proc�der � l (_minted-test/EA71F2074989B1673C1B5B01EDA200D266859B547044602182DB085823A77966.pygtex) [1] (test.aux), but the compilation is working. – Danks Meme Dec 22 '20 at 15:35
  • and what happens if you call python --help on a command line? Is it found? – Ulrike Fischer Dec 22 '20 at 20:17
  • It's a portable installation, so it's not found but I added a custom PATH env in VS Code (with a batch file) and LaTeX Workshop (settings.json from VS Code) – Danks Meme Dec 22 '20 at 21:08
  • I disabled autogobble by adding minted options={autogobble=false,linenos,breaklines} and now it works... What is autogobble ? – Danks Meme Dec 22 '20 at 21:10
  • Hi I'm muzimuzhi in GitHub. What do you get by running xelatex --shell-escape test.tex with test.tex containing \documentclass{article} \begin{document} \write18{python --version} \end{document}? – muzimuzhi Z Dec 22 '20 at 21:19
  • Hi, I probably found the problem.

    It's probably from Windows with App Execution Aliases, when you type python in a CMD, it redirect to the Windows Store.

    By the way, I tried your code and it give log but not the Python version

    EDIT : My first code is still not working on Github

    – Danks Meme Dec 22 '20 at 21:49
  • Can you see the python version in standard output? With xelatex --shell-escape test.tex used, It will read sth like (/usr/local/texlive/2020basic/texmf-dist/tex/latex/base/ts1cmr.fd) [1Python 2.7.16 ] (./test.aux) ). – muzimuzhi Z Dec 22 '20 at 22:06
  • The \write is not executed, because there is no page shipout. Try this one: \documentclass{article} \begin{document} text\write18{python --version}text \end{document}. – muzimuzhi Z Dec 23 '20 at 16:45
  • It show the Python version now. I will retry my first code – Danks Meme Dec 23 '20 at 19:17
  • The first code on GitHub works now! Thank you for your help – Danks Meme Dec 23 '20 at 19:21
  • You can do more tests to trace down to the exact change that helps/matters, then post it here as an answer and there in GitHub. – muzimuzhi Z Dec 23 '20 at 19:57

1 Answers1

2

Fix :

  • Add Python to PATH

  • Go to Settings, App and Features, Execution aliases

  • Disable Python

  • Restart your PC

For checking if it's working :

\documentclass{article} 
\begin{document} 
text
\write18{python --version}
text 
\end{document}

Thanks to everyone.