1

After downloading the Minted and Pygmentize packages for TeXstudio, I am experiencing an error:

File 'pygmentize.sty' not found. \begin.

Here is the code for my document so far:

\documentclass{article}
\usepackage{minted, pygmentize}
\begin{document}
    \begin{minted}{python}
        import numpy as np
        
        def incmatrix(genl1,genl2):
        m = len(genl1)
        n = len(genl2)
        M = None #to become the incidence matrix
        VT = np.zeros((n*m,1), int)  #dummy variable
        
        #compute the bitwise xor matrix
        M1 = bitxormatrix(genl1)
        M2 = np.triu(bitxormatrix(genl2),1) 
        
        for i in range(m-1):
        for j in range(i+1, m):
        [r,c] = np.where(M2 == M1[i,j])
        for k in range(len(r)):
        VT[(i)*n + r[k]] = 1;
        VT[(i)*n + c[k]] = 1;
        VT[(j)*n + r[k]] = 1;
        VT[(j)*n + c[k]] = 1;
        
        if M is None:
        M = np.copy(VT)
        else:
        M = np.concatenate((M, VT), 1)
        
        VT = np.zeros((n*m,1), int)
        
        return M
    \end{minted}
\end{document}

Here are my steps so far:

  1. Installed recent version of Python through the Microsoft Store
  2. Used Windows PowerShell to install pygments PS C:\Users\mandjelo>python -m pip install pygments
  3. Received the return message from the terminal:
The script pygmentize.exe is installed in 'C:\Users\mandjelo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  1. Windows menu > Settings > About > Advanced system settings > Environment Variables > Select Path in System Variables > Added file path listed from the return message enter image description here
  2. Opened a new session in TeXstudio
  3. Developed the user command user0:graphviz-pdflatex txs:///pdflatex/[--shell-escape] to negate -shell-escape in order for Minted to run
  4. Constructed the code with \usepackage{minted, pygmentize}
  5. Approved the according packages for download
  6. Initiated user command from step 5
  7. Received error File 'pygmentize.sty' not found. \begin.

If I'm still searching for an answer on here and other sites, but any input or linked sources would be greatly appreciated. Thanks!

1 Answer 1

0

I think the name of the package you are looking for is not pygmentize but pygmentex. When I replace pygmentize in the second line of your code through pygmentex, your example compiles without errors. But your example compiles also without the package pygmentex.

1
  • That seemed to fix it! The only issue I ran into afterwards was the need to update MiKTeX. Nothing seems broken (yet), but I've tested the code in both TeXstudio and TeXMaker and the document compiles correctly. I was sure the package was pygmentize but maybe that one is specifically designed for Overleaf? Anyways, I appreciate the help, thank you!
    – mandjelo
    Jul 10, 2023 at 16:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .