1

Problem and context

I have a shell script that downloads markdown files from a Gitlab wiki, does some pandoc filtering and then converts it to a PDF.

The conversion to PDF happens with pandoc, which uses LaTeX in the background. For some reason when I specify latexmk in the --pdf-engine option the script fails.

Command and error

If I run pandoc mwe.tex --pdf-engine=latexmk -o ./mwe.pdf the process fails and pdflatex.log shows:

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

What I've tried

Running latexmk -pdf mwe.tex works as expected.
Running pandoc mwe.tex --pdf-engine=xelatex -o ./mwe.pdf works as expected.

This previous question mentions that permissions should be set correctly. I've checked, and my user has Full Control permissions on c:\Program Files\MiKTeX 2.9\ and c:\Users\username\AppData\Local\Temp\ folders.
However, the error states that the folder C:\$Recycle.Bin\S-1-5-18 is causing trouble, which only has permissions for the SYSTEM user. That raises the question: why does pdflatex wants to access the SYSTEM recycle bin instead of my users recycle bin?

MWE

My MWE is found below:

\documentclass[]{article}

\title{Title} \author{Author} \date{Month 00, 1984}

\begin{document} \maketitle

Some content

\end{document}

  • 1
    May be pandoc mwe.md -o .mwe.tex; latexmk -pdf mwe.tex ? – Fran Sep 17 '20 at 05:22
  • I have some experience with biber misbehaving similarly when used in user-controlled windows environment. latexmk and biber are both perl (but the similarity ends there). Try to work as suggested by @Fran ; othewise you would have to do some changes for par-packer if you really insist on one step process with latexmk – Tomáš Kruliš Sep 17 '20 at 07:20
  • The suggested workaround (first pandoc, then latexmk) works, but I'm still curious why it's not working. I'll see if I can post this at the pandoc forum. – Saaru Lindestøkke Sep 17 '20 at 08:03
  • "I've checked and my user has appropriate permissions. " However, it seems a problem of Windows permissions. In Linux I tested an equivalent markdown example, i.e., a mwe.md with a YALM header with title: xxx, author: yyy, date: date: zzz and output: pdf_document, and only "Some content " as document text, and pandoc --pdf-engine=latexmk mwe.md -o mwe.pdf works without any problem. – Fran Sep 17 '20 at 21:05
  • I've rechecked permissions, and indeed the folder it's complaining about (C:\$Recycle.Bin\S-1-5-18) is not accessible to my user, but that is at it should be. Not sure why pdflatex wants to access it though. – Saaru Lindestøkke Sep 17 '20 at 21:28
  • You may want to pass a different directory to latexmk to use as a using pdf-engine-opt and the -output-directory=dir (or -outdir=dir) option of latemk. That is, try with pandoc test.tex --pdf-engine=latexmk --pdf-engine-opt=-output-directory=. -o mwe.pdf. – Clément Oct 29 '21 at 18:17

0 Answers0