Error when using minted package and -output-directory option

David Carlisle suggests the following in this answer:

You need \usepackage[outputdir=build]{minted} to tell minted where the files went.

This works perfectly for me.


I post this as an answer. It is not a complete answer, but it works.

If you have main.tex for example as your main file, an intermediate main.pyg is created in the root folder (despite having -output-directory switch) that will be deleted finally but is needed to properly typeset the source code. The solution is to make a shortcut to the main.pyg file and place it inside your -output-directory folder. The shortcut name should be main.pyg as well.

Tags:

Errors

Minted