I am trying to use the listings package to show code in my document, but for some reason, if I include this package, the whole document doesn't compile. I don't get any error messages, just:
Process started: pdflatex.exe -synctex=1 -interaction=nonstopmode "test".tex
Process exited normally But the document would not update.
My code is simple:
\documentclass[]{article}
\usepackage{listings}
\begin{document}
\begin{lstlisting}
test
\end{lstlisting}
\end{document}
If I remove \usepackage{listings} as well as the \begin{lstlisting} block, I am able to compile the document normally.
I am using TeXstudio 4.3.1 with MiKTeX (all packages updated).
The same problem happens with other packages that depend on listings (such as mcode and matlab-prettifier mentioned in this post): What can I use to typeset MATLAB code in my document?
When I try to use the minted package (code below):
\documentclass[]{article}
\usepackage{minted}
\begin{document}
\begin{minted}{python}
test
\end{minted}
\end{document}
I get the following error messages:
Package minted Error: You must invoke LaTeX with the -shell-escape flag. \begin
Emergency stop. \begin{document}
shell escape is disabled, so I can only detect \ifwindows.
I have no issues using verbatim, however, but it does not give me the line wrapping feature I need.
mintedpackage documentation, minted says that-shell-escapeneeds to be added because themintedpackage calls external sources to process the code in Latex. If this is not something that would be preferred then usingverbatimwould be the option with the least configuration changes required. – Leucippus Nov 16 '22 at 19:02pdflatex yourfileso that you get a proper error message. – Ulrike Fischer Nov 16 '22 at 23:53