将 Python 代码集成到 Latex

将 Python 代码集成到 Latex

你好,我想用 Minted 显示代码。我写了以下内容

\documentclass[11pt]{article}
\usepackage{minted}
\usemintedstyle{fruity}
\begin{document}
\begin{minted}{python}
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from matplotlib.patches import Path, PathPatch
\end{minted}
\end{document}

但是,我不断收到错误消息,提示 \end{minted} 不起作用。我做错了什么?

错误:

probably given a file that does not exist--otherwise, you may need 
the outputdir package option, or may be using an incompatible build tool,
or may be using frozencache with a missing file.

See the minted package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.18 \end{minted}
                 
This could be caused by using -output-directory or -aux-directory 
without setting minted's outputdir, or by using a build tool that 
changes paths in ways minted cannot detect, 
or using frozencache with a missing file.
```

相关内容