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

15
  • Did you compile your document with -shell-escape flag enabled? tex.stackexchange.com/questions/99475/… – Alan Xiang Dec 22 '20 at 1:06
  • Yes, I compiled with -shell-escape flag and I tried --enable-write18 too – Danks Meme Dec 22 '20 at 6: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
1

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.

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.