3

I am building out-of-source so my build command looks like this

pdflatex -shell-escape --halt-on-error -output-directory="/tmp/build" book.tex

I have been using minted for syntax highlighting

\newcommand{\mintedoptions}{cachedir=/tmp/mint}
\usepackage[\mintedoptions]{minted}
\begin{document}
\inputminted{c}{program.c}
\end{document}

This much was working fine, but when I tried to introduce \begin{minted}{c}...\end{minted} I got this error:

! Package minted Error: Missing Pygments output; \inputminted was
probably given a file that does not exist--otherwise, you may need 
the outputdir package option, or may be using an incompatible build tool.

This problem has been solved, I applied the fix to my document

\newcommand{\mintedoptions}{cachedir=/tmp/mint,outputdir=/tmp/build}

now the document compiles apparently correctly, but the minted cache doesn't seem to be used -- compilation is very slow because all the minted code snippets are being recompiled from scratch each time

How can I have outputdir specified and keep the cache in use?

Here's a full MWE

\documentclass[a4paper,10pt]{scrbook}
\newcommand{\mintedoptions}{cachedir=/tmp/mint2,outputdir=/tmp/xxx}
\usepackage[\mintedoptions]{minted}
\begin{document}
\inputminted{c}{program.c}
\begin{minted}{c}
int main ();
\end{minted}
\end{document}

Compiled with

mkdir /tmp/xxx && pdflatex -shell-escape --halt-on-error -output-directory="/tmp/xxx" mwe.tex

Your Answer

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

Browse other questions tagged or ask your own question.