问题和背景
我有一个 shell 脚本,可以从 Gitlab wiki 下载 markdown 文件,执行一些 pandoc 过滤,然后将其转换为 PDF。
转换为 PDF 需要潘多克,它在后台使用 LaTeX。出于某种原因,当我latexmk
在--pdf-engine
选项脚本失败。
命令和错误
如果我运行pandoc mwe.tex --pdf-engine=latexmk -o ./mwe.pdf
该过程失败并pdflatex.log
显示:
INFO pdflatex - this process (2200) started by 'sh' with command line: "C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe" -interaction=batchmode -halt-on-error -interaction=batchmode -recorder -output-directory=C://Users/username/AppData/Local/Temp/tex2pdf.-f71f6aebf5dc3db8 C://Users/username/AppData/Local/Temp/tex2pdf.-f71f6aebf5dc3db8/input.tex
INFO pdflatex - allowing known shell commands
INFO pdflatex - enabling input (output) from (to) processes
INFO pdflatex - setting output directory: C:/Users\username\AppData\Local\Temp\tex2pdf.-f71f6aebf5dc3db8
INFO pdflatex - setting aux directory: C:/Users\username\AppData\Local\Temp\tex2pdf.-f71f6aebf5dc3db8
ERROR pdflatex.core - Access is denied.
ERROR pdflatex.core - Function: FindFirstFileExW
ERROR pdflatex.core - Result: 5
ERROR pdflatex.core - Data: directory="C:\$Recycle.Bin\S-1-5-18"
ERROR pdflatex.core - Source: Libraries\MiKTeX\Core\DirectoryLister\win\winDirectoryLister.cpp:135
FATAL pdflatex - Windows API error 5: Access is denied.
FATAL pdflatex - Info: directory="C:\$Recycle.Bin\S-1-5-18"
FATAL pdflatex - Source: Libraries\MiKTeX\Core\DirectoryLister\win\winDirectoryLister.cpp
FATAL pdflatex - Line: 135
INFO pdflatex - this process (2200) finishes with exit code 1
WARN miktex.core - still open: C://Users/username/AppData/Local/Temp/tex2pdf.-f71f6aebf5dc3db8/input.tex
WARN miktex.core - still open: C:/Users\username\AppData\Local\Temp\tex2pdf.-f71f6aebf5dc3db8\input.log
我尝试过的方法
运行latexmk -pdf mwe.tex
如预期。
运行pandoc mwe.tex --pdf-engine=xelatex -o ./mwe.pdf
如预期。
先前的这个问题提到权限应正确设置。我检查过,我的用户对和文件夹有Full Control
权限。 但是,错误表明文件夹有问题,该文件夹仅对 SYSTEM 用户有权限。这引发了一个问题:为什么 pdflatex 想要访问 SYSTEM 回收站而不是我的用户回收站?c:\Program Files\MiKTeX 2.9\
c:\Users\username\AppData\Local\Temp\
C:\$Recycle.Bin\S-1-5-18
平均能量损失
我的 MWE 如下:
\documentclass[]{article}
\title{Title}
\author{Author}
\date{Month 00, 1984}
\begin{document}
\maketitle
Some content
\end{document}