EDIT3: As of 2017-01-09, the bug has been fixed (see: https://sourceforge.net/p/miktex/bugs/2565/)

EDIT2: After contacting the miktex-users mailing list, it appears this is a current bug. Until it is resolved, please see my answer below for a workaround.

I have been using the following in a batch file to build my LaTeX documents for many months without issue:

@miktex-xelatex.exe -enable-enctex -enable-etex -enable-installer -enable-mltex 
-enable-pipes -enable-write18 -synctex=1 -aux-directory=_build_files 
-output-directory=./ "%1.tex"

Today, I updated (both as user and as admin) MiKTeX, which has a bunch of .exe file updates/removals. Everything builds more or less properly, but the -aux-directory option seems to have just completely stopped working when -output-directory is present. It seems -output-directory now acts like -aux-directory AND overrides it.

I had been using -aux-directory for all the build files, but still wanted -output-directory for putting the .pdf and .synctex.gz output files. But, with the update, I can user either

@miktex-xelatex.exe -enable-enctex -enable-etex -enable-installer -enable-mltex 
-enable-pipes -enable-write18 -synctex=1 -aux-directory=_build_files "%1.tex"


@miktex-xelatex.exe -enable-enctex -enable-etex -enable-installer -enable-mltex 
-enable-pipes -enable-write18 -synctex=1 -output-directory=_build_files "%1.tex"

The problem here is that neither of these methods places the .pdf and .synctex.gz output files in the same directory as the .tex file

It seems like this must be a bug? (it was working before the 2016-12-23 version of the files)

EDIT: It may have been introduced prior to 2016-12-23. After thinking about it... I'm not sure exactly how recently I updated MiKTeX and packages. Therefore, it might have be 1-2 versions earlier?


This is not a proper solution, because I still believe this is a bug. However, if anyone else is having the problem, hopefully it will help them handle it until the .exe is updated.

I modified the miktex-xelatex.exe call in the .bat file to (ie. removed the -output-directory option:

@miktex-xelatex.exe -enable-enctex -enable-etex -enable-installer -enable-mltex 
-enable-pipes -enable-write18 -synctex=1 -aux-directory=_build_files "%1.tex"

I also needed to add the following to options to copy the .pdf and .synctex.gz output files from the build folder back to the .tex folder.

@copy /Y "OUTPUT_DIR\%1.pdf" "%1.pdf"
@copy /Y "OUTPUT_DIR\%1.synctex.gz" "%1.synctex.gz"

Hope this helps someone!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.