Showing posts with label error message. Show all posts
Showing posts with label error message. Show all posts

Nov 30, 2014

latex minted package "pygmentize not installed" and "undefined control sequence \PYGzus etc" error messages solution

之前minted用的都沒事,後來不知是否因為換了電腦,同樣的tex檔在另一台電腦compile後出現"pygmentize not installed"的錯誤。因為我python pygmentize與minted都有安裝好,查了一下發現可能是檔案path中有空格的緣故,因此minted在測試pygmentize套件階段時無法通過,算是minted的一個小問題。因此我把測試pygmentize的那一個指令comment取消掉,反正我知道我一定有裝。找到minted.sty檔,應該在你的latex安裝資料夾中,並且找到以下的程式碼,將AtEndPreamble裡的測試指令取消執行。這樣就可以順利compile並且順利排版。
\AtEndPreamble{%
% \ifthenelse{\boolean{minted@draft}}{}{%
% \TestAppExists{pygmentize}%
% \ifAppExists\else
% \PackageError{minted}%
% {You must have `pygmentize' installed
% to use this package}%
% {Refer to the installation instructions in the minted
% documentation for more information.}%
% \fi
% }%
}
另外一個問題是我也遇到undefined control sequence \PYGzus 或\PYG加各式符號 etc等等的一堆錯誤指令。查了一下發現要移除minted所產生的暫存資料夾
"_minted-yourlatexfilename",移除之後就可以順利compile了。

pretty code generation

\documentclass{article}
\usepackage[inner=1in,outer=1in,top=1in,bottom=1in]{geometry}
\usepackage{minted}
\usepackage{mdframed}
\definecolor{bg}{rgb}{0.95,0.95,0.95}
\begin{document}

\begin{mdframed}[leftline=false, rightline=false,backgroundcolor=bg]
\inputminted[linenos,fontsize=\footnotesize,gobble=0,breaklines,breakanywhere]{python}{thermal_ions.py}

\end{mdframed}
\end{document}



延伸閱讀:
http://whymranderson.blogspot.tw/2014/03/4th-runge-kutta.html