我正在使用安装了 MiKTeX 2.8 的 TeXnicCenter 2.0 Alpha 3 (build 1118) 在 Vista 上使用 LaTeX。我想对 Objective-C 和 请阅读此处,minted 软件包非常棒。
我按照 pygmentize p/minted/downloads/detail?name=minted.pdf&can=2&q=" rel="nofollow noreferrer">铸造文档。我还在 TeXnicCenter 中设置了编译器选项 -shell-escape。编译器找到 pygmentize 脚本,但出现以下错误。
文件“C:\Python27\Scripts\pygmentize.exe”,第 1 行语法错误:第 1 行文件 C:\Python27\Scripts\pygmentize.exe 中的非 ASCII 字符 '\x90',但未声明编码;请参阅http://www.python.org/peps/pep-0263.html 详情! LaTeX 错误:未找到文件“Test.out.pyg”。输入 X 退出或继续,或输入新名称。 (默认扩展名:out.pyg)输入文件名:!紧急停止。
我不知道如何解决这个问题。我尝试将 tex 文件保存为 ANSI 或 UTF-8。
我对 tex 文件所做的唯一添加是包包含
\usepackage{铸造}
以及来自 minted 文档的这个简单示例。
\mint{python}|导入这个|
I am working with LaTeX on Vista using TeXnicCenter 2.0 Alpha 3 (build 1118) having installed MiKTeX 2.8. I want to use code highlighting for Objective-C and read here that the minted package is great.
I installed Python 2.7 and pygmentize as told in the minted documentation. I also set the compiler option -shell-escape in TeXnicCenter. The compiler finds the pygmentize script but the following error occurs.
File "C:\Python27\Scripts\pygmentize.exe", line 1 SyntaxError: Non-ASCII character '\x90' in file C:\Python27\Scripts\pygmentize.exe on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details! LaTeX Error: File `Test.out.pyg' not found. Type X to quit or to proceed, or enter new name. (Default extension: out.pyg) Enter file name: ! Emergency stop.
I cannot figure out how to fix the problem. I tried saving the tex file as ANSI or UTF-8.
The only additions I made to the tex file are the package include
\usepackage{minted}
and this simple example from the minted documentation.
\mint{python}|import this|
发布评论
评论(1)
minted
文档已过时:较新版本的 Pygments 显然包含 Windows 可执行文件pygmentize.exe
(不幸的是,他们的 Trac 目前处于离线状态,因此我无法查找相关修订版)这改变了这一点)。这意味着文档中提到的修复应该是多余的。因此,请尝试以下步骤:
minted
现在是否有效。如果这不起作用,请将以下内容放入
pygmentize.cmd
中:<前><代码>@echo 关闭
设置 PYTHONPATH=C:\Python27
%PYTHONPATH%\Scripts\pygmentize.exe %*
即不要通过 Python 解释器调用
*.exe
文件。不幸的是,我现在无法测试这个,因为我这里没有 Windows。但其中一个选项应该有效。
The
minted
documentation is outdated: newer versions of Pygments apparently include a Windows executablepygmentize.exe
(unfortunately, their Trac is currently offline so I can’t look up the relevant revision which changed that).This means that the fix mentioned in the documentation should be redundant. Therefore, try the following steps:
pygmentize.cmd
script entirely (best not delete it yet – just rename it). Try ifminted
now works.If that doesn’s work, put the following into the
pygmentize.cmd
:i.e. don’t invoke the
*.exe
file via the Python interpreter.Unfortunately, I can’t test this now since I don’t have Windows here. But one of the options should work.