设想
我正在 Windows 10 Pro N 设备上的 Anaconda 4.8.2 中从 python 3.6 编译 latex 文档。为此,我在 Anaconda Prompt 中创建了一个 python 3.6 环境,并使用命令在 anaconda 中安装了 miktex:
conda install -c conda-forge miktex
并执行以下 Python 代码:
def create_pdfV3(self, input_filename, output_filename):
argList = [
'pdflatex', # Or maybe 'C:\\Program Files\\MikTex\\miktex\\bin\\latex.exe
'-output-format=pdf',
'-job-name=' + output_filename,
input_filename,
'-enable-installer']
print(f'argList={argList}')
process = subprocess.Popen(argList)
返回以下错误:
(C:\Users\someuser\AppData\Roaming\MiKTeX\2.9\tex\latex\listofitems\listofitems.sty
(C:\Users\someuser\AppData\Roaming\MiKTeX\2.9\tex\generic\listofitems\listofitems.tex
! Package listofitems Error: the \expanded primitive is not provided by your Te
X engine, listofitems v1.63 cannot work: loading listofitems v1.61.
See the listofitems package documentation for explanation.
Type H <return> for immediate help.
...
l.67 {\input listofitemsold.tex\relax\endinput}
%
?
据我了解这个问题导致此错误的原因是,用于编译的 TEX 引擎main.tex
未更新以包含\expanded
原语。
pdflatex --version
在 Anaconda prompt 的 python 3.6 环境中手动执行命令找到 pdflatex 使用的版本,结果如下:
pdflatex --version
MiKTeX-pdfTeX 2.9.6668 (1.40.19) (MiKTeX 2.9.6730)
Copyright (C) 1982 D. E. Knuth, (C) 1996-2018 Han The Thanh
TeX is a trademark of the American Mathematical Society.
using bzip2 version 1.0.6, 6-Sept-2010
compiled with curl version 7.56.1; using libcurl/7.56.1 WinSSL
compiled with expat version 2.2; using expat_2.2.0
compiled with jpeg version 9.2
compiled with liblzma version 50020032; using 50020032
compiled with libpng version 1.6.34; using 1.6.34
compiled with libressl version LibreSSL 2.5.3; using LibreSSL 2.5.3
compiled with MiKTeX Application Framework version 2.6636; using 2.6636
compiled with MiKTeX Core version 7.6745; using 7.6745
compiled with MiKTeX Archive Extractor version 1.6300; using 1.6300
compiled with MiKTeX Package Manager version 3.6727; using 3.6727
compiled with poppler version 0.60.1
compiled with uriparser version 0.8.4
compiled with zlib version 1.2.11; using 1.2.11
问题
如何切换 TEX 引擎以启用原语编译\expanded
?