![在 Texstudio 中的 Minted 包中编写 Haskell 代码时出现问题](https://linux22.com/image/443693/%E5%9C%A8%20Texstudio%20%E4%B8%AD%E7%9A%84%20Minted%20%E5%8C%85%E4%B8%AD%E7%BC%96%E5%86%99%20Haskell%20%E4%BB%A3%E7%A0%81%E6%97%B6%E5%87%BA%E7%8E%B0%E9%97%AE%E9%A2%98.png)
我用过这个
\documentclass[12pt]{article}
\usepackage{minted}
\begin{document}
\begin{minted}{haskell}
--type Stack a = [a]
--push :: Stack a -> a -> Stack a
--push xs x = x:xs
--pop :: Stack a -> (a, Stack a)
--pop [] = error "Empty List"
--pop (x:xs) = (x, xs)
data Stack a = Stack [a]
instance Show a => Show (Stack a) where
show (Stack [a]) = show [a]
push :: Stack a -> a -> Stack a
push (Stack xs) x = Stack (x:xs)
pop :: Stack a -> (a,Stack a)
pop (Stack xs)
| null xs = error "Empty List"
| otherwise = (head xs, Stack xs)
\end{minted}
\end{document}
它向我展示了错误
line 3: Package minted Error: You must invoke LaTeX with the -shell-escape flag. \begin
line 3: Emergency stop. \begin{document}
: shell escape is disabled, so I can only detect \ifwindows.
-shell-escape
然后我使用pdflatex 部分中“configure texstudio”命令部分中的命令,如下所示
pdflatex.exe -synctex=1 -interaction=nonstopmode -shell-escape %.tex
然后它向我显示了这个错误
line 35: Package minted Error: You must have `pygmentize' installed to use this package. \begin{document}
然后我通过运行命令安装了 pygments
pip3 install pygments
这是我给出的日志文件链接日志档案
如何最终克服这一切。并开始使用 minted 编写 haskell 代码。作为参考,我使用 Windows 11 和 texstudio。