minted vs build directory

So I stop wasting time repeatedly searching for a simple fix…    #latex #minted #build #dir

Using the minted package, is troublesome because of the double build directories. The solution is the following. Load the package like this:


This means that doing the main compile, the package will temporarily create the file build/report.pyg (in the case of the reports template).

So far so good. The problem is that when doing the unabridged build, so far as minted knows, its output directory is still build/, so it will expect a file in that directory named Unabridged.pyg. The solution is to add this line to the compile() method (in script), before invoking the compiler:

ln -srf "$build_dir_unabridged"/"$name_unabridged".pyg "$build_dir_regular"

June 15, 2022.